[PATCH] bfd/ELF: refine PR binutils/31872 fix
Alan Modra
amodra@gmail.com
Wed Dec 18 02:45:51 GMT 2024
On Tue, Dec 17, 2024 at 11:59:07AM +0100, Jan Beulich wrote:
> 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.
Fail enough.
> --- a/bfd/elfcode.h
> +++ b/bfd/elfcode.h
> @@ -1615,7 +1615,8 @@ elf_slurp_reloc_table_from_section (bfd
> 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)
--
Alan Modra
More information about the Binutils
mailing list