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] bfd/s390: Fix DT_PLTRELSZ in presence of R_390_IRELATIVE.


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

commit f92339b8f316de65add11aeb9cd8ea72630aa556
Author: Marcin KoÅ?cielnicki <koriakin@0x04.net>
Date:   Wed Jun 8 14:01:31 2016 +0200

    bfd/s390: Fix DT_PLTRELSZ in presence of R_390_IRELATIVE.
    
    This was broken by 4ade44b727ee77adaa9c22719935d012e253a5e6,
    which changed the calculation to use the .rela.plt linker section
    instead of its output section - thus skipping .rela.iplt .
    Fix the calculations to include it.
    
    bfd/ChangeLog:
    
    	* elf32-s390.c (elf_s390_finish_dynamic_sections): Include
    	.rela.iplt in DT_PLTRELSZ.
    	* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise,
    	for DT_PLTRELSZ and DT_RELASZ as well.

Diff:
---
 bfd/ChangeLog    | 7 +++++++
 bfd/elf32-s390.c | 3 +--
 bfd/elf64-s390.c | 6 ++----
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ad9e027..09150db 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-16  Marcin KoÅ?cielnicki  <koriakin@0x04.net>
+
+	* elf32-s390.c (elf_s390_finish_dynamic_sections): Include
+	.rela.iplt in DT_PLTRELSZ.
+	* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise,
+	for DT_PLTRELSZ and DT_RELASZ as well.
+
 2016-06-16  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf32-i386.c (elf_i386_check_relocs): Skip relocations in
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 9480f72..1f058d2 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3958,8 +3958,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
 	      break;
 
 	    case DT_PLTRELSZ:
-	      s = htab->elf.srelplt;
-	      dyn.d_un.d_val = s->size;
+	      dyn.d_un.d_val = htab->elf.srelplt->size + htab->elf.irelplt->size;
 	      break;
 	    }
 
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index cf174f8..a39e1c9 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3754,8 +3754,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
 	      break;
 
 	    case DT_PLTRELSZ:
-	      s = htab->elf.srelplt;
-	      dyn.d_un.d_val = s->size;
+	      dyn.d_un.d_val = htab->elf.srelplt->size + htab->elf.irelplt->size;
 	      break;
 
 	    case DT_RELASZ:
@@ -3766,8 +3765,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
 		 linker script arranges for .rela.plt to follow all
 		 other relocation sections, we don't have to worry
 		 about changing the DT_RELA entry.  */
-	      s = htab->elf.srelplt;
-	      dyn.d_un.d_val -= s->size;
+	      dyn.d_un.d_val -= htab->elf.srelplt->size + htab->elf.irelplt->size;
 	      break;
 	    }


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