[llvm] [PAC][llvm-readobj][ELF][AArch64] Define AUTH relocations for signed GOT (PR #96158)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 04:20:56 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-binary-utilities

Author: Daniil Kovalev (kovdan01)

<details>
<summary>Changes</summary>

- AUTH variant GOT-generating relocations
  https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#auth-variant-got-generating-relocations

- AUTH variant dynamic relocations for signed GOT
  https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#additional-auth-variant-dynamic-relocations-for-signed-got

---
Full diff: https://github.com/llvm/llvm-project/pull/96158.diff


2 Files Affected:

- (modified) llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def (+17) 
- (modified) llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test (+34) 


``````````diff
diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
index cb05db85e2b5a..ece8577fe219f 100644
--- a/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
+++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
@@ -144,6 +144,23 @@ ELF_RELOC(R_AARCH64_IRELATIVE,                       0x408)
 // https://github.com/ARM-software/abi-aa
 ELF_RELOC(R_AARCH64_AUTH_ABS64,                      0x244)
 ELF_RELOC(R_AARCH64_AUTH_RELATIVE,                   0x411)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G0,             0x8110)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G0_NC,          0x8111)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G1,             0x8112)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G1_NC,          0x8113)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G2,             0x8114)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G2_NC,          0x8115)
+ELF_RELOC(R_AARCH64_AUTH_MOVW_GOTOFF_G3,             0x8116)
+ELF_RELOC(R_AARCH64_AUTH_GOT_LD_PREL19,              0x8117)
+ELF_RELOC(R_AARCH64_AUTH_LD64_GOTOFF_LO15,           0x8118)
+ELF_RELOC(R_AARCH64_AUTH_ADR_GOT_PAGE,               0x8119)
+ELF_RELOC(R_AARCH64_AUTH_GOT_LO12_NC,                0x811a)
+ELF_RELOC(R_AARCH64_AUTH_LD64_GOTPAGE_LO15,          0x811b)
+ELF_RELOC(R_AARCH64_AUTH_GOT_ADD_LO12_NC,            0x811c)
+ELF_RELOC(R_AARCH64_AUTH_GOT_ADR_PREL21,             0x811d)
+ELF_RELOC(R_AARCH64_AUTH_GLOB_DAT,                   0xe201)
+ELF_RELOC(R_AARCH64_AUTH_TLSDESC,                    0xe202)
+ELF_RELOC(R_AARCH64_AUTH_IRELATIVE,                  0xe203)
 
 // ELF32
 // ELF_RELOC(R_AARCH64_P32_NONE,                         0)
diff --git a/llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test b/llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test
index cf95b51700267..8111bfe71c10f 100644
--- a/llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test
+++ b/llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test
@@ -130,6 +130,23 @@
 # CHECK: Type: R_AARCH64_TLSDESC (1031)
 # CHECK: Type: R_AARCH64_IRELATIVE (1032)
 # CHECK: Type: R_AARCH64_AUTH_RELATIVE (1041)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G0 (33040)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G0_NC (33041)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G1 (33042)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G1_NC (33043)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G2 (33044)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G2_NC (33045)
+# CHECK: Type: R_AARCH64_AUTH_MOVW_GOTOFF_G3 (33046)
+# CHECK: Type: R_AARCH64_AUTH_GOT_LD_PREL19 (33047)
+# CHECK: Type: R_AARCH64_AUTH_LD64_GOTOFF_LO15 (33048)
+# CHECK: Type: R_AARCH64_AUTH_ADR_GOT_PAGE (33049)
+# CHECK: Type: R_AARCH64_AUTH_GOT_LO12_NC (33050)
+# CHECK: Type: R_AARCH64_AUTH_LD64_GOTPAGE_LO15 (33051)
+# CHECK: Type: R_AARCH64_AUTH_GOT_ADD_LO12_NC (33052)
+# CHECK: Type: R_AARCH64_AUTH_GOT_ADR_PREL21 (33053)
+# CHECK: Type: R_AARCH64_AUTH_GLOB_DAT (57857)
+# CHECK: Type: R_AARCH64_AUTH_TLSDESC (57858)
+# CHECK: Type: R_AARCH64_AUTH_IRELATIVE (57859)
 
 --- !ELF
 FileHeader:
@@ -267,3 +284,20 @@ Sections:
       - Type: R_AARCH64_TLSDESC
       - Type: R_AARCH64_IRELATIVE
       - Type: R_AARCH64_AUTH_RELATIVE
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G0
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G0_NC
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G1
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G1_NC
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G2
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G2_NC
+      - Type: R_AARCH64_AUTH_MOVW_GOTOFF_G3
+      - Type: R_AARCH64_AUTH_GOT_LD_PREL19
+      - Type: R_AARCH64_AUTH_LD64_GOTOFF_LO15
+      - Type: R_AARCH64_AUTH_ADR_GOT_PAGE
+      - Type: R_AARCH64_AUTH_GOT_LO12_NC
+      - Type: R_AARCH64_AUTH_LD64_GOTPAGE_LO15
+      - Type: R_AARCH64_AUTH_GOT_ADD_LO12_NC
+      - Type: R_AARCH64_AUTH_GOT_ADR_PREL21
+      - Type: R_AARCH64_AUTH_GLOB_DAT
+      - Type: R_AARCH64_AUTH_TLSDESC
+      - Type: R_AARCH64_AUTH_IRELATIVE

``````````

</details>


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


More information about the llvm-commits mailing list