[binutils/f18] - Correctly handle PLTOFF relocs for s390 IFUNCs.

Jeffrey Law law at fedoraproject.org
Tue Sep 4 16:50:41 UTC 2012


commit 4b9a078401fce9169f4ab3c5334d3f6f43e0d768
Author: Jeff Law <law at redhat.com>
Date:   Tue Sep 4 10:49:01 2012 -0600

    - Correctly handle PLTOFF relocs for s390 IFUNCs.

 binutils-rh805974.patch |  121 +++++++++++++++++++++++++++++++++++++++++++++++
 binutils.spec           |    8 +++-
 2 files changed, 128 insertions(+), 1 deletions(-)
---
diff --git a/binutils-rh805974.patch b/binutils-rh805974.patch
new file mode 100644
index 0000000..bfbb160
--- /dev/null
+++ b/binutils-rh805974.patch
@@ -0,0 +1,121 @@
+From binutils-return-76960-listarch-binutils=sources dot redhat dot com at sourceware dot org Mon Sep 03 12:05:02 2012
+Return-Path: <binutils-return-76960-listarch-binutils=sources dot redhat dot com at sourceware dot org>
+Delivered-To: listarch-binutils at sources dot redhat dot com
+Received: (qmail 24023 invoked by alias); 3 Sep 2012 12:05:00 -0000
+Received: (qmail 24010 invoked by uid 22791); 3 Sep 2012 12:05:00 -0000
+X-SWARE-Spam-Status: No, hits=-3.6 required=5.0	tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD
+X-Spam-Check-By: sourceware.org
+Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111)    by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 03 Sep 2012 12:04:46 +0000
+Received: from /spool/local	by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted	for <binutils at sourceware.org> from <andreas at de.ibm.com>;	Mon, 3 Sep 2012 13:04:44 +0100
+Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198)	by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted;	Mon, 3 Sep 2012 13:04:41 +0100
+Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250])	by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q83C4YZx40435740	for <binutils at sourceware.org>; Mon, 3 Sep 2012 12:04:34 GMT
+Received: from d06av09.portsmouth.uk.ibm.com (loopback [127.0.0.1])	by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q83C4eFA012810	for <binutils at sourceware.org>; Mon, 3 Sep 2012 06:04:40 -0600
+Received: from bart (dyn-9-152-212-238.boeblingen.de.ibm.com [9.152.212.238])	by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q83C4dDC012768	for <binutils at sourceware.org>; Mon, 3 Sep 2012 06:04:39 -0600
+Received: by bart (sSMTP sendmail emulation); Mon, 03 Sep 2012 14:04:39 +0200
+From: "Andreas Krebbel" <andreas at de dot ibm dot com>
+Date: Mon, 3 Sep 2012 14:04:39 +0200
+To: binutils at sourceware dot org
+Subject: [Committed] S/390: Handle PLTOFF for IFUNC symbols correctly
+Message-ID: <20120903120439.GA10593 at bart>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+User-Agent: Mutt/1.5.21 (2010-09-15)
+x-cbid: 12090312-0342-0000-0000-000002BC4237
+Mailing-List: contact binutils-help at sourceware dot org; run by ezmlm
+Precedence: bulk
+List-Id: <binutils.sourceware.org>
+List-Subscribe: <mailto:binutils-subscribe at sourceware dot org>
+List-Archive: <http://sourceware.org/ml/binutils/>
+List-Post: <mailto:binutils at sourceware dot org>
+List-Help: <mailto:binutils-help at sourceware dot org>, <http://sourceware dot org/ml/#faqs>
+Sender: binutils-owner at sourceware dot org
+Delivered-To: mailing list binutils at sourceware dot org
+
+Hi,
+
+the s390 IFUNC support so far didn't deal correctly with PLTOFF
+relocs.  Fixed with the attached patch.
+
+Committed.
+
+Bye,
+
+-Andreas-
+
+2012-09-03  Andreas Krebbel  <Andreas.Krebbel at de.ibm.com>
+
+	* elf32-s390.c (elf_s390_relocate_section): Handle PLTOFF for
+	local and global ifunc symbols.
+	* elf64-s390.c (elf_s390_relocate_section): Likewise.
+
+---
+ bfd/elf32-s390.c |    8 ++++++--
+ bfd/elf64-s390.c |   11 ++++++++---
+ 2 files changed, 14 insertions(+), 5 deletions(-)
+
+Index: binutils/bfd/elf32-s390.c
+===================================================================
+--- binutils.orig/bfd/elf32-s390.c
++++ binutils/bfd/elf32-s390.c
+@@ -2349,6 +2349,10 @@ elf_s390_relocate_section (bfd *output_b
+ 
+ 	      switch (r_type)
+ 		{
++		case R_390_PLTOFF16:
++		case R_390_PLTOFF32:
++		  relocation -= htab->elf.sgot->output_section->vma;
++		  break;
+ 		case R_390_GOTPLT12:
+ 		case R_390_GOTPLT16:
+ 		case R_390_GOTPLT20:
+@@ -2625,9 +2629,9 @@ elf_s390_relocate_section (bfd *output_b
+ 
+ 	  /* For local symbols or if we didn't make a PLT entry for
+ 	     this symbol resolve the symbol directly.  */
+-	  if (   h == NULL
++	  if (h == NULL
+ 	      || h->plt.offset == (bfd_vma) -1
+-	      || htab->elf.splt == NULL)
++	      || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
+ 	    {
+ 	      relocation -= htab->elf.sgot->output_section->vma;
+ 	      break;
+Index: binutils/bfd/elf64-s390.c
+===================================================================
+--- binutils.orig/bfd/elf64-s390.c
++++ binutils/bfd/elf64-s390.c
+@@ -2306,6 +2306,11 @@ elf_s390_relocate_section (bfd *output_b
+ 
+ 	      switch (r_type)
+ 		{
++		case R_390_PLTOFF16:
++		case R_390_PLTOFF32:
++		case R_390_PLTOFF64:
++		  relocation -= htab->elf.sgot->output_section->vma;
++		  break;
+ 		case R_390_GOTPLT12:
+ 		case R_390_GOTPLT16:
+ 		case R_390_GOTPLT20:
+@@ -2561,7 +2566,7 @@ elf_s390_relocate_section (bfd *output_b
+ 	    break;
+ 
+ 	  if (h->plt.offset == (bfd_vma) -1
+-	      || (htab->elf.splt == NULL && htab->elf.iplt == NULL))
++	      || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
+ 	    {
+ 	      /* We didn't make a PLT entry for this symbol.  This
+ 		 happens when statically linking PIC code, or when
+@@ -2587,9 +2592,9 @@ elf_s390_relocate_section (bfd *output_b
+ 
+ 	  /* For local symbols or if we didn't make a PLT entry for
+ 	     this symbol resolve the symbol directly.  */
+-	  if (   h == NULL
++	  if (h == NULL
+ 	      || h->plt.offset == (bfd_vma) -1
+-	      || htab->elf.splt == NULL)
++	      || (htab->elf.splt == NULL && !s390_is_ifunc_symbol_p (h)))
+ 	    {
+ 	      relocation -= htab->elf.sgot->output_section->vma;
+ 	      break;
+
diff --git a/binutils.spec b/binutils.spec
index dc57c00..5621f08 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.51.0.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group: Development/Tools
 URL: http://sources.redhat.com/binutils
@@ -42,6 +42,8 @@ Patch09: binutils-2.22.52.0.1-export-demangle.h.patch
 Patch10: binutils-2.22.52.0.4-no-config-h-check.patch
 # Make GOLD honour the KEEP directive in linker scripts.
 Patch11: binutils-2.23.51.0.1-gold-keep.patch
+# Bugfix for s390[x] IFUNC support
+Patch12: binutils-rh805974.patch
 
 %define gold_arches %ix86 x86_64
 
@@ -146,6 +148,7 @@ using libelf instead of BFD.
 %patch09 -p0 -b .export-demangle-h~
 %patch10 -p0 -b .no-config-h-check~
 %patch11 -p0 -b .gold-keep~
+%patch12 -p1 
 
 # We cannot run autotools as there is an exact requirement of autoconf-2.59.
 
@@ -444,6 +447,9 @@ exit 0
 %endif # %{isnative}
 
 %changelog
+* Tue Sep 4 2012 Jeff Law <law at redhat.com> 2.23.51.0.1-4
+- Correctly handle PLTOFF relocs for s390 IFUNCs.
+
 * Tue Aug 14 2012 Karsten Hopp <karsten at redhat.com> 2.23.51.0.1-3
 - apply F17 commit cd2fda5 to honour {powerpc64} macro (#834651)
 


More information about the scm-commits mailing list