about summary refs log tree commit diff
path: root/tests/assembly-llvm/aarch64-pointer-auth.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-07-21 14:22:51 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-07-22 14:27:48 +0200
commited93c1783b404d728d4809973a0550eb33cd293f (patch)
tree2b62aab8b2482fcde1f9128ff53be8cd66bde847 /tests/assembly-llvm/aarch64-pointer-auth.rs
parentc0b282f0ccdab7523cdb8dfa41b23bed5573da76 (diff)
downloadrust-ed93c1783b404d728d4809973a0550eb33cd293f.tar.gz
rust-ed93c1783b404d728d4809973a0550eb33cd293f.zip
Rename `tests/assembly` into `tests/assembly-llvm`
Diffstat (limited to 'tests/assembly-llvm/aarch64-pointer-auth.rs')
-rw-r--r--tests/assembly-llvm/aarch64-pointer-auth.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/assembly-llvm/aarch64-pointer-auth.rs b/tests/assembly-llvm/aarch64-pointer-auth.rs
new file mode 100644
index 00000000000..56a26df469f
--- /dev/null
+++ b/tests/assembly-llvm/aarch64-pointer-auth.rs
@@ -0,0 +1,30 @@
+// Test that PAC instructions are emitted when branch-protection is specified.
+
+//@ add-core-stubs
+//@ revisions: PACRET PAUTHLR_NOP PAUTHLR
+//@ assembly-output: emit-asm
+//@ needs-llvm-components: aarch64
+//@ compile-flags: --target aarch64-unknown-linux-gnu
+//@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf
+//@ [PAUTHLR_NOP] compile-flags: -Z branch-protection=pac-ret,pc,leaf
+//@ [PAUTHLR] compile-flags: -C target-feature=+pauth-lr -Z branch-protection=pac-ret,pc,leaf
+
+#![feature(no_core, lang_items)]
+#![no_std]
+#![no_core]
+#![crate_type = "lib"]
+
+extern crate minicore;
+use minicore::*;
+
+// PACRET: hint #25
+// PACRET: hint #29
+// PAUTHLR_NOP: hint #25
+// PAUTHLR_NOP: hint #39
+// PAUTHLR_NOP: hint #29
+// PAUTHLR: paciasppc
+// PAUTHLR: autiasppc
+#[no_mangle]
+pub fn test() -> u8 {
+    42
+}