Disable mangling for msvc stack builtins
This prevents linker errors in test builds due to the `jmp` instruction in __alloca
This commit is contained in:
parent
c9bff743cd
commit
aab3a10a9d
|
@ -2,9 +2,13 @@ use core::intrinsics;
|
||||||
|
|
||||||
// NOTE These functions are implemented using assembly because they using a custom
|
// NOTE These functions are implemented using assembly because they using a custom
|
||||||
// calling convention which can't be implemented using a normal Rust function
|
// calling convention which can't be implemented using a normal Rust function
|
||||||
|
|
||||||
|
// NOTE These functions are never mangled as they are not tested against compiler-rt
|
||||||
|
// and mangling ___chkstk would break the `jmp ___chkstk` instruction in __alloca
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[no_mangle]
|
||||||
pub unsafe fn ___chkstk_ms() {
|
pub unsafe fn ___chkstk_ms() {
|
||||||
asm!("push %rcx
|
asm!("push %rcx
|
||||||
push %rax
|
push %rax
|
||||||
|
@ -28,7 +32,7 @@ pub unsafe fn ___chkstk_ms() {
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[no_mangle]
|
||||||
pub unsafe fn __alloca() {
|
pub unsafe fn __alloca() {
|
||||||
asm!("mov %rcx,%rax // x64 _alloca is a normal function with parameter in rcx
|
asm!("mov %rcx,%rax // x64 _alloca is a normal function with parameter in rcx
|
||||||
jmp ___chkstk // Jump to ___chkstk since fallthrough may be unreliable");
|
jmp ___chkstk // Jump to ___chkstk since fallthrough may be unreliable");
|
||||||
|
@ -37,7 +41,7 @@ pub unsafe fn __alloca() {
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[naked]
|
#[naked]
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[no_mangle]
|
||||||
pub unsafe fn ___chkstk() {
|
pub unsafe fn ___chkstk() {
|
||||||
asm!("push %rcx
|
asm!("push %rcx
|
||||||
cmp $$0x1000,%rax
|
cmp $$0x1000,%rax
|
||||||
|
|
Loading…
Reference in New Issue