Commit 576740d
authored
[aaelf64] Clarify addend for R_AARCH64_GOTPCREL32 (#342)
Define the expression for R_AARCH64_GOTPCREL32 as GDAT(S)-P+A. This
matches the only implementation in clang and lld.
The relocation is used to calculate the offset from the start of the
vtable to a GOT entry that contains the address of the RTTI object. As
the table entry for the RTTI pointer is at an offset from the start of
the vtable the relocation addend contains -offset to cancel out.
Previously in #272 the
relocation definition of relocations using GDAT(S+A) were changed to
require A to be 0 as lld and GNU ld were implementing GDAT(S+A) as
GDAT(S) + A and GDAT(S) + 0 respectively.
As this specific relocation is only implemented in clang and lld it is
safe to update the description to match the implementation without
affecting portability.
We use GDAT(S)-P+A rather than GDAT(S) + A - P as the latter implies
that we are calculating an offset to a different GOT slot to GDAT(S)
rather than an offset from P.
Discussion and example: #2721 parent d455ef1 commit 576740d
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| |||
1319 | 1320 | | |
1320 | 1321 | | |
1321 | 1322 | | |
1322 | | - | |
| 1323 | + | |
1323 | 1324 | | |
1324 | 1325 | | |
1325 | 1326 | | |
| |||
0 commit comments