[binutils-gdb] Fix seg-fault when running the ld testsuite for the hppa64-linux target.

Nick Clifton nickc@sourceware.org
Tue Oct 27 16:23:45 GMT 2020


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

commit 27e5e547c7e30e9d78dd27662d7a8dc1373833cf
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Oct 27 16:23:09 2020 +0000

    Fix seg-fault when running the ld testsuite for the hppa64-linux target.
    
            * elf64-hppa.c (elf_hppa_final_link_relocate): Check that the
            symbol's section is being output before adding its offset to the
            addend when processing R_PARISC_SECREL32.

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

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 931d4455ef5..d93b27bcede 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-10-27  Nick Clifton  <nickc@redhat.com>
+
+	* elf64-hppa.c (elf_hppa_final_link_relocate): Check that the
+	symbol's section is being output before adding its offset to the
+	addend when processing R_PARISC_SECREL32.
+
 2020-10-25  Alan Modra  <amodra@gmail.com>
 
 	* vms-misc.c (_bfd_vms_save_counted_string): Count length byte
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index bf8207e3a7a..50fd5a0deb9 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -3689,7 +3689,7 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
       }
 
     case R_PARISC_SECREL32:
-      if (sym_sec)
+      if (sym_sec && sym_sec->output_section)
 	value -= sym_sec->output_section->vma;
       bfd_put_32 (input_bfd, value + addend, hit_data);
       return bfd_reloc_ok;


More information about the Binutils-cvs mailing list