Add __chkstk on i686-pc-windows-gnu.
libLLVMSupport.a(DynamicLibrary.cpp.obj) references ___chkstk, which is an alias of __alloca in libgcc. This crate provided __alloca, but libgcc's implementation was also pulled in by the linker due to the reference to ___chkstk, causing a multiple definition linker error. Providing that symbol here prevents that. Fixes #585
This commit is contained in:
@@ -8,6 +8,19 @@ use core::intrinsics;
|
|||||||
// NOTE These functions are never mangled as they are not tested against compiler-rt
|
// NOTE These functions are never mangled as they are not tested against compiler-rt
|
||||||
|
|
||||||
intrinsics! {
|
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]
|
#[naked]
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
windows,
|
windows,
|
||||||
@@ -15,7 +28,7 @@ intrinsics! {
|
|||||||
not(feature = "no-asm")
|
not(feature = "no-asm")
|
||||||
))]
|
))]
|
||||||
pub unsafe extern "C" fn _alloca() {
|
pub unsafe extern "C" fn _alloca() {
|
||||||
// _chkstk and _alloca are the same function
|
// __chkstk and _alloca are the same function
|
||||||
core::arch::asm!(
|
core::arch::asm!(
|
||||||
"push %ecx",
|
"push %ecx",
|
||||||
"cmp $0x1000,%eax",
|
"cmp $0x1000,%eax",
|
||||||
|
|||||||
Reference in New Issue
Block a user