diff options
| author | bors <bors@rust-lang.org> | 2021-12-29 22:35:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-29 22:35:11 +0000 |
| commit | d331cb710f0dd969d779510a49a3bafc7f78a54e (patch) | |
| tree | ff97d24d16d1380b3fea3dd0ae3cbb23828596ba /src/test/codegen | |
| parent | 78fd0f633faaa5b6dd254fc1456735f63a1b1238 (diff) | |
| parent | 984ca4689dbceea29bbfcf54c4743b45fccf7ad1 (diff) | |
| download | rust-d331cb710f0dd969d779510a49a3bafc7f78a54e.tar.gz rust-d331cb710f0dd969d779510a49a3bafc7f78a54e.zip | |
Auto merge of #88354 - Jmc18134:hint-space-pauth-opt, r=nagisa
Add codegen option for branch protection and pointer authentication on AArch64 The branch-protection codegen option enables the use of hint-space pointer authentication code for AArch64 targets.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/branch-protection.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/codegen/branch-protection.rs b/src/test/codegen/branch-protection.rs new file mode 100644 index 00000000000..106c9b148ee --- /dev/null +++ b/src/test/codegen/branch-protection.rs @@ -0,0 +1,41 @@ +// Test that the correct module flags are emitted with different branch protection flags. + +// revisions: bti pac-ret leaf b-key +// min-llvm-version: 12.0.0 +// needs-llvm-components: aarch64 +// [bti] compile-flags: -Z branch-protection=bti +// [pac-ret] compile-flags: -Z branch-protection=pac-ret +// [leaf] compile-flags: -Z branch-protection=pac-ret,leaf +// [b-key] compile-flags: -Z branch-protection=pac-ret,b-key +// compile-flags: --target aarch64-unknown-linux-gnu + +#![crate_type = "lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } + +// A basic test function. +pub fn test() { +} + +// bti: !"branch-target-enforcement", i32 1 +// bti: !"sign-return-address", i32 0 +// bti: !"sign-return-address-all", i32 0 +// bti: !"sign-return-address-with-bkey", i32 0 + +// pac-ret: !"branch-target-enforcement", i32 0 +// pac-ret: !"sign-return-address", i32 1 +// pac-ret: !"sign-return-address-all", i32 0 +// pac-ret: !"sign-return-address-with-bkey", i32 0 + +// leaf: !"branch-target-enforcement", i32 0 +// leaf: !"sign-return-address", i32 1 +// leaf: !"sign-return-address-all", i32 1 +// leaf: !"sign-return-address-with-bkey", i32 0 + +// b-key: !"branch-target-enforcement", i32 0 +// b-key: !"sign-return-address", i32 1 +// b-key: !"sign-return-address-all", i32 0 +// b-key: !"sign-return-address-with-bkey", i32 1 |
