diff --git a/binutils-2.23.52.0.1-check-regular-ifunc-refs.patch b/binutils-2.23.52.0.1-check-regular-ifunc-refs.patch new file mode 100644 index 0000000..c9bfd64 --- /dev/null +++ b/binutils-2.23.52.0.1-check-regular-ifunc-refs.patch @@ -0,0 +1,48 @@ +*** ../binutils-2.23.52.0.1.orig/bfd/elf-ifunc.c 2013-04-17 15:53:49.662586029 +0100 +--- bfd/elf-ifunc.c 2013-04-17 15:55:55.269589511 +0100 +*************** _bfd_elf_allocate_ifunc_dyn_relocs (stru +*** 187,209 **** + + htab = elf_hash_table (info); + + /* Support garbage collection against STT_GNU_IFUNC symbols. */ + if (h->plt.refcount <= 0 && h->got.refcount <= 0) + { +- /* When building shared library, we need to handle the case +- where it is marked with regular reference, but not non-GOT +- reference. It may happen if we didn't see STT_GNU_IFUNC +- symbol at the time when checking relocations. */ +- if (info->shared +- && !h->non_got_ref +- && h->ref_regular) +- for (p = *head; p != NULL; p = p->next) +- if (p->count) +- { +- h->non_got_ref = 1; +- goto keep; +- } +- + h->got = htab->init_got_offset; + h->plt = htab->init_plt_offset; + *head = NULL; +--- 187,206 ---- + + htab = elf_hash_table (info); + ++ /* When building a shared library, we need to handle the case where it is ++ marked with a regular reference, but not a non-GOT reference since the ++ non-GOT reference bit may not be set here. */ ++ if (info->shared && !h->non_got_ref && h->ref_regular) ++ for (p = *head; p != NULL; p = p->next) ++ if (p->count) ++ { ++ h->non_got_ref = 1; ++ goto keep; ++ } ++ + /* Support garbage collection against STT_GNU_IFUNC symbols. */ + if (h->plt.refcount <= 0 && h->got.refcount <= 0) + { + h->got = htab->init_got_offset; + h->plt = htab->init_plt_offset; + *head = NULL; diff --git a/binutils.spec b/binutils.spec index 8a03f72..f1e0d65 100644 --- a/binutils.spec +++ b/binutils.spec @@ -17,7 +17,7 @@ Summary: A GNU collection of binary utilities Name: %{?cross}binutils%{?_with_debug:-debug} Version: 2.23.52.0.1 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv3+ Group: Development/Tools URL: http://sources.redhat.com/binutils @@ -48,6 +48,8 @@ Patch12: binutils-2.23.52.0.1-as-doc-texinfo-fixes.patch Patch13: binutils-2.23.52.0.1-revert-pr15149.patch # Fix addr2line to use the dynamic symbol table if it could not find any ordinary symbols. Patch14: binutils-2.23.52.0.1-addr2line-dynsymtab.patch +# Check regular references without non-GOT references when building shared libraries. +Patch15: binutils-2.23.52.0.1-check-regular-ifunc-refs.patch Provides: bundled(libiberty) @@ -160,6 +162,7 @@ using libelf instead of BFD. %patch12 -p0 -b .gas-texinfo~ %patch13 -p0 -b .revert-pr15149~ %patch14 -p0 -b .addr2line~ +%patch15 -p0 -b .check-ifunc~ # We cannot run autotools as there is an exact requirement of autoconf-2.59. @@ -459,6 +462,9 @@ exit 0 %endif # %{isnative} %changelog +* Wed Apr 17 2013 Nick Clifton - 2.23.52.0.1-10 +- Import patch for FSF mainline PR 15371 to fix ifunc references in shared libraries. (#927818) + * Thu Mar 14 2013 Nick Clifton - 2.23.52.0.1-9 - Enhance opncls.c:find_separate_debug_file() to look in Fedora specific locations. - Enhance dwarf2.c:find_line() to work with shared libraries. (#920542)