-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add repr to the allowlist for naked functions, and test that it works
- Loading branch information
1 parent
739b1fd
commit c3000ad
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} |