This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] S/390: Handle PLTOFF for IFUNC symbols correctly


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@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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]