[llvm] [PAC][ELF] Place AUTH constants in .data.rel.ro for position dependent code (PR #150418)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 05:13:02 PST 2025


================
@@ -0,0 +1,51 @@
+; RUN: llc -mtriple aarch64-elf --relocation-model=static         -mattr=+pauth < %s | FileCheck %s
+; RUN: llc -mtriple aarch64-elf --relocation-model=dynamic-no-pic -mattr=+pauth < %s | FileCheck %s
+
+;; A constant value, use .rodata
+; CHECK:         .section        .rodata,"a", at progbits
+; CHECK:         .globl  Const
+; CHECK: Const:
+; CHECK:         .xword  37
+
+;; An AUTH reloc is needed, use .data.rel.ro
+; CHECK:         .section        .data.rel.ro,"aw", at progbits
+; CHECK:         .globl  PtrAuthExtern
+; CHECK: PtrAuthExtern:
+; CHECK:         .xword  ConstExtern at AUTH(da,0)
+
+; CHECK:         .globl  PtrAuth
----------------
atrosinenko wrote:

It is probably reasonable to insert `CHECK-NOT: .section` between these two blocks of positive check lines, so that it would reject incorrect output like this
```
  .section .rodata,"a", at progbits
  .globl   PtrAuth
```

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


More information about the llvm-commits mailing list