rust/tests/codegen/naked-asan.rs
Folkert de Vries 69a0c64e2b
fix the naked-asan test
we get these declarations

```
; opt level 0
declare x86_intrcc void @page_fault_handler(ptr byval([8 x i8]) align 8, i64) unnamed_addr #1
; opt level > 0
declare x86_intrcc void @page_fault_handler(ptr noalias nocapture noundef byval([8 x i8]) align 8 dereferenceable(8), i64 noundef) unnamed_addr #1
```

The space after `i64` in the original regex made the regex not match for
opt level 0. Removing the space fixes the issue.

```
declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64 {{.*}}){{.*}}#[[ATTRS:[0-9]+]]
```
2024-12-10 21:41:05 +01:00

24 lines
632 B
Rust

// Make sure we do not request sanitizers for naked functions.
//@ only-x86_64
//@ needs-sanitizer-address
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
#![crate_type = "lib"]
#![no_std]
#![feature(abi_x86_interrupt, naked_functions)]
pub fn caller() {
page_fault_handler(1, 2);
}
// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]]
#[naked]
#[no_mangle]
pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) {
unsafe { core::arch::naked_asm!("ud2") };
}
// CHECK: #[[ATTRS]] =
// CHECK-NOT: sanitize_address
// CHECK: !llvm.module.flags