about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2022-04-13 19:46:03 -0500
committerNoah Goldstein <goldstein.w.n@gmail.com>2022-04-13 21:23:04 -0500
commit535e935a284b2ec96659d1ac40eebf61321f2362 (patch)
tree05e8df88daa71e7dc7d39d7cdb994045e85e69b7 /elf
parentd275970ab56f8ba6a3ca598aba75db4daabe5924 (diff)
downloadglibc-535e935a284b2ec96659d1ac40eebf61321f2362.tar.gz
glibc-535e935a284b2ec96659d1ac40eebf61321f2362.tar.xz
glibc-535e935a284b2ec96659d1ac40eebf61321f2362.zip
Replace {u}int_fast{16|32} with {u}int32_t
On 32-bit machines this has no affect. On 64-bit machines
{u}int_fast{16|32} are set as {u}int64_t which is often not
ideal. Particularly x86_64 this change both saves code size and
may save instruction cost.

Full xcheck passes on x86_64.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/dl-lookup.c12
-rw-r--r--elf/dl-machine-reject-phdr.h2
-rw-r--r--elf/dl-profile.c2
-rw-r--r--elf/setup-vdso.h2
5 files changed, 10 insertions, 10 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 892e8ef2f6..2fdd612997 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1093,7 +1093,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
    /* On most platforms presume that PT_GNU_STACK is absent and the stack is
     * executable.  Other platforms default to a nonexecutable stack and don't
     * need PT_GNU_STACK to do so.  */
-   uint_fast16_t stack_flags = DEFAULT_STACK_PERMS;
+   unsigned int stack_flags = DEFAULT_STACK_PERMS;
 
   {
     /* Scan the program header table, collecting its load commands.  */
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 7b2a6622be..989b073e4f 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -208,7 +208,7 @@ is_nodelete (struct link_map *map, int flags)
    in the unique symbol table, creating a new entry if necessary.
    Return the matching symbol in RESULT.  */
 static void
-do_lookup_unique (const char *undef_name, uint_fast32_t new_hash,
+do_lookup_unique (const char *undef_name, unsigned int new_hash,
 		  struct link_map *map, struct sym_val *result,
 		  int type_class, const ElfW(Sym) *sym, const char *strtab,
 		  const ElfW(Sym) *ref, const struct link_map *undef_map,
@@ -339,7 +339,7 @@ marking %s [%lu] as NODELETE due to unique symbol\n",
    something bad happened.  */
 static int
 __attribute_noinline__
-do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
+do_lookup_x (const char *undef_name, unsigned int new_hash,
 	     unsigned long int *old_hash, const ElfW(Sym) *ref,
 	     struct sym_val *result, struct r_scope_elem *scope, size_t i,
 	     const struct r_found_version *const version, int flags,
@@ -558,13 +558,13 @@ skip:
 }
 
 
-static uint_fast32_t
+static uint32_t
 dl_new_hash (const char *s)
 {
-  uint_fast32_t h = 5381;
+  uint32_t h = 5381;
   for (unsigned char c = *s; c != '\0'; c = *++s)
     h = h * 33 + c;
-  return h & 0xffffffff;
+  return h;
 }
 
 
@@ -816,7 +816,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
 		     const struct r_found_version *version,
 		     int type_class, int flags, struct link_map *skip_map)
 {
-  const uint_fast32_t new_hash = dl_new_hash (undef_name);
+  const unsigned int new_hash = dl_new_hash (undef_name);
   unsigned long int old_hash = 0xffffffff;
   struct sym_val current_value = { NULL, NULL };
   struct r_scope_elem **scope = symbol_scope;
diff --git a/elf/dl-machine-reject-phdr.h b/elf/dl-machine-reject-phdr.h
index ea18289fda..ad64cf40ea 100644
--- a/elf/dl-machine-reject-phdr.h
+++ b/elf/dl-machine-reject-phdr.h
@@ -24,7 +24,7 @@
 /* Return true iff ELF program headers are incompatible with the running
    host.  */
 static inline bool
-elf_machine_reject_phdr_p (const ElfW(Phdr) *phdr, uint_fast16_t phnum,
+elf_machine_reject_phdr_p (const ElfW(Phdr) *phdr, unsigned int phnum,
 			   const char *buf, size_t len, struct link_map *map,
 			   int fd)
 {
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..ec57e3a965 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -558,7 +558,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	  /* If we still have no entry stop searching and insert.  */
 	  if (*topcindex == 0)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      unsigned int newarc = catomic_exchange_and_add (narcsp, 1);
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
diff --git a/elf/setup-vdso.h b/elf/setup-vdso.h
index db639b0d4f..c0807ea82b 100644
--- a/elf/setup-vdso.h
+++ b/elf/setup-vdso.h
@@ -36,7 +36,7 @@ setup_vdso (struct link_map *main_map __attribute__ ((unused)),
       l->l_phdr = ((const void *) GLRO(dl_sysinfo_dso)
 		   + GLRO(dl_sysinfo_dso)->e_phoff);
       l->l_phnum = GLRO(dl_sysinfo_dso)->e_phnum;
-      for (uint_fast16_t i = 0; i < l->l_phnum; ++i)
+      for (unsigned int i = 0; i < l->l_phnum; ++i)
 	{
 	  const ElfW(Phdr) *const ph = &l->l_phdr[i];
 	  if (ph->p_type == PT_DYNAMIC)