1 // compile-flags: -C no-prepopulate-passes -Zcf-protection=full
2 // assembly-output: emit-asm
7 #![feature(naked_functions)]
10 // The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",
11 // meaning "no prologue whatsoever, no, really, not one instruction."
12 // Unfortunately, x86's control-flow enforcement, specifically indirect branch protection,
13 // works by using an instruction for each possible landing site,
14 // and LLVM implements this via making sure of that.
17 pub unsafe extern "sysv64" fn will_halt() -> ! {
18 // CHECK-NOT: endbr{{32|64}}
20 asm!("hlt", options(noreturn))
23 // what about aarch64?
24 // "branch-protection"=false