1 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -msign-return-address=none %s | FileCheck %s --check-prefix=CHECK --check-prefix=NONE
2 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -msign-return-address=all %s | FileCheck %s --check-prefix=CHECK --check-prefix=ALL
3 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -msign-return-address=non-leaf %s | FileCheck %s --check-prefix=CHECK --check-prefix=PART
5 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -mbranch-protection=none %s | FileCheck %s --check-prefix=CHECK --check-prefix=NONE
6 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -mbranch-protection=pac-ret+leaf %s | FileCheck %s --check-prefix=CHECK --check-prefix=ALL
7 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -mbranch-protection=pac-ret+b-key %s | FileCheck %s --check-prefix=CHECK --check-prefix=B-KEY
8 // RUN: %clang -target aarch64-none-elf -S -emit-llvm -o - -mbranch-protection=bti %s | FileCheck %s --check-prefix=CHECK --check-prefix=BTE
10 // REQUIRES: aarch64-registered-target
12 // Check there are no branch protection function attributes
14 // CHECK-LABEL: @foo() #[[#ATTR:]]
16 // NONE-NOT: attributes #[[#ATTR]] = { {{.*}} "sign-return-address"
17 // NONE-NOT: attributes #[[#ATTR]] = { {{.*}} "sign-return-address-key"
18 // NONE-NOT: attributes #[[#ATTR]] = { {{.*}} "branch-target-enforcement"
20 // ALL: attributes #[[#ATTR]] = { {{.*}} "sign-return-address"
21 // PART: attributes #[[#ATTR]] = { {{.*}} "sign-return-address-key"="a_key"
22 // B-KEY: attributes #[[#ATTR]] = { {{.*}} "sign-return-address-key"="b_key"
23 // BTE: attributes #[[#ATTR]] = { {{.*}} "branch-target-enforcement"
26 // Check module attributes
28 // NONE-NOT: !"branch-target-enforcement"
29 // ALL-NOT: !"branch-target-enforcement"
30 // PART-NOT: !"branch-target-enforcement"
31 // BTE: !{i32 8, !"branch-target-enforcement", i32 1}
32 // B-KEY-NOT: !"branch-target-enforcement"
34 // NONE-NOT: !"sign-return-address"
35 // ALL: !{i32 8, !"sign-return-address", i32 1}
36 // PART: !{i32 8, !"sign-return-address", i32 1}
37 // BTE-NOT: !"sign-return-address"
38 // B-KEY: !{i32 8, !"sign-return-address", i32 1}
40 // NONE-NOT: !"sign-return-address-all"
41 // ALL: !{i32 8, !"sign-return-address-all", i32 1}
42 // PART-NOT: !"sign-return-address-all"
43 // BTE-NOT: !"sign-return-address-all"
44 // B-KEY-NOT: !"sign-return-address-all"
46 // NONE-NOT: !"sign-return-address-with-bkey"
47 // ALL-NOT: !"sign-return-address-with-bkey"
48 // PART-NOT: !"sign-return-address-with-bkey"
49 // BTE-NOT: !"sign-return-address-with-bkey"
50 // B-KEY: !{i32 8, !"sign-return-address-with-bkey", i32 1}