[lld] [PAC][lld][AArch64][ELF] Support signed GOT (PR #113815)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 1 14:30:06 PST 2024


================
@@ -735,6 +737,21 @@ void GotSection::writeTo(uint8_t *buf) {
     return;
   ctx.target->writeGotHeader(buf);
   ctx.target->relocateAlloc(*this, buf);
+  for (const AuthEntryInfo &authEntry : authEntries) {
+    // https://github.com/ARM-software/abi-aa/blob/2024Q3/pauthabielf64/pauthabielf64.rst#default-signing-schema
+    //   Signed GOT entries use the IA key for symbols of type STT_FUNC and the
+    //   DA key for all other symbol types, with the address of the GOT entry as
+    //   the modifier. The static linker must encode the signing schema into the
+    //   GOT slot.
+    //
+    // https://github.com/ARM-software/abi-aa/blob/2024Q3/pauthabielf64/pauthabielf64.rst#encoding-the-signing-schema
+    //   If address diversity is set and the discriminator
+    //   is 0 then modifier = Place
+    uint8_t *dest = buf + authEntry.offset;
+    uint64_t key = authEntry.isSymbolFunc ? /*IA*/ 0b00 : /*DA*/ 0b10;
----------------
kovdan01 wrote:

Fixed in b277e3ba49797f368139c62f2f64b6be25af8679, thanks

https://github.com/llvm/llvm-project/pull/113815


More information about the llvm-commits mailing list