about summary refs log tree commit diff
path: root/tests/codegen/cffi
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-12 17:41:33 +0200
committerGitHub <noreply@github.com>2024-04-12 17:41:33 +0200
commit4a0e9e0debeb29f5cf0ae4e886c8c9a1cbb2fe78 (patch)
tree942f91392f0276be4494d27dff7207969521d293 /tests/codegen/cffi
parent68359e22841d1f99262455c5dff1d73a7468b815 (diff)
parent9139d7252de74c30539afb35dc05e3536456971b (diff)
downloadrust-4a0e9e0debeb29f5cf0ae4e886c8c9a1cbb2fe78.tar.gz
rust-4a0e9e0debeb29f5cf0ae4e886c8c9a1cbb2fe78.zip
Rollup merge of #123249 - goolmoos:naked_variadics, r=pnkfelix
do not add prolog for variadic naked functions

fixes #99858
Diffstat (limited to 'tests/codegen/cffi')
-rw-r--r--tests/codegen/cffi/c-variadic-naked.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/codegen/cffi/c-variadic-naked.rs b/tests/codegen/cffi/c-variadic-naked.rs
new file mode 100644
index 00000000000..807873ea368
--- /dev/null
+++ b/tests/codegen/cffi/c-variadic-naked.rs
@@ -0,0 +1,19 @@
+//@ needs-asm-support
+//@ only-x86_64
+
+// tests that `va_start` is not injected into naked functions
+
+#![crate_type = "lib"]
+#![feature(c_variadic)]
+#![feature(naked_functions)]
+#![no_std]
+
+#[naked]
+pub unsafe extern "C" fn c_variadic(_: usize, _: ...) {
+    // CHECK-NOT: va_start
+    // CHECK-NOT: alloca
+    core::arch::asm! {
+        "ret",
+        options(noreturn),
+    }
+}