Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sls-mitigation/sls-miti-retbr-pacret.c

raw
1 /* Avoid ILP32 since pacret is only available for LP64 */
2 /* { dg-do compile { target { ! ilp32 } } } */
3 /* { dg-additional-options "-mharden-sls=retbr -mbranch-protection=pac-ret -march=armv8.3-a" } */
4
5 /* Testing the do_return pattern for retaa and retab. */
6 long retbr_subcall(void);
7 long retbr_do_return_retaa(void)
8 {
9 return retbr_subcall()+1;
10 }
11
12 __attribute__((target("branch-protection=pac-ret+b-key")))
13 long retbr_do_return_retab(void)
14 {
15 return retbr_subcall()+1;
16 }
17
18 /* Ensure there are no BR or RET instructions which are not directly followed
19 by a speculation barrier. */
20 /* { dg-final { scan-assembler-not {\t(br|ret|retaa|retab)\tx[0-9][0-9]?\n\t(?!dsb\tsy\n\tisb)} } } */
21 /* { dg-final { scan-assembler-not {ret\t} } } */