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_28-branch] PR21132, hppa-linux pie support doesn't work


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

commit 8a3cacb06d6ecfbe3ab0e0059bf6a4eb8b4b9dc6
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Feb 16 12:23:12 2017 +1030

    PR21132, hppa-linux pie support doesn't work
    
    This fixes a long-standing hppa bug seen when generating PIEs, and I
    think possible to trigger with forced local symbols in shared
    libraries.  Not allocating enough space for PLT relocs results in ld
    writing outside of the buffer.
    
    	PR 21132
    	* elf32-hppa.c (allocate_plt_static): Allocate space for relocs
    	if pic.

Diff:
---
 bfd/ChangeLog    | 6 ++++++
 bfd/elf32-hppa.c | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 30161c8..d39283a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-16  Alan Modra  <amodra@gmail.com>
+
+	PR 21132
+	* elf32-hppa.c (allocate_plt_static): Allocate space for relocs
+	if pic.
+
 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/21168
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index de14468..e64ea9a 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -1976,6 +1976,8 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
 	  sec = htab->etab.splt;
 	  eh->plt.offset = sec->size;
 	  sec->size += PLT_ENTRY_SIZE;
+	  if (bfd_link_pic (info))
+	    htab->etab.srelplt->size += sizeof (Elf32_External_Rela);
 	}
       else
 	{


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