[lld] [lld][AArch64][ELF][PAC] Support AUTH relocations and AUTH ELF marking (PR #72714)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 17:11:55 PST 2024


================
@@ -0,0 +1,114 @@
+# REQUIRES: aarch64
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64 %p/Inputs/shared2.s -o %t.so.o
+# RUN: ld.lld -shared %t.so.o -soname=so -o %t.so
+# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
+
+# RUN: ld.lld -pie -z nopack-relative-relocs %t.o %t.so -o %t2
+# RUN: llvm-readobj -r %t2 | FileCheck --check-prefix=UNPACKED %s
+
+# UNPACKED:          Section ({{.+}}) .rela.dyn {
+# UNPACKED-NEXT:       0x30440 R_AARCH64_AUTH_RELATIVE - 0x1
+# UNPACKED-NEXT:       0x30448 R_AARCH64_AUTH_RELATIVE - 0x2
+# UNPACKED-NEXT:       0x30450 R_AARCH64_AUTH_RELATIVE - 0x3
+# UNPACKED-NEXT:       0x30458 R_AARCH64_AUTH_RELATIVE - 0x12345678
+# UNPACKED-NEXT:       0x30460 R_AARCH64_AUTH_RELATIVE - 0x123456789A
+# UNPACKED-NEXT:       0x30479 R_AARCH64_AUTH_RELATIVE - 0x4
+# UNPACKED-NEXT:       0x30482 R_AARCH64_AUTH_RELATIVE - 0x5
+# UNPACKED-NEXT:       0x30468 R_AARCH64_AUTH_ABS64 zed2 0x0
+# UNPACKED-NEXT:       0x30470 R_AARCH64_AUTH_ABS64 bar2 0x0
+# UNPACKED-NEXT:     }
+
+# RUN: ld.lld -pie -z pack-relative-relocs %t.o %t.so -o %t2
+# RUN: llvm-readelf -S --dynamic-table %t2 | FileCheck --check-prefix=RELR-HEADERS %s
----------------
MaskRay wrote:

You can combine the `-x .test` test here to save one llvm-readelf invocation.

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


More information about the llvm-commits mailing list