rust/tests/codegen/naked-fn/aligned.rs
Folkert de Vries 562ec5a6fb disallow asm! in #[naked] functions
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-10-06 18:12:25 +02:00

21 lines
498 B
Rust

//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
//@ needs-asm-support
//@ ignore-arm no "ret" mnemonic
#![crate_type = "lib"]
#![feature(naked_functions, fn_align)]
use std::arch::naked_asm;
// CHECK: Function Attrs: naked
// CHECK-NEXT: define{{.*}}void @naked_empty()
// CHECK: align 16
#[repr(align(16))]
#[no_mangle]
#[naked]
pub unsafe extern "C" fn naked_empty() {
// CHECK-NEXT: start:
// CHECK-NEXT: call void asm
// CHECK-NEXT: unreachable
naked_asm!("ret");
}