diff options
Diffstat (limited to 'tests/codegen-llvm/naked-asan.rs')
| -rw-r--r-- | tests/codegen-llvm/naked-asan.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/codegen-llvm/naked-asan.rs b/tests/codegen-llvm/naked-asan.rs new file mode 100644 index 00000000000..46218cf79d6 --- /dev/null +++ b/tests/codegen-llvm/naked-asan.rs @@ -0,0 +1,30 @@ +//@ add-core-stubs +//@ needs-llvm-components: x86 +//@ compile-flags: --target x86_64-unknown-linux-gnu -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() { + unsafe { asm!("call {}", sym page_fault_handler) } +} + +// CHECK: declare x86_intrcc void @page_fault_handler(){{.*}}#[[ATTRS:[0-9]+]] +#[unsafe(naked)] +#[no_mangle] +pub extern "x86-interrupt" fn page_fault_handler() { + naked_asm!("ud2") +} + +// CHECK: #[[ATTRS]] = +// CHECK-NOT: sanitize_address +// CHECK: !llvm.module.flags |
