| 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-require-effective-target mbranch_protection_ok } */ |
| 5 |
/* { dg-options "-mcpu=unset -march=armv8.1-m.main+mve+pacbti -mbranch-protection=pac-ret -mthumb -mfloat-abi=hard -fasynchronous-unwind-tables -g -O0" } */ |
| 6 |
|
| 7 |
#include "stdio.h" |
| 8 |
|
| 9 |
__attribute__((noinline)) int |
| 10 |
fn1 (int a) |
| 11 |
{ |
| 12 |
const char *fmt = "branch-protection"; |
| 13 |
int fun1(int x,const char *fmt,int c,int d) |
| 14 |
{ |
| 15 |
printf("string = %s\n",fmt); |
| 16 |
return x+c+d; |
| 17 |
} |
| 18 |
return fun1(a,fmt,10,10); |
| 19 |
} |
| 20 |
|
| 21 |
int main (void) |
| 22 |
{ |
| 23 |
return fn1 (40); |
| 24 |
} |
| 25 |
|
| 26 |
/* { dg-final { scan-assembler-times "\.pacspval" 1 } } */ |
| 27 |
/* { dg-final { scan-assembler-times "\tpac\tip, lr, sp" 3 } } */ |
| 28 |
/* { dg-final { scan-assembler-times "\.cfi_register 143, 12" 3 } } */ |
| 29 |
/* { dg-final { scan-assembler-times "\.save {r7, ra_auth_code, lr}" 2 } } */ |
| 30 |
/* { dg-final { scan-assembler-times "\.cfi_offset 143, -8" 2 } } */ |
| 31 |
/* { dg-final { scan-assembler-times "\.save {r3, r7, ra_auth_code, lr}" 1 } } */ |
| 32 |
/* { dg-final { scan-assembler-times "\.cfi_offset 143, -12" 1 } } */ |