1 // Test that the correct module flags are emitted with different branch protection flags.
3 // revisions: BTI PACRET LEAF BKEY NONE
4 // needs-llvm-components: aarch64
5 // [BTI] compile-flags: -Z branch-protection=bti
6 // [PACRET] compile-flags: -Z branch-protection=pac-ret
7 // [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf
8 // [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key
9 // compile-flags: --target aarch64-unknown-linux-gnu
11 #![crate_type = "lib"]
12 #![feature(no_core, lang_items)]
18 // A basic test function.
22 // BTI: !"branch-target-enforcement", i32 1
23 // BTI: !"sign-return-address", i32 0
24 // BTI: !"sign-return-address-all", i32 0
25 // BTI: !"sign-return-address-with-bkey", i32 0
27 // PACRET: !"branch-target-enforcement", i32 0
28 // PACRET: !"sign-return-address", i32 1
29 // PACRET: !"sign-return-address-all", i32 0
30 // PACRET: !"sign-return-address-with-bkey", i32 0
32 // LEAF: !"branch-target-enforcement", i32 0
33 // LEAF: !"sign-return-address", i32 1
34 // LEAF: !"sign-return-address-all", i32 1
35 // LEAF: !"sign-return-address-with-bkey", i32 0
37 // BKEY: !"branch-target-enforcement", i32 0
38 // BKEY: !"sign-return-address", i32 1
39 // BKEY: !"sign-return-address-all", i32 0
40 // BKEY: !"sign-return-address-with-bkey", i32 1
42 // NONE-NOT: branch-target-enforcement
43 // NONE-NOT: sign-return-address
44 // NONE-NOT: sign-return-address-all
45 // NONE-NOT: sign-return-address-with-bkey