[binutils] Import the fix for PR ld/17827 from FSF mainline. Resolves: BZ #1182511

Nicholas Clifton nickc at fedoraproject.org
Tue Jan 20 17:14:30 UTC 2015


commit 09dade76673691ff771732bcf7eda8dada8e67a2
Author: Nick Clifton <nickc at redhat.com>
Date:   Tue Jan 20 17:14:36 2015 +0000

    Import the fix for PR ld/17827 from FSF mainline.
    Resolves: BZ #1182511

 binutils-2.25-x86_64-pie-relocs.patch |   41 +++++++++++++++++++++++++++++++++
 binutils.spec                         |   10 +++++++-
 2 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/binutils-2.25-x86_64-pie-relocs.patch b/binutils-2.25-x86_64-pie-relocs.patch
new file mode 100644
index 0000000..bc2a403
--- /dev/null
+++ b/binutils-2.25-x86_64-pie-relocs.patch
@@ -0,0 +1,41 @@
+*** binutils-2.25.orig/bfd/elf64-x86-64.c	2015-01-20 16:57:03.416958519 +0000
+--- binutils-2.25/bfd/elf64-x86-64.c	2015-01-20 16:59:10.455588496 +0000
+*************** elf_x86_64_allocate_dynrelocs (struct el
+*** 2677,2689 ****
+  		       && ! bfd_elf_link_record_dynamic_symbol (info, h))
+  		return FALSE;
+  	    }
+! 	  /* For PIE, discard space for relocs against symbols which
+! 	     turn out to need copy relocs.  */
+  	  else if (info->executable
+  		   && (h->needs_copy || eh->needs_copy)
+  		   && h->def_dynamic
+  		   && !h->def_regular)
+! 	    eh->dyn_relocs = NULL;
+  	}
+      }
+    else if (ELIMINATE_COPY_RELOCS)
+--- 2677,2699 ----
+  		       && ! bfd_elf_link_record_dynamic_symbol (info, h))
+  		return FALSE;
+  	    }
+! 	  /* For PIE, discard space for pc-relative relocs against
+! 	     symbols which turn out to need copy relocs.  */
+  	  else if (info->executable
+  		   && (h->needs_copy || eh->needs_copy)
+  		   && h->def_dynamic
+  		   && !h->def_regular)
+! 	    {
+! 	      struct elf_dyn_relocs **pp;
+! 
+! 	      for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+! 		{
+! 		  if (p->pc_count != 0)
+! 		    *pp = p->next;
+! 		  else
+! 		    pp = &p->next;
+! 		}
+! 	    }
+  	}
+      }
+    else if (ELIMINATE_COPY_RELOCS)
diff --git a/binutils.spec b/binutils.spec
index fae4f80..56b1d58 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -19,7 +19,7 @@
 Summary: A GNU collection of binary utilities
 Name: %{?cross}binutils%{?_with_debug:-debug}
 Version: 2.25
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group: Development/Tools
 URL: http://sources.redhat.com/binutils
@@ -52,6 +52,9 @@ Patch12: binutils-2.25-kernel-ld-r.patch
 Patch13: binutils-2.23.2-aarch64-em.patch
 # Fix detections little endian PPC shared libraries
 Patch14: binutils-2.24-ldforcele.patch
+# Fix allocation of space for x86_64 PIE relocs.
+Patch15: binutils-2.25-x86_64-pie-relocs.patch
+
 
 Provides: bundled(libiberty)
 
@@ -172,6 +175,7 @@ using libelf instead of BFD.
 %ifarch ppc64le
 %patch14 -p1 -b .ldforcele~
 %endif
+%patch15 -p1 -b .x86_64-pie~
 
 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
 
@@ -482,6 +486,10 @@ exit 0
 %endif # %{isnative}
 
 %changelog
+* Tue Jan 20 2015 Nick Clifton <nickc at redhat.com> - 2.25-4
+- Import the fix for PR ld/17827 from FSF mainline.
+- Resolves: BZ #1182511
+
 * Mon Jan 12 2015 Nick Clifton <nickc at redhat.com> - 2.25-3
 - Suppress building of GOLD for PPC, for now...
 - Resolves: BZ #1173780


More information about the scm-commits mailing list