]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/branch-protection.rs
Rollup merge of #99479 - Enselic:import-can-be-without-id, r=camelid
[rust.git] / src / test / codegen / branch-protection.rs
1 // Test that the correct module flags are emitted with different branch protection flags.
2
3 // revisions: BTI PACRET LEAF BKEY NONE
4 // min-llvm-version: 12.0.0
5 // needs-llvm-components: aarch64
6 // [BTI] compile-flags: -Z branch-protection=bti
7 // [PACRET] compile-flags: -Z branch-protection=pac-ret
8 // [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf
9 // [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key
10 // compile-flags: --target aarch64-unknown-linux-gnu
11
12 #![crate_type = "lib"]
13 #![feature(no_core, lang_items)]
14 #![no_core]
15
16 #[lang="sized"]
17 trait Sized { }
18
19 // A basic test function.
20 pub fn test() {
21 }
22
23 // BTI: !"branch-target-enforcement", i32 1
24 // BTI: !"sign-return-address", i32 0
25 // BTI: !"sign-return-address-all", i32 0
26 // BTI: !"sign-return-address-with-bkey", i32 0
27
28 // PACRET: !"branch-target-enforcement", i32 0
29 // PACRET: !"sign-return-address", i32 1
30 // PACRET: !"sign-return-address-all", i32 0
31 // PACRET: !"sign-return-address-with-bkey", i32 0
32
33 // LEAF: !"branch-target-enforcement", i32 0
34 // LEAF: !"sign-return-address", i32 1
35 // LEAF: !"sign-return-address-all", i32 1
36 // LEAF: !"sign-return-address-with-bkey", i32 0
37
38 // BKEY: !"branch-target-enforcement", i32 0
39 // BKEY: !"sign-return-address", i32 1
40 // BKEY: !"sign-return-address-all", i32 0
41 // BKEY: !"sign-return-address-with-bkey", i32 1
42
43 // NONE-NOT: branch-target-enforcement
44 // NONE-NOT: sign-return-address
45 // NONE-NOT: sign-return-address-all
46 // NONE-NOT: sign-return-address-with-bkey