aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2023-12-15 21:02:32 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2023-12-15 21:02:32 +0000
commitfc4ddd6734e522debe7e99812b743b368f1cc946 (patch)
tree579389b25f157bb7726fd82662c53042289bdda4 /bfd
parentc5a473d789d815c8f03f3ef9fc6df5ccfc40a468 (diff)
downloadgdb-fc4ddd6734e522debe7e99812b743b368f1cc946.zip
gdb-fc4ddd6734e522debe7e99812b743b368f1cc946.tar.gz
gdb-fc4ddd6734e522debe7e99812b743b368f1cc946.tar.bz2
Fix segmentation fault in bfd/elf32-hppa.c
2023-12-15 John David Anglin <danglin@gcc.gnu.org> PR ld/31148 bfd/ChangeLog: * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Output relative reloc only when eh->root.type is bfd_link_hash_defined or bfd_link_hash_defweak.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-hppa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 44129c8..d64ca75 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -4216,7 +4216,9 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
file, we just want to emit a RELATIVE reloc. The entry
in the global offset table will already have been
initialized in the relocate_section function. */
- if (!is_dyn)
+ if (!is_dyn
+ && (eh->root.type == bfd_link_hash_defined
+ || eh->root.type == bfd_link_hash_defweak))
{
rela.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
rela.r_addend = (eh->root.u.def.value