[PAC][llvm-readobj][ELF][AArch64] Define AUTH relocations for signed GOT#96158
Merged
[PAC][llvm-readobj][ELF][AArch64] Define AUTH relocations for signed GOT#96158
Conversation
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
This was referenced Jun 20, 2024
Member
|
@llvm/pr-subscribers-llvm-binary-utilities Author: Daniil Kovalev (kovdan01) Changes
Full diff: https://github.com/llvm/llvm-project/pull/96158.diff 2 Files Affected:
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
|
Contributor
Author
|
Would be glad to see feedback on the changes from those who are interested. |
Contributor
Author
|
@MaskRay Would be glad to see your feedback on the changes. Everyone interested is also welcome to leave a review |
MaskRay
approved these changes
Jul 3, 2024
kovdan01
added a commit
to kovdan01/llvm-project
that referenced
this pull request
Jul 8, 2024
kovdan01
added a commit
to kovdan01/llvm-project
that referenced
this pull request
Jul 22, 2024
kovdan01
added a commit
that referenced
this pull request
Aug 7, 2024
Depends on #96158 and #96159 Support the following relocations and assembly operators: - `R_AARCH64_AUTH_ADR_GOT_PAGE` (`:got_auth:` for `adrp`) - `R_AARCH64_AUTH_LD64_GOT_LO12_NC` (`:got_auth_lo12:` for `ldr`) - `R_AARCH64_AUTH_GOT_ADD_LO12_NC` (`:got_auth_lo12:` for `add`) `LOADgotAUTH` pseudo-instruction is introduced which is later expanded to actual instruction sequence like the following. ``` adrp x16, :got_auth:sym add x16, x16, :got_auth_lo12:sym ldr x0, [x16] autia x0, x16 ``` If a resign is requested, like below, `LOADgotPAC` pseudo is used, and GOT load is lowered similarly to `LOADgotAUTH`. ``` @var = global i32 0 define ptr @resign_globalvar() { ret ptr ptrauth (ptr @var, i32 3, i64 43) } ``` Both SelectionDAG and GlobalISel are suppported. For FastISel, we fall back to SelectionDAG. Tests starting with 'ptrauth-' have corresponding variants w/o this prefix. See also specification https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#appendix-signed-got
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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