| 1 |
/* Check that GCC does .save and .cfi_offset directives with RA_AUTH_CODE pseudo hard-register. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-require-effective-target arm_arch_v8_1m_main_pacbti_ok } */ |
| 4 |
/* { dg-add-options arm_arch_v8_1m_main_pacbti } */ |
| 5 |
/* { dg-additional-options "-mbranch-protection=pac-ret -mfloat-abi=hard -g -O0" } */ |
| 6 |
|
| 7 |
__attribute__((noinline)) void |
| 8 |
fn1 (int a, int b, int c) |
| 9 |
{ |
| 10 |
if (a != b + c) |
| 11 |
__builtin_abort (); |
| 12 |
else |
| 13 |
throw b+c; |
| 14 |
} |
| 15 |
|
| 16 |
int main () |
| 17 |
{ |
| 18 |
int a = 120; |
| 19 |
try |
| 20 |
{ |
| 21 |
fn1 (a, 40, 80); |
| 22 |
} |
| 23 |
catch (int x) |
| 24 |
{ |
| 25 |
if (x != a) |
| 26 |
__builtin_abort (); |
| 27 |
else |
| 28 |
return 0; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-assembler-times "pac ip, lr, sp" 2 } } */ |
| 33 |
/* { dg-final { scan-assembler-times "\.cfi_register 143, 12" 2 } } */ |
| 34 |
/* { dg-final { scan-assembler-times "\.save {r7, ra_auth_code, lr}" 1 } } */ |
| 35 |
/* { dg-final { scan-assembler-times "\.cfi_offset 143, -8" 2 } } */ |
| 36 |
/* { dg-final { scan-assembler-times "\.save {r4, r7, ra_auth_code, lr}" 1 } } */ |