Skip to content

Commit f14c8ff

Browse files
committed
[PAUTHABIELF64] Add R_AARCH64_AUTH_GOT_ADR_PREL_LO21 relocation
With the tiny code model and a signed GOT, an adr instruction is needed to get the address of the GOT entry for input to the authenication. For example: adr x8, :got_auth: symbol ldr x0, [x8] // Authenticate to get unsigned pointer autia x0, x8 The adr requires a new relocation code where there isn't a direct equivalent in the main ABI as there is not need to take the address of the GOT slot when no authentication is required. We define R_AARCH64_AUTH_GOT_ADR_PREL21_LO21 for this purpose following the naming convention of R_<CLS>_ADR_PREL_LO21. which is its closest equivalent.
1 parent 01f97f3 commit f14c8ff

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

pauthabielf64/pauthabielf64.rst

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ GOT entry as the modifier. The static linker must encode the signing
10691069
schema into the GOT slot. AUTH variant dynamic relocations must be
10701070
used for signed GOT entries.
10711071

1072-
Example Code to access a signed GOT entry
1072+
Example Code to access a signed GOT entry with the small code model:
10731073

10741074
.. code-block:: asm
10751075
@@ -1082,6 +1082,18 @@ Example Code to access a signed GOT entry
10821082
In the example the :got_auth: and :got_auth_lo12: operators result in
10831083
AUTH variant GOT generating relocations being used.
10841084

1085+
Example Code to access a signed GOT entry with the tiny code model:
1086+
1087+
.. code-block:: asm
1088+
1089+
adr x8, :got_auth: symbol
1090+
ldr x0, [x8]
1091+
// Authenticate to get unsigned pointer
1092+
autia x0, x8
1093+
1094+
Compared to the tiny code model without pointer authentication an
1095+
additonal adr is required to get the address of the GOT entry.
1096+
10851097
AUTH variant GOT Generating Relocations
10861098
---------------------------------------
10871099

@@ -1157,6 +1169,11 @@ The GOT entries must be relocated by AUTH variant dynamic relocations.
11571169
| | | | value to bits [11:0] of |
11581170
| | | | X. No overflow check. |
11591171
+-------------+----------------------------------------+----------------------------------+--------------------------+
1172+
| 0x811D | R\AARCH64\_AUTH\_GOT\_ADR\_PREL\_LO21 | G(ENCD(GDAT(S + A))) - P | Set the immediate |
1173+
| | | | value to bits[20:0] of X;|
1174+
| | | | check that -2 :sup:`20` |
1175+
| | | | <= 2 :sup: `20` |
1176+
+-------------+----------------------------------------+----------------------------------+--------------------------+
11601177
.. raw:: pdf
11611178

11621179
PageBreak
@@ -1170,9 +1187,13 @@ is the PAuth ABI equivalent of ``R_AARCH64_RELATIVE``. The underlying
11701187
calculation performed by the dynamic linker is the same, the only
11711188
difference is that the resulting pointer is signed. The dynamic linker
11721189
reads the signing schema from the contents of the place of the dynamic
1173-
relocation. The ``R_AARCH64_AUTH_GOT_ADD_LO12_NC`` relocation is an
1174-
addition for the PAuth ABI and has no equivalent in (AAELF64_). It is
1175-
used with the ``:got_auth_lo12:`` operator on an add instruction.
1190+
relocation.
1191+
1192+
The ``R_AARCH64_AUTH_GOT_ADD_LO12_NC`` relocation is an addition for
1193+
the PAuth ABI and has no equivalent in (AAELF64_). It is
1194+
1195+
The ``R_AARCH64_AUTH_GOT_ADR_PREL_LO21`` relocation is used with the
1196+
``:got_auth:`` operator on an adr instruction.
11761197

11771198
.. table:: Additional AUTH Dynamic relocations
11781199

0 commit comments

Comments
 (0)