Debian Codegraph @

gcc/testsuite/gcc.target/arm/pac-5.c

raw
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 square (int z) { return z * z; }
16 return square (a) + square (b);
17 }
18
19 int
20 main (void)
21 {
22 if (foo1 (1, 2) != 5)
23 abort ();
24
25 return 0;
26 }
27
28 /* { dg-final { scan-assembler-times "pac\tip, lr, sp" 3 } } */
29 /* { dg-final { scan-assembler-times "aut\tip, lr, sp" 3 } } */
30 /* { dg-final { scan-assembler-not "\tbti" } } */