Description
When compiling
#[naked]
pub extern fn naked_test(_fubar: u64) {
unsafe { asm!("int3") }
}
The generated assembly includes a prologue with unexpected mov
's (as well as a trailing ret
, already reported in #32487)
Expected behaviour would be to have no prologue (and prevent compilation of a #[naked]
function that is not extern
as this would require implementing an undefined ABI, contrarily to what seems to happen https://is.gd/sQFBIy).
This is treacherous, as it dereferences some memory locations that may not be accessible, as happened to me and led to hours of debugging to finally figure out the compiled function was not the one defined.
cc #32408
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSCategory: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.