[binutils-gdb] PR22537, Segmentation fault with static PIE

Alan Modra amodra@sourceware.org
Thu Apr 19 05:53:00 GMT 2018


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

commit f6a8b8c7ac2d5369070a6b76a94ee0f3052433ff
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Apr 19 14:13:41 2018 +0930

    PR22537, Segmentation fault with static PIE
    
    The only stub type that makes sense for undefined symbols, or those
    defined in shared libraries, is a plt call stub.  This patch arranges
    to have "destination" set to -1 on such symbols, making for an easy
    test in hppa_type_of_stub.
    
    	PR 22537
    	* elf32-hppa.c (elf32_hppa_size_stubs): Init "destination" to -1.
    	(hppa_type_of_stub): Don't return a long branch stub for
    	symbols other than those defined statically.

Diff:
---
 bfd/ChangeLog    | 7 +++++++
 bfd/elf32-hppa.c | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2d89641..d92c334 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
 2018-04-19  Alan Modra  <amodra@gmail.com>
 
+	PR 22537
+	* elf32-hppa.c (elf32_hppa_size_stubs): Init "destination" to -1.
+	(hppa_type_of_stub): Don't return a long branch stub for
+	symbols other than those defined statically.
+
+2018-04-19  Alan Modra  <amodra@gmail.com>
+
 	* Makefile.am: Revert 2018-04-18 coff-mips changes.
 	* config.bfd: Add back mips_ecoff_le_vec and mips_ecoff_be_vec
 	to selvecs for mips targets change 2018-04-18.
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 3ce3807..44fb753 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -612,6 +612,9 @@ hppa_type_of_stub (asection *input_sec,
       return hppa_stub_import;
     }
 
+  if (destination == (bfd_vma) -1)
+    return hppa_stub_none;
+
   /* Determine where the call point is.  */
   location = (input_sec->output_offset
 	      + input_sec->output_section->vma
@@ -2843,7 +2846,7 @@ elf32_hppa_size_stubs
 		     section.  */
 		  sym_sec = NULL;
 		  sym_value = 0;
-		  destination = 0;
+		  destination = -1;
 		  hh = NULL;
 		  if (r_indx < symtab_hdr->sh_info)
 		    {



More information about the Binutils-cvs mailing list