1 // compile-flags: -C no-prepopulate-passes -Zbranch-protection=bti
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, aarch64's "branch target identification" works via hints at landing sites.
13 // LLVM implements this via making sure of that, even for functions with the naked attribute.
14 // So, we must emit an appropriate instruction instead!
17 pub unsafe extern "C" fn _hlt() -> ! {
18 // CHECK-NOT: hint #34
20 asm!("hlt #1", options(noreturn))