diff options
| author | James McGregor <james.mcgregor2@arm.com> | 2021-07-13 12:14:26 +0100 |
|---|---|---|
| committer | Jamie Cunliffe <Jamie.Cunliffe@arm.com> | 2021-12-01 12:24:30 +0000 |
| commit | 837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5 (patch) | |
| tree | 8ce2820cee2ce31a9b54e93791dd8a7b48241039 /src/test/codegen | |
| parent | 2446a215954a99f9d33019fad7d415ef9c083502 (diff) | |
| download | rust-837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5.tar.gz rust-837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5.zip | |
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..79706cdf070 --- /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: -C branch-protection=bti +// [pac-ret] compile-flags: -C branch-protection=pac-ret +// [leaf] compile-flags: -C branch-protection=pac-ret+leaf +// [b-key] compile-flags: -C 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 |
