Don't set ELFOSABI_LINUX in dynamic ifunc-using executable.
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 19 Feb 2010 05:07:50 +0000 (05:07 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 19 Feb 2010 05:07:50 +0000 (05:07 +0000)
bfd/

2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>

* elf32-i386.c (elf_i386_add_symbol_hook): Don't set
has_ifunc_symbols if the symbol comes from a shared library.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* elf64-x86-64.c (elf64_x86_64_add_symbol_hook): Likewise.

ld/testsuite/

2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>

* ld-ifunc/ifunc.exp: Expect System V OSABI in dynamic
ifunc-using executable.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf32-ppc.c
bfd/elf32-sparc.c
bfd/elf64-ppc.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-ifunc/ifunc.exp

index a09058aa57f7868a194873870cb657e81b5c5fb2..7ff3959115acd922a1eded31f86db1b5e0bd9515 100644 (file)
@@ -1,3 +1,13 @@
+2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elf32-i386.c (elf_i386_add_symbol_hook): Don't set
+       has_ifunc_symbols if the symbol comes from a shared library.
+       * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
+       * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
+       * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
+       * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_add_symbol_hook): Likewise.
+
 2010-02-19  Alan Modra  <amodra@gmail.com>
 
        * elf.c (_bfd_elf_fixup_group_sections): New function, split out from..
index e2cdbf7c2b9e43ff6bebd67fd5b1b496bfe63b02..6ec2c2e7e21dfe20c19eb5eae54357bea01948aa 100644 (file)
@@ -4620,7 +4620,7 @@ elf_i386_hash_symbol (struct elf_link_hash_entry *h)
    file.  */
 
 static bfd_boolean
-elf_i386_add_symbol_hook (bfd * abfd ATTRIBUTE_UNUSED,
+elf_i386_add_symbol_hook (bfd * abfd,
                          struct bfd_link_info * info ATTRIBUTE_UNUSED,
                          Elf_Internal_Sym * sym,
                          const char ** namep ATTRIBUTE_UNUSED,
@@ -4628,7 +4628,8 @@ elf_i386_add_symbol_hook (bfd * abfd ATTRIBUTE_UNUSED,
                          asection ** secp ATTRIBUTE_UNUSED,
                          bfd_vma * valp ATTRIBUTE_UNUSED)
 {
-  if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+  if ((abfd->flags & DYNAMIC) == 0
+      && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
     elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
 
   return TRUE;
index 36674130e93bd68c1a69e57b79b666fab257790a..6e4cbc1238ebd0a70dfc36a800b04e77776ab2d7 100644 (file)
@@ -3113,7 +3113,8 @@ ppc_elf_add_symbol_hook (bfd *abfd,
       *valp = sym->st_size;
     }
 
-  if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+  if ((abfd->flags & DYNAMIC) == 0
+      && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
     elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
 
   return TRUE;
index ab4f70374cc07375195722d4e28bdc5e4d0955c7..80102e9284f3ccb798dcad702f1e60f011d85023 100644 (file)
@@ -171,7 +171,7 @@ elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela)
    file.  */
 
 static bfd_boolean
-elf32_sparc_add_symbol_hook (bfd * abfd ATTRIBUTE_UNUSED,
+elf32_sparc_add_symbol_hook (bfd * abfd,
                             struct bfd_link_info * info ATTRIBUTE_UNUSED,
                             Elf_Internal_Sym * sym,
                             const char ** namep ATTRIBUTE_UNUSED,
@@ -179,7 +179,8 @@ elf32_sparc_add_symbol_hook (bfd * abfd ATTRIBUTE_UNUSED,
                             asection ** secp ATTRIBUTE_UNUSED,
                             bfd_vma * valp ATTRIBUTE_UNUSED)
 {
-  if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+  if ((abfd->flags & DYNAMIC) == 0
+      && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
     elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
   return TRUE;
 }
index 90d1b9f810cf01e1bc89eae3cb5d0f0bbecfeced..ffd37dd63fd3e9cd5298c84c9f24efaf2c3206d2 100644 (file)
@@ -4557,7 +4557,7 @@ make_fdh (struct bfd_link_info *info,
    function type.  */
 
 static bfd_boolean
-ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
+ppc64_elf_add_symbol_hook (bfd *ibfd,
                           struct bfd_link_info *info,
                           Elf_Internal_Sym *isym,
                           const char **name ATTRIBUTE_UNUSED,
@@ -4566,7 +4566,10 @@ ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED,
                           bfd_vma *value ATTRIBUTE_UNUSED)
 {
   if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
-    elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
+    {
+      if ((ibfd->flags & DYNAMIC) == 0)
+       elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
+    }
   else if (ELF_ST_TYPE (isym->st_info) == STT_FUNC)
     ;
   else if (*sec != NULL
index a1bde20903d5f0749462f2b50dcd9b3f57861c46..5a2fda26840a9c09094bf87403bcb5c046db5a5d 100644 (file)
@@ -424,7 +424,8 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
 {
   static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" };
 
-  if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+  if ((abfd->flags & DYNAMIC) == 0
+      && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
     elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
 
   if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER)
index 9459b9ca06994fdd5e73dd6a799b71e80c246578..373a8da1c0bb237ad6d429fc061d1454ab08d8c8 100644 (file)
@@ -4257,7 +4257,8 @@ elf64_x86_64_add_symbol_hook (bfd *abfd,
       break;
     }
 
-  if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+  if ((abfd->flags & DYNAMIC) == 0
+      && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
     elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
 
   return TRUE;
index e170dfc836c11edbfcd38fb5a5bf3c23d9c8e74c..a4b2100604007f866906bfb3c97a0d05342a8fe5 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld-ifunc/ifunc.exp: Expect System V OSABI in dynamic
+       ifunc-using executable.
+
 2010-02-19  Alan Modra  <amodra@gmail.com>
 
        * ld-elf/group.ld: Discard .dropme sections.
index be519ce456df97508dd7af75028dbcf2ec6a8685..38fe2d39046c437cc042ad1c6c4170d7a3221db5 100644 (file)
@@ -258,8 +258,8 @@ if {! [check_osabi tmpdir/static_prog {UNIX - Linux}]} {
     fail "Static ifunc-using executable does not have an OS/ABI field of LINUX"
     set fails [expr $fails + 1]
 }
-if {! [check_osabi tmpdir/dynamic_prog {UNIX - Linux}]} {
-    fail "Dynamic ifunc-using executable does not have an OS/ABI field of LINUX"
+if {! [check_osabi tmpdir/dynamic_prog {UNIX - System V}]} {
+    fail "Dynamic ifunc-using executable does not have an OS/ABI field of System V"
     set fails [expr $fails + 1]
 }
 if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} {