about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-06-16 21:26:29 +0200
committerFolkert de Vries <folkert@folkertdev.nl>2025-06-20 19:09:02 +0200
commita32d0856804e75953144ac5173f06894e55ed846 (patch)
tree20e8411e7651eaba631f354e2370964967d77a79 /tests/codegen
parent8a65ee08296b36342bf7c3cdc15312ccbc357227 (diff)
downloadrust-a32d0856804e75953144ac5173f06894e55ed846.tar.gz
rust-a32d0856804e75953144ac5173f06894e55ed846.zip
error on calls to ABIs that cannot be called
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/naked-asan.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/codegen/naked-asan.rs b/tests/codegen/naked-asan.rs
index 223c41b15bb..46218cf79d6 100644
--- a/tests/codegen/naked-asan.rs
+++ b/tests/codegen/naked-asan.rs
@@ -1,22 +1,28 @@
-// Make sure we do not request sanitizers for naked functions.
+//@ add-core-stubs
+//@ needs-llvm-components: x86
+//@ compile-flags: --target x86_64-unknown-linux-gnu -Zsanitizer=address -Ctarget-feature=-crt-static
 
-//@ only-x86_64
-//@ needs-sanitizer-address
-//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
+// Make sure we do not request sanitizers for naked functions.
 
 #![crate_type = "lib"]
+#![feature(no_core)]
 #![no_std]
+#![no_core]
 #![feature(abi_x86_interrupt)]
 
+extern crate minicore;
+use minicore::*;
+
+#[no_mangle]
 pub fn caller() {
-    page_fault_handler(1, 2);
+    unsafe { asm!("call {}", sym page_fault_handler) }
 }
 
-// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]]
+// CHECK: declare x86_intrcc void @page_fault_handler(){{.*}}#[[ATTRS:[0-9]+]]
 #[unsafe(naked)]
 #[no_mangle]
-pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) {
-    core::arch::naked_asm!("ud2")
+pub extern "x86-interrupt" fn page_fault_handler() {
+    naked_asm!("ud2")
 }
 
 // CHECK: #[[ATTRS]] =