[PATCH] aarch64: Set pcrel_off for COFF relocations
Jan Beulich
jbeulich@suse.com
Mon Sep 1 07:48:37 GMT 2025
On 30.08.2025 19:17, Mark Harmstone wrote:
> The pcrel_off flag of reloc_howto_type specifies that "the displacement part
> of an instruction [is left] empty", which is the case for ELF and COFF files.
> This wasn't being set in bfd/coff-aarch64.c, with the result that when using
> ld with a linker script, bfd_perform_relocation was writing incorrect
> relocations.
But is this correct for all relocations? I can see it being like this for
ones dealing with instruction fields, yet ones like ADDR64, ADDR32, REL32
etc (dealing with data items) may be different?
Jan
> --- a/bfd/coff-aarch64.c
> +++ b/bfd/coff-aarch64.c
> @@ -244,7 +244,7 @@ coff_aarch64_secrel_reloc (bfd *abfd,
> #define HOWTO_INSTALL_ADDEND 1
> #define HOW(type, right, size, bits, pcrel, left, ovf, func, mask) \
> HOWTO (type, right, size, bits, pcrel, left, complain_overflow_##ovf, \
> - coff_aarch64_##func, #type, true, mask, mask, false)
> + coff_aarch64_##func, #type, true, mask, mask, true)
>
> static const reloc_howto_type arm64_reloc_howto_abs
> = HOW (IMAGE_REL_ARM64_ABSOLUTE,
More information about the Binutils
mailing list