This is the mail archive of the binutils-cvs@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]

[binutils-gdb/binutils-2_26-branch] [S/390] Add null ptr check + port GOTOFF handling from 32 bit over to 64 bit


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d4f21e61d99593f0a81ec12f484fd706d13ba65d

commit d4f21e61d99593f0a81ec12f484fd706d13ba65d
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date:   Thu Nov 19 11:10:06 2015 +0100

    [S/390] Add null ptr check + port GOTOFF handling from 32 bit over to 64 bit
    
    bfd/ChangeLog:
    
    	PR ld/19263
    	* elf32-s390.c (elf_s390_gc_sweep_hook): Add null ptr check.
    	* elf64-s390.c (elf_s390_check_relocs): Port the GOTOFF handling
    	over from the 32 bit code.
    	(elf_s390_relocate_section): Likewise.

Diff:
---
 bfd/ChangeLog    | 11 +++++++++++
 bfd/elf32-s390.c |  2 +-
 bfd/elf64-s390.c | 26 +++++++++++++++++++++++---
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1b8cce7..f6ff2e5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,14 @@
+2015-12-11  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+	Apply from master.
+	2015-11-19  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+	PR ld/19263
+	* elf32-s390.c (elf_s390_gc_sweep_hook): Add null ptr check.
+	* elf64-s390.c (elf_s390_check_relocs): Port the GOTOFF handling
+	over from the 32 bit code.
+	(elf_s390_relocate_section): Likewise.
+
 2015-12-10  Alan Modra  <amodra@gmail.com>
 
 	Apply from master.
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 3fad6b3..8a83005 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1531,7 +1531,7 @@ elf_s390_gc_sweep_hook (bfd *abfd,
 
 	case R_390_GOTOFF16:
 	case R_390_GOTOFF32:
-	  if (s390_is_ifunc_symbol_p (h) && h->def_regular)
+	  if (h != NULL && s390_is_ifunc_symbol_p (h) && h->def_regular)
 	    {
 	      h->plt.refcount--;
 	      break;
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index bd9c082..06f0d88 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -1040,9 +1040,6 @@ elf_s390_check_relocs (bfd *abfd,
 
       switch (r_type)
 	{
-	case R_390_GOTOFF16:
-	case R_390_GOTOFF32:
-	case R_390_GOTOFF64:
 	case R_390_GOTPC:
 	case R_390_GOTPCDBL:
 	  /* These relocs do not need a GOT slot.  They just load the
@@ -1050,6 +1047,11 @@ elf_s390_check_relocs (bfd *abfd,
 	     the GOT.  Since the GOT pointer has been set up above we
 	     are done.  */
 	  break;
+	case R_390_GOTOFF16:
+	case R_390_GOTOFF32:
+	case R_390_GOTOFF64:
+	  if (h == NULL || !s390_is_ifunc_symbol_p (h) || !h->def_regular)
+	    break;
 
 	case R_390_PLT12DBL:
 	case R_390_PLT16DBL:
@@ -1465,6 +1467,12 @@ elf_s390_gc_sweep_hook (bfd *abfd,
 	case R_390_GOTOFF16:
 	case R_390_GOTOFF32:
 	case R_390_GOTOFF64:
+	  if (h != NULL && s390_is_ifunc_symbol_p (h) && h->def_regular)
+	    {
+	      h->plt.refcount--;
+	      break;
+	    }
+
 	case R_390_GOTPC:
 	case R_390_GOTPCDBL:
 	  break;
@@ -2641,6 +2649,18 @@ elf_s390_relocate_section (bfd *output_bfd,
 	  /* Relocation is relative to the start of the global offset
 	     table.  */
 
+	  if (h != NULL
+	      && s390_is_ifunc_symbol_p (h)
+	      && h->def_regular
+	      && !bfd_link_executable (info))
+	    {
+	      relocation = (htab->elf.iplt->output_section->vma
+			    + htab->elf.iplt->output_offset
+			    + h->plt.offset
+			    - htab->elf.sgot->output_section->vma);
+	      goto do_relocation;
+	    }
+
 	  /* Note that sgot->output_offset is not involved in this
 	     calculation.  We always want the start of .got.  If we
 	     defined _GLOBAL_OFFSET_TABLE in a different way, as is


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