From 4f9ce44c056132e3bd2dedb57992b5243ee4484f Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Thu, 15 Feb 2024 12:02:33 -0800 Subject: [PATCH] [aaelf64] Fix equation for R_AARCH64_GOTPCREL32 The current wording for this reloc is `G(GDAT(S+A))-P` which means the addend is applied to the symbol we're taking the GOT entry for. What we actually want (and what's implemented in lld) is something similar to `R_X86_64_GOTPCREL` where the addend is applied to the location of the reloc rather than the symbol. --- aaelf64/aaelf64.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aaelf64/aaelf64.rst b/aaelf64/aaelf64.rst index b266e301..d92144f5 100644 --- a/aaelf64/aaelf64.rst +++ b/aaelf64/aaelf64.rst @@ -1262,7 +1262,7 @@ The following tables record single instruction relocations and relocations that | 308 | \- | R\_\_GOTREL32 | S+A-GOT | Write bits [31:0] of X at byte-aligned place P. This represents a 32-bit offset relative to GOT, treated as signed; | | | | | | Check that -2\ :sup:`31` <= X < 2\ :sup:`31`. | +------------+------------+----------------------+------------------+-------------------------------------------------------------------------------------------------------------------------+ - | 315 | \- | R\_\_GOTPCREL32 | G(GDAT(S+A))- P | Write bits [31:0] of X at byte-aligned place P. This represents a 32-bit offset relative to GOT entry for an address, | + | 315 | \- | R\_\_GOTPCREL32 | G(GDAT(S))+A-P | Write bits [31:0] of X at byte-aligned place P. This represents a 32-bit offset relative to GOT entry for an address, | | | | | | treated as signed; Check that -2\ :sup:`31` <= X < 2\ :sup:`31`. | +------------+------------+----------------------+------------------+-------------------------------------------------------------------------------------------------------------------------+