Skip to content

Commit 3f47913

Browse files
authored
Merge pull request #588 from jeremyd2019/x86-add-__chkstk
Add __chkstk on i686-pc-windows-gnu.
2 parents d8ab794 + a285b0a commit 3f47913

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/x86.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,27 @@ use core::intrinsics;
88
// NOTE These functions are never mangled as they are not tested against compiler-rt
99

1010
intrinsics! {
11+
#[naked]
12+
#[cfg(all(
13+
windows,
14+
target_env = "gnu",
15+
not(feature = "no-asm")
16+
))]
17+
pub unsafe extern "C" fn __chkstk() {
18+
core::arch::asm!(
19+
"jmp __alloca", // Jump to __alloca since fallthrough may be unreliable"
20+
options(noreturn, att_syntax)
21+
);
22+
}
23+
1124
#[naked]
1225
#[cfg(all(
1326
windows,
1427
target_env = "gnu",
1528
not(feature = "no-asm")
1629
))]
1730
pub unsafe extern "C" fn _alloca() {
18-
// _chkstk and _alloca are the same function
31+
// __chkstk and _alloca are the same function
1932
core::arch::asm!(
2033
"push %ecx",
2134
"cmp $0x1000,%eax",

0 commit comments

Comments
 (0)