]> git.proxmox.com Git - rustc.git/blob - tests/codegen/branch-protection.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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 // 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
10
11 #![crate_type = "lib"]
12 #![feature(no_core, lang_items)]
13 #![no_core]
14
15 #[lang="sized"]
16 trait Sized { }
17
18 // A basic test function.
19 pub fn test() {
20 }
21
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
26
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
31
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
36
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
41
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