about summary refs log tree commit diff
path: root/src/test/assembly
diff options
context:
space:
mode:
authorJames McGregor <james.mcgregor2@arm.com>2021-07-13 12:14:26 +0100
committerJamie Cunliffe <Jamie.Cunliffe@arm.com>2021-12-01 12:24:30 +0000
commit837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5 (patch)
tree8ce2820cee2ce31a9b54e93791dd8a7b48241039 /src/test/assembly
parent2446a215954a99f9d33019fad7d415ef9c083502 (diff)
downloadrust-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/assembly')
-rw-r--r--src/test/assembly/aarch64-pointer-auth.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/assembly/aarch64-pointer-auth.rs b/src/test/assembly/aarch64-pointer-auth.rs
new file mode 100644
index 00000000000..e778e67e1b3
--- /dev/null
+++ b/src/test/assembly/aarch64-pointer-auth.rs
@@ -0,0 +1,22 @@
+// Test that PAC instructions are emitted when branch-protection is specified.
+
+// min-llvm-version: 10.0.1
+// assembly-output: emit-asm
+// compile-flags: --target aarch64-unknown-linux-gnu
+// compile-flags: -C branch-protection=pac-ret+leaf
+// needs-llvm-components: aarch64
+
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+#![crate_type = "lib"]
+
+#[lang = "sized"]
+trait Sized {}
+
+// CHECK: hint #25
+// CHECK: hint #29
+#[no_mangle]
+pub fn test() -> u8 {
+    42
+}