diff --git a/src/x86.rs b/src/x86.rs index 5016816e..c348d082 100644 --- a/src/x86.rs +++ b/src/x86.rs @@ -8,6 +8,19 @@ use core::intrinsics; // NOTE These functions are never mangled as they are not tested against compiler-rt intrinsics! { + #[naked] + #[cfg(all( + windows, + target_env = "gnu", + not(feature = "no-asm") + ))] + pub unsafe extern "C" fn __chkstk() { + core::arch::asm!( + "jmp __alloca", // Jump to __alloca since fallthrough may be unreliable" + options(noreturn, att_syntax) + ); + } + #[naked] #[cfg(all( windows, @@ -15,7 +28,7 @@ intrinsics! { not(feature = "no-asm") ))] pub unsafe extern "C" fn _alloca() { - // _chkstk and _alloca are the same function + // __chkstk and _alloca are the same function core::arch::asm!( "push %ecx", "cmp $0x1000,%eax",