]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/branch-protection.rs
Rollup merge of #94093 - tmiasko:pp-no-variants, r=oli-obk
[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 pac-ret leaf b-key
4 // min-llvm-version: 12.0.0
5 // needs-llvm-components: aarch64
6 // [bti] compile-flags: -Z branch-protection=bti
7 // [pac-ret] compile-flags: -Z branch-protection=pac-ret
8 // [leaf] compile-flags: -Z branch-protection=pac-ret,leaf
9 // [b-key] 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 // pac-ret: !"branch-target-enforcement", i32 0
29 // pac-ret: !"sign-return-address", i32 1
30 // pac-ret: !"sign-return-address-all", i32 0
31 // pac-ret: !"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 // b-key: !"branch-target-enforcement", i32 0
39 // b-key: !"sign-return-address", i32 1
40 // b-key: !"sign-return-address-all", i32 0
41 // b-key: !"sign-return-address-with-bkey", i32 1