Fix seg-fault when running the ld testsuite for the hppa64-linux target.
authorNick Clifton <nickc@redhat.com>
Tue, 27 Oct 2020 16:23:09 +0000 (16:23 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 27 Oct 2020 16:23:09 +0000 (16:23 +0000)
* 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.

bfd/ChangeLog
bfd/elf64-hppa.c

index 931d4455ef53558192bdd5fc5a7365b300be60e1..d93b27bcedefc40f7120214a441f11d10de60f3d 100644 (file)
@@ -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
index bf8207e3a7a53bf2a8cb439a9509614903125b74..50fd5a0deb904770eed14f2de441973e50ff742a 100644 (file)
@@ -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;