| 1 |
/* Testing return address signing. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-effective-target arm_arch_v8_1m_main_pacbti_link } */ |
| 4 |
/* { dg-require-effective-target mbranch_protection_ok } */ |
| 5 |
/* { dg-require-effective-target arm_pacbti_hw } */ |
| 6 |
/* { dg-options "-mbranch-protection=pac-ret+leaf -mfloat-abi=hard --save-temps -O0" } */ |
| 7 |
/* { dg-add-options arm_arch_v8_1m_main_pacbti } */ |
| 8 |
|
| 9 |
#include <stdlib.h> |
| 10 |
|
| 11 |
int |
| 12 |
__attribute__((noinline)) |
| 13 |
foo1 (int a, int b) |
| 14 |
{ |
| 15 |
int x = 4; |
| 16 |
int foo2 (int a, int b) |
| 17 |
{ |
| 18 |
return a + b + x; |
| 19 |
} |
| 20 |
return foo2 (a, b); |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
main (void) |
| 25 |
{ |
| 26 |
if (foo1 (1, 2) != 7) |
| 27 |
abort (); |
| 28 |
|
| 29 |
return 0; |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-assembler-times "\tpac\tip, lr, sp" 3 } } */ |
| 33 |
/* { dg-final { scan-assembler-times "\taut\tip, lr, sp" 3 } } */ |
| 34 |
/* { dg-final { scan-assembler-not "\tbti" } } */ |