foo()1 void foo() {}
2
main()3 int main() {
4 //% self.filecheck("c", "braa.c")
5 // CHECK: stop reason = EXC_BAD_ACCESS
6 //
7 // TODO: We need call site info support for indirect calls to make this work.
8 // CHECK-NOT: pointer authentication failure
9 asm volatile (
10 "mov x9, #0xbad \n"
11 "braa %[target], x9 \n"
12 /* Outputs */ :
13 /* Inputs */ : [target] "r"(&foo)
14 /* Clobbers */ : "x9"
15 );
16
17 return 1;
18 }
19
20 // Expected codegen and exception message without ptrauth diagnostics:
21 // * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2000000100007f9c)
22 // frame #0: 0x0000000100007f9c braa`foo
23 // braa`foo:
24 // 0x100007f9c <+0>: ret
25 //
26 // braa`main:
27 // 0x100007fa0 <+0>: nop
28 // 0x100007fa4 <+4>: ldr x8, #0x5c
29 // 0x100007fa8 <+8>: mov x9, #0xbad
30