]> sourceware.org Git - glibc.git/commitdiff
Small optimization of STT_GNU_IFUNC handling.
authorUlrich Drepper <drepper@redhat.com>
Mon, 1 Jun 2009 18:49:05 +0000 (11:49 -0700)
committerUlrich Drepper <drepper@redhat.com>
Mon, 1 Jun 2009 18:49:05 +0000 (11:49 -0700)
The test to call the indirect function now includes a subtest to
checked whether the symbol is defined.  When coming to that point
this is almost always the case.  The test for STT_GNU_IFUNC on the
other hand rarely is true.  Move it to the front means we don't have
to perform the second test unless really necessary.

ChangeLog
sysdeps/i386/dl-machine.h
sysdeps/x86_64/dl-machine.h

index 10829a3d2100de1b22506862562742526fa7ee30..6aad771397a7b25dcdbe65155c971780912829a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-06-01  Ulrich Drepper  <drepper@redhat.com>
 
+       * sysdeps/i386/dl-machine.h (elf_machine_rel): Reorder conditions
+       for STT_GNU_IFUNC handling for efficiency.
+       * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
+
        * sysdeps/i386/dl-irel.h (elf_irel): Use __libc_fatal instead of just
        _exit.
        * sysdeps/x86_64/dl-irel.h (elf_irela): Likewise.
index efa929e57fa59442b10f7fc53d914f036f9fdcc2..a093d2b1516a4ec7cd1320aa3563df939510357c 100644 (file)
@@ -345,9 +345,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
       Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
 
       if (sym != NULL
-         && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
          && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
-                              0))
+                              0)
+         && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
        value = ((Elf32_Addr (*) (void)) value) ();
 
       switch (r_type)
index 1b5ce8e981be316be8c9787732066990310b1fb0..61a0556d5e4b6a7e119ce68a6470a9389e23b924 100644 (file)
@@ -297,9 +297,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
                          : (Elf64_Addr) sym_map->l_addr + sym->st_value);
 
       if (sym != NULL
-         && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
          && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
-                              0))
+                              0)
+         && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1))
        value = ((Elf64_Addr (*) (void)) value) ();
 
 # if defined RTLD_BOOTSTRAP && !USE___THREAD
This page took 0.049172 seconds and 5 git commands to generate.