aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-06-11 09:22:49 +0930
committerAlan Modra <amodra@gmail.com>2024-06-11 12:43:06 +0930
commitb20ab53f81db7eefa0db00d14f06c04527ac324c (patch)
treec073fbf3e8f6ef93df1409450c6a416c8d5f0e14 /bfd
parent39071d57ab2048685663092750755b1154d23a8c (diff)
downloadgdb-b20ab53f81db7eefa0db00d14f06c04527ac324c.zip
gdb-b20ab53f81db7eefa0db00d14f06c04527ac324c.tar.gz
gdb-b20ab53f81db7eefa0db00d14f06c04527ac324c.tar.bz2
PR31872, Segfault in objdump (elf_slurp_reloc_table_from_section)
This one was triggered by trying to dump an AMDGPU object. elf64-amdgcn.c lacks support for objdump relocation handling. PR 31872 * elfcode.h (elf_slurp_reloc_table_from_section): Don't segfault on NULL elf_info_to_howto_rel.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elfcode.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 39dfe0b..3dcba4c 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1614,11 +1614,11 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
relent->addend = rela.r_addend;
- if ((entsize == sizeof (Elf_External_Rela)
- && ebd->elf_info_to_howto != NULL)
- || ebd->elf_info_to_howto_rel == NULL)
+ res = false;
+ if (entsize == sizeof (Elf_External_Rela)
+ && ebd->elf_info_to_howto != NULL)
res = ebd->elf_info_to_howto (abfd, relent, &rela);
- else
+ else if (ebd->elf_info_to_howto_rel != NULL)
res = ebd->elf_info_to_howto_rel (abfd, relent, &rela);
if (! res || relent->howto == NULL)