aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-12-19 10:39:38 +0100
committerJan Beulich <jbeulich@suse.com>2024-12-19 10:39:38 +0100
commit2c0c13933a6d08ae87c2852b3421ede090499f09 (patch)
tree6be1c674d9bbf2ecc7b51253f05aa7309e2b56bd
parentec6b5cbcffefa23604c2a2549f6aba146c04d28c (diff)
downloadbinutils-2c0c13933a6d08ae87c2852b3421ede090499f09.zip
binutils-2c0c13933a6d08ae87c2852b3421ede090499f09.tar.gz
binutils-2c0c13933a6d08ae87c2852b3421ede090499f09.tar.bz2
bfd/ELF: refine PR binutils/31872 fix
The fix for PR binutils/31872 (commit b20ab53f81db) neglected the case of targets with only RELA support, where nevertheless object files using REL exist. In particular objcopy will create such objects for x86-64 when converting from an i?86 ELF object (this by itself probably isn't quite right, but we ought to cope with what our own tools are doing). Restore the fallback to the RELA lookup, just without re-introducing the blind NULL de-ref that was there before.
-rw-r--r--bfd/elfcode.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index baf38fe..72af344 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1615,7 +1615,8 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
relent->addend = rela.r_addend;
res = false;
- if (entsize == sizeof (Elf_External_Rela)
+ if ((entsize == sizeof (Elf_External_Rela)
+ || ebd->elf_info_to_howto_rel == NULL)
&& ebd->elf_info_to_howto != NULL)
res = ebd->elf_info_to_howto (abfd, relent, &rela);
else if (ebd->elf_info_to_howto_rel != NULL)