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