[llvm] [PAC][llvm-readobj][ELF][AArch64] Define AUTH relocations for signed GOT (PR #96158)
Daniil Kovalev via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 10:48:05 PDT 2024
https://github.com/kovdan01 updated https://github.com/llvm/llvm-project/pull/96158
>From 8603078d1e51cafbb4d08a5b92e92fe6835be030 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Mon, 15 Apr 2024 04:44:54 +0300
Subject: [PATCH 1/2] [PAC][llvm-readobj][ELF][AArch64] Define AUTH relocations
for signed GOT
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
---
.../llvm/BinaryFormat/ELFRelocs/AArch64.def | 17 ++++++++++
.../llvm-readobj/ELF/reloc-types-aarch64.test | 34 +++++++++++++++++++
2 files changed, 51 insertions(+)
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
>From 029ba553bda1520d2c2cae8d2c1fae152972d088 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <dkovalev at accesssoftek.com>
Date: Mon, 1 Jul 2024 20:38:20 +0300
Subject: [PATCH 2/2] Change relocs names according to:
- https://github.com/ARM-software/abi-aa/pull/255
- https://github.com/ARM-software/abi-aa/pull/259
---
llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def | 4 ++--
llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def b/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
index ece8577fe219f..6f0e948a98c5f 100644
--- a/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
+++ b/llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
@@ -154,10 +154,10 @@ 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_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_GOT_ADR_PREL_LO21, 0x811d)
ELF_RELOC(R_AARCH64_AUTH_GLOB_DAT, 0xe201)
ELF_RELOC(R_AARCH64_AUTH_TLSDESC, 0xe202)
ELF_RELOC(R_AARCH64_AUTH_IRELATIVE, 0xe203)
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 8111bfe71c10f..2833c0b59ae13 100644
--- a/llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test
+++ b/llvm/test/tools/llvm-readobj/ELF/reloc-types-aarch64.test
@@ -140,10 +140,10 @@
# 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_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_GOT_ADR_PREL_LO21 (33053)
# CHECK: Type: R_AARCH64_AUTH_GLOB_DAT (57857)
# CHECK: Type: R_AARCH64_AUTH_TLSDESC (57858)
# CHECK: Type: R_AARCH64_AUTH_IRELATIVE (57859)
@@ -294,10 +294,10 @@ Sections:
- 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_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_GOT_ADR_PREL_LO21
- Type: R_AARCH64_AUTH_GLOB_DAT
- Type: R_AARCH64_AUTH_TLSDESC
- Type: R_AARCH64_AUTH_IRELATIVE
More information about the llvm-commits
mailing list