2025-06-16 21:26:29 +02:00
|
|
|
//@ add-core-stubs
|
|
|
|
|
//@ needs-llvm-components: x86
|
|
|
|
|
//@ compile-flags: --target x86_64-unknown-linux-gnu -Zsanitizer=address -Ctarget-feature=-crt-static
|
2024-09-02 15:45:06 +02:00
|
|
|
|
2025-06-16 21:26:29 +02:00
|
|
|
// Make sure we do not request sanitizers for naked functions.
|
2024-09-02 15:45:06 +02:00
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
2025-06-16 21:26:29 +02:00
|
|
|
#![feature(no_core)]
|
2024-09-02 15:45:06 +02:00
|
|
|
#![no_std]
|
2025-06-16 21:26:29 +02:00
|
|
|
#![no_core]
|
2024-12-18 22:05:27 +01:00
|
|
|
#![feature(abi_x86_interrupt)]
|
2024-09-02 15:45:06 +02:00
|
|
|
|
2025-06-16 21:26:29 +02:00
|
|
|
extern crate minicore;
|
|
|
|
|
use minicore::*;
|
|
|
|
|
|
|
|
|
|
#[no_mangle]
|
2024-08-08 10:20:40 +02:00
|
|
|
pub fn caller() {
|
2025-06-16 21:26:29 +02:00
|
|
|
unsafe { asm!("call {}", sym page_fault_handler) }
|
2024-08-08 10:20:40 +02:00
|
|
|
}
|
|
|
|
|
|
2025-06-16 21:26:29 +02:00
|
|
|
// CHECK: declare x86_intrcc void @page_fault_handler(){{.*}}#[[ATTRS:[0-9]+]]
|
2025-03-29 17:30:11 +01:00
|
|
|
#[unsafe(naked)]
|
2024-09-02 15:45:06 +02:00
|
|
|
#[no_mangle]
|
2025-06-16 21:26:29 +02:00
|
|
|
pub extern "x86-interrupt" fn page_fault_handler() {
|
|
|
|
|
naked_asm!("ud2")
|
2024-09-02 15:45:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CHECK: #[[ATTRS]] =
|
|
|
|
|
// CHECK-NOT: sanitize_address
|
2024-09-09 13:29:47 +00:00
|
|
|
// CHECK: !llvm.module.flags
|