[binutils/f19] Import patch for FSF mainline PR 15371 to fix ifunc references in shared libraries. Partially resolv

Nicholas Clifton nickc at fedoraproject.org
Wed Apr 17 15:23:50 UTC 2013


commit 7e18cbed6e598b39141c15c8a69111bfd3b91a09
Author: Nick Clifton <nickc at redhat.com>
Date:   Wed Apr 17 16:18:04 2013 +0100

    Import patch for FSF mainline PR 15371 to fix ifunc references in shared libraries.
    Partially resolves: #927818

 ...tils-2.23.52.0.1-check-regular-ifunc-refs.patch |   48 ++++++++++++++++++++
 binutils.spec                                      |    9 +++-
 2 files changed, 56 insertions(+), 1 deletions(-)
---
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 42399a5..6690fd4 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: 7%{?dist}
+Release: 8%{?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 search paths for 64-bit linux aarch64 targets.
 Patch14: binutils-2.23.52.0.1-aarch64-lib64.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)
 
@@ -159,6 +161,8 @@ using libelf instead of BFD.
 %patch11 -p0 -b .64bit-thin-archives~
 %patch12 -p0 -b .gas-texinfo~
 %patch13 -p0 -b .revert-pr15149~
+%patch14 -p0 -b .aarch64-lib64~
+%patch15 -p0 -b .check-ifunc~
 
 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
 
@@ -458,6 +462,9 @@ exit 0
 %endif # %{isnative}
 
 %changelog
+* Wed Apr 17 2013 Nick Clifton <nickc at redhat.com> - 2.23.52.0.1-8
+- Import patch for FSF mainline PR 15371 to fix ifunc references in shared libraries.  (#927818)
+
 * Tue Apr 09 2013 Nick Clifton <nickc at redhat.com> - 2.23.52.0.1-7
 - Fix library search paths for 64-bit aarch64 linux targets.  (#950098)
 


More information about the scm-commits mailing list