]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
aarch64: Add new relocations and limit COFF AArch64 relocation offsets
authorZac Walker <zacwalker@microsoft.com>
Wed, 31 Jan 2024 19:15:48 +0000 (20:15 +0100)
committerChristophe Lyon <christophe.lyon@linaro.org>
Mon, 19 Feb 2024 13:02:00 +0000 (13:02 +0000)
commitf87eaf8ff3995a5888c6dc4996a20c770e6bcd36
treecdbae78664071dc1196fae6d6c9ed62f0db99619
parent046a94c18c543793ab4a8f3f9b2cb0d1280e7b41
aarch64: Add new relocations and limit COFF AArch64 relocation offsets

The patch adds support for the IMAGE_REL_ARM64_REL32 coff relocation
type. This is needed for 32-bit relative address.

It also adds a check for relocation offsets over 21 bits. Offsets
inside coff files are stored in instruction code. In the case of ADRP
the actual value is stored, not a downshifted page offset. This means
values over 21 bits would otherwise be truncated.

Finally it adds a mapping for BFD_RELOC_AARCH64_ADR_GOT_PAGE and
BFD_RELOC_AARCH64_LD64_GOT_LO12_NC that were previously skipped.

ChangeLog:

* bfd/coff-aarch64.c (coff_aarch64_reloc_type_lookup): Add
BFD_RELOC_AARCH64_ADR_GOT_PAGE,
BFD_RELOC_AARCH64_LD64_GOT_LO12_NC and IMAGE_REL_ARM64_REL32
relocations.
(coff_pe_aarch64_relocate_section): Likewise.
* gas/write.c (adjust_reloc_syms): COFF AArch64 relocation
offsets need to be limited to 21bits
(defined): Likewise.
bfd/coff-aarch64.c
gas/write.c