add repr to the allowlist for naked functions, and test that it works
This commit is contained in:
parent
739b1fdb15
commit
c3000ad3ba
@ -516,6 +516,7 @@ fn check_naked(
|
||||
sym::no_mangle,
|
||||
sym::naked,
|
||||
sym::instruction_set,
|
||||
sym::repr,
|
||||
// code generation
|
||||
sym::cold,
|
||||
sym::target_feature,
|
||||
|
20
tests/codegen/naked-fn/aligned.rs
Normal file
20
tests/codegen/naked-fn/aligned.rs
Normal file
@ -0,0 +1,20 @@
|
||||
//@ 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::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
|
||||
asm!("ret", options(noreturn));
|
||||
}
|
Loading…
Reference in New Issue
Block a user