[PATCH v1 1/3] aarch64: Fix IMAGE_REL_ARM64_PAGEBASE_REL21 relocation and symbol reduction for relocations

Martin Storsjö martin@martin.st
Fri Sep 6 12:09:25 GMT 2024


On Mon, 26 Aug 2024, Evgeny Karpov wrote:

> Initially, the change was to fix IMAGE_REL_ARM64_PAGEBASE_REL21,
> which was addressing only 1MB instead of 4GB. This change triggered
> multiple changes in binutils and gcc to support the small code model.

Sorry, but this is wrong.

The IMAGE_REL_ARM64_PAGEBASE_REL21 relocation supports an +/- 1 MB 
immediate offset encoded in the instruction, which is applied on the 
symbol that the relocation points to.

This is how both LLVM and MSVC tools use this relocation - I've provided 
examples in 
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662277.html.

You can't just redefine how the relocation is supposed to work, if you 
want your tools to remain with other consumers of the same object file 
format.

// Martin



More information about the Binutils mailing list