xref: /llvm-project/lldb/test/API/functionalities/ptrauth_diagnostics/BLRAA_error/blraa.c (revision 66902a32c83809d26662f76e4107d5dd777610c3)

foo()1 void foo() {}
2 
main()3 int main() {
4   //% self.filecheck("c", "blraa.c")
5   // CHECK: stop reason = EXC_BAD_ACCESS
6   // CHECK-NEXT: Note: Possible pointer authentication failure detected.
7   // CHECK-NEXT: Found authenticated indirect branch at address=0x{{.*}} (blraa.c:[[@LINE+1]]:3).
8   asm volatile (
9       "mov x9, #0xbad \n"
10       "blraa %[target], x9 \n"
11       /* Outputs */  :
12       /* Inputs */   : [target] "r"(&foo)
13       /* Clobbers */ : "x9"
14   );
15 
16   return 1;
17 }
18 
19 // Expected codegen and exception message without ptrauth diagnostics:
20 // * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2000000100007f9c)
21 //     frame #0: 0x0000000100007f9c blraa2`foo
22 // blraa2`foo:
23 //     0x100007f9c <+0>: ret
24 //
25 // blraa2`main:
26 //     0x100007fa0 <+0>: nop
27 //     0x100007fa4 <+4>: ldr    x8, #0x5c
28 //     0x100007fa8 <+8>: mov    x9, #0xbad
29