This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1 of 2] binutils: Don't set ELFOSABI_LINUX in dynamic ifunc-using executable


# HG changeset patch
# User Bryan Hundven <bryanhundven@gmail.com>
# Date 1288720549 25200
# Node ID b1b5b68423aad334d11a988f625601992ed72577
# Parent  c2541d3f2f56d732d01e29bf6d52f9680e102afe
binutils: Don't set ELFOSABI_LINUX in dynamic ifunc-using executable

Description from initial patch email:

We convert undefined IFUNC symbols into normal FUNC symbols. We shouldn't
set ELFOSABI_LINUX when we see an IFUNC symbol from shared library.

diff -r c2541d3f2f56 -r b1b5b68423aa patches/binutils/2.20.1/310-no-infunc-symbols-from-shlib.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/binutils/2.20.1/310-no-infunc-symbols-from-shlib.patch	Tue Nov 02 10:55:49 2010 -0700
@@ -0,0 +1,111 @@
+Description: Don't set has_ifunc_symbols if the symbol comes from
+a shared library (http://sourceware.org/ml/binutils/2010-02/msg00369.html).
+
+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.
+	* elf64-ppc.c (ppc64_elf_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.
+
+diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
+index e2cdbf7..6ec2c2e 100644
+--- a/bfd/elf32-i386.c
++++ b/bfd/elf32-i386.c
+@@ -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;
+diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
+index 3667413..6e4cbc1 100644
+--- a/bfd/elf32-ppc.c
++++ b/bfd/elf32-ppc.c
+@@ -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;
+diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
+index 90d1b9f..ffd37dd 100644
+--- a/bfd/elf64-ppc.c
++++ b/bfd/elf64-ppc.c
+@@ -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
+diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
+index 9459b9c..373a8da 100644
+--- a/bfd/elf64-x86-64.c
++++ b/bfd/elf64-x86-64.c
+@@ -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;
+diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp
+index be519ce..38fe2d3 100644
+--- a/ld/testsuite/ld-ifunc/ifunc.exp
++++ b/ld/testsuite/ld-ifunc/ifunc.exp
+@@ -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}]} {

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]