30 lines · c
1void foo() {}2 3int main() {4 //% self.filecheck("c", "braa.c")5 // CHECK: stop reason = EXC_BAD_ACCESS6 //7 // TODO: We need call site info support for indirect calls to make this work.8 // CHECK-NOT: pointer authentication failure9 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`foo23// braa`foo:24// 0x100007f9c <+0>: ret25//26// braa`main:27// 0x100007fa0 <+0>: nop28// 0x100007fa4 <+4>: ldr x8, #0x5c29// 0x100007fa8 <+8>: mov x9, #0xbad30