1 // REQUIRES: arm-registered-target
2 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -S -emit-llvm -o - -mbranch-protection=none %s | FileCheck %s --check-prefix=CHECK --check-prefix=NONE
3 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -S -emit-llvm -o - -mbranch-protection=pac-ret %s | FileCheck %s --check-prefix=CHECK --check-prefix=PART
4 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -S -emit-llvm -o - -mbranch-protection=pac-ret+leaf %s | FileCheck %s --check-prefix=CHECK --check-prefix=ALL
5 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -S -emit-llvm -o - -mbranch-protection=pac-ret+b-key %s | FileCheck %s --check-prefix=CHECK --check-prefix=PART
6 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main -S -emit-llvm -o - -mbranch-protection=bti %s | FileCheck %s --check-prefix=CHECK --check-prefix=BTE
8 // Check there are no branch protection function attributes
10 // CHECK-LABEL: @foo() #[[#ATTR:]]
12 // CHECK-NOT: attributes #[[#ATTR]] = { {{.*}} "sign-return-address"
13 // CHECK-NOT: attributes #[[#ATTR]] = { {{.*}} "sign-return-address-key"
14 // CHECK-NOT: attributes #[[#ATTR]] = { {{.*}} "branch-target-enforcement"
16 // Check module attributes
18 // NONE-NOT: !"branch-target-enforcement"
19 // PART-NOT: !"branch-target-enforcement"
20 // ALL-NOT: !"branch-target-enforcement"
21 // BTE: !{i32 8, !"branch-target-enforcement", i32 1}
23 // NONE-NOT: !"sign-return-address"
24 // PART: !{i32 8, !"sign-return-address", i32 1}
25 // ALL: !{i32 8, !"sign-return-address", i32 1}
26 // BTE-NOT: !"sign-return-address"
28 // NONE-NOT: !"sign-return-address-all", i32 0}
29 // PART-NOT: !"sign-return-address-all", i32 0}
30 // ALL: !{i32 8, !"sign-return-address-all", i32 1}
31 // BTE-NOT: !"sign-return-address-all", i32 0}