Do not set ELFOSABI_LINUX on binaries which just link to IFUNC using DSOs.

(BZ 568941)
This commit is contained in:
Nicholas Clifton 2010-03-04 13:18:00 +00:00
parent 3f8308f3dc
commit 7272e92f0a
2 changed files with 145 additions and 1 deletions

View File

@ -0,0 +1,139 @@
diff -rcp ../binutils-2.20.51.0.2.copy-patched/bfd/ChangeLog bfd/ChangeLog
*** ../binutils-2.20.51.0.2.copy-patched/bfd/ChangeLog 2010-03-04 09:15:22.000000000 +0000
--- bfd/ChangeLog 2010-03-04 10:37:24.000000000 +0000
***************
*** 1,3 ****
--- 1,11 ----
+ 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.
+
2009-12-17 Alan Modra <amodra@bigpond.net.au>
PR ld/11088
diff -rcp ../binutils-2.20.51.0.2.copy-patched/bfd/elf32-i386.c bfd/elf32-i386.c
*** ../binutils-2.20.51.0.2.copy-patched/bfd/elf32-i386.c 2010-03-04 09:15:19.000000000 +0000
--- bfd/elf32-i386.c 2010-03-04 10:37:39.000000000 +0000
*************** elf_i386_add_symbol_hook (bfd * abfd ATT
*** 4613,4619 ****
asection ** secp ATTRIBUTE_UNUSED,
bfd_vma * valp ATTRIBUTE_UNUSED)
{
! if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
return _bfd_elf_add_sharable_symbol (abfd, info, sym, namep, flagsp,
--- 4613,4620 ----
asection ** secp ATTRIBUTE_UNUSED,
bfd_vma * valp ATTRIBUTE_UNUSED)
{
! if ((abfd->flags & DYNAMIC) == 0
! && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
return _bfd_elf_add_sharable_symbol (abfd, info, sym, namep, flagsp,
diff -rcp ../binutils-2.20.51.0.2.copy-patched/bfd/elf32-ppc.c bfd/elf32-ppc.c
*** ../binutils-2.20.51.0.2.copy-patched/bfd/elf32-ppc.c 2010-03-04 09:15:20.000000000 +0000
--- bfd/elf32-ppc.c 2010-03-04 10:38:02.000000000 +0000
*************** ppc_elf_add_symbol_hook (bfd *abfd,
*** 3133,3139 ****
*valp = sym->st_size;
}
! if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
return TRUE;
--- 3133,3140 ----
*valp = sym->st_size;
}
! 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 -rcp ../binutils-2.20.51.0.2.copy-patched/bfd/elf64-ppc.c bfd/elf64-ppc.c
*** ../binutils-2.20.51.0.2.copy-patched/bfd/elf64-ppc.c 2010-03-04 09:15:20.000000000 +0000
--- bfd/elf64-ppc.c 2010-03-04 10:38:32.000000000 +0000
*************** ppc64_elf_add_symbol_hook (bfd *ibfd ATT
*** 4531,4537 ****
bfd_vma *value ATTRIBUTE_UNUSED)
{
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
! elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
else if (ELF_ST_TYPE (isym->st_info) == STT_FUNC)
;
else if (*sec != NULL
--- 4531,4540 ----
bfd_vma *value ATTRIBUTE_UNUSED)
{
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
! {
! 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 -rcp ../binutils-2.20.51.0.2.copy-patched/bfd/elf64-x86-64.c bfd/elf64-x86-64.c
*** ../binutils-2.20.51.0.2.copy-patched/bfd/elf64-x86-64.c 2010-03-04 09:15:21.000000000 +0000
--- bfd/elf64-x86-64.c 2010-03-04 10:38:50.000000000 +0000
*************** elf64_x86_64_add_symbol_hook (bfd *abfd,
*** 4242,4248 ****
return TRUE;
}
! if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
return _bfd_elf_add_sharable_symbol (abfd, info, sym, namep, flagsp,
--- 4242,4249 ----
return TRUE;
}
! if ((abfd->flags & DYNAMIC) == 0
! && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
elf_tdata (info->output_bfd)->has_ifunc_symbols = TRUE;
return _bfd_elf_add_sharable_symbol (abfd, info, sym, namep, flagsp,
diff -rcp ../binutils-2.20.51.0.2.copy-patched/ld/testsuite/ChangeLog ld/testsuite/ChangeLog
*** ../binutils-2.20.51.0.2.copy-patched/ld/testsuite/ChangeLog 2010-03-04 09:16:17.000000000 +0000
--- ld/testsuite/ChangeLog 2010-03-04 11:43:29.000000000 +0000
***************
*** 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.
+
2009-10-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10749
diff -rcp ../binutils-2.20.51.0.2.copy-patched/ld/testsuite/ld-ifunc/ifunc.exp ld/testsuite/ld-ifunc/ifunc.exp
*** ../binutils-2.20.51.0.2.copy-patched/ld/testsuite/ld-ifunc/ifunc.exp 2010-03-04 09:16:08.000000000 +0000
--- ld/testsuite/ld-ifunc/ifunc.exp 2010-03-04 11:44:15.000000000 +0000
*************** if {! [check_osabi tmpdir/static_prog {U
*** 257,264 ****
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"
set fails [expr $fails + 1]
}
if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} {
--- 257,264 ----
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 - 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}]} {

View File

@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.20.51.0.2
Release: 16%{?dist}
Release: 17%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -38,6 +38,7 @@ Patch12: binutils-2.20.51.0.2-gas-expr.patch
Patch13: binutils-2.20.51.0.2-ppc-hidden-plt-relocs.patch
Patch14: binutils-2.20.51.0.2-x86-hash-table.patch
Patch15: binutils-2.20.51.0.2-copy-osabi.patch
Patch16: binutils-2.20.51.0.2-do-not-set-ifunc.patch
%define gold_arches %ix86 x86_64
@ -145,6 +146,7 @@ libelf instead of BFD.
%patch13 -p0 -b .hidden-plt~
%patch14 -p0 -b .hash-table~
%patch15 -p0 -b .copy-osabi~
%patch16 -p0 -b .no-ifunc~
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -447,6 +449,9 @@ exit 0
%endif # %{isnative}
%changelog
* Thu Mar 4 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.2-17
- Do not set ELFOSABI_LINUX on binaries which just link to IFUNC using DSOs. (BZ 568941)
* Tue Mar 2 2010 Nick Clifton <nickc@redhat.com> - 2.20.51.0.2-16
- Copy the OSABI field in ELF headers, if set. (BZ 568921)