diff --git a/src/rt/arch/i386/ccall.S b/src/rt/arch/i386/ccall.S index 76edf84e8d04..a8b89dc6b0f8 100644 --- a/src/rt/arch/i386/ccall.S +++ b/src/rt/arch/i386/ccall.S @@ -1,11 +1,19 @@ - .text +/* + The function for switching to the C stack. It is called + __morestack because gdb allows any frame with that name to + move the stack pointer to a different stack, which it usually + considers an error. +*/ + + .text #if defined(__APPLE__) || defined(_WIN32) -.globl _asm_call_on_stack -_asm_call_on_stack: +.globl ___morestack +___morestack: #else -.globl asm_call_on_stack -asm_call_on_stack: +.globl __morestack +.hidden __morestack +__morestack: #endif #if defined(__linux__) || defined(__APPLE__) diff --git a/src/rt/arch/i386/context.h b/src/rt/arch/i386/context.h index 03b97fa7b517..13775f955107 100644 --- a/src/rt/arch/i386/context.h +++ b/src/rt/arch/i386/context.h @@ -29,7 +29,7 @@ struct registers_t { uint32_t eip; }; -extern "C" void asm_call_on_stack(void *args, void *fn_ptr, uintptr_t stack_ptr); +extern "C" void __morestack(void *args, void *fn_ptr, uintptr_t stack_ptr); class context { public: @@ -57,7 +57,7 @@ public: } void call_shim_on_c_stack(void *args, void *fn_ptr) { - asm_call_on_stack(args, fn_ptr, regs.esp); + __morestack(args, fn_ptr, regs.esp); } }; diff --git a/src/rt/arch/x86_64/ccall.S b/src/rt/arch/x86_64/ccall.S index e74b8677a4a8..c208c7ae6433 100644 --- a/src/rt/arch/x86_64/ccall.S +++ b/src/rt/arch/x86_64/ccall.S @@ -1,3 +1,10 @@ +/* + The function for switching to the C stack. It is called + __morestack because gdb allows any frame with that name to + move the stack pointer to a different stack, which it usually + considers an error. +*/ + #include "regs.h" #define ARG0 RUSTRT_ARG0_S @@ -7,11 +14,13 @@ .text #if defined(__APPLE__) || defined(_WIN32) -.globl _asm_call_on_stack -_asm_call_on_stack: +.globl ___morestack +.private_extern MORESTACK +___morestack: #else -.globl asm_call_on_stack -asm_call_on_stack: +.globl __morestack +.hidden __morestack +__morestack: #endif #if defined(__linux__) || defined(__APPLE__) diff --git a/src/rt/arch/x86_64/context.h b/src/rt/arch/x86_64/context.h index 59d7bfa51f33..75902fd79548 100644 --- a/src/rt/arch/x86_64/context.h +++ b/src/rt/arch/x86_64/context.h @@ -27,7 +27,7 @@ struct registers_t { uint64_t data[RUSTRT_MAX]; }; -extern "C" void asm_call_on_stack(void *args, void *fn_ptr, uintptr_t stack_ptr); +extern "C" void __morestack(void *args, void *fn_ptr, uintptr_t stack_ptr); class context { public: @@ -55,7 +55,7 @@ public: } void call_shim_on_c_stack(void *args, void *fn_ptr) { - asm_call_on_stack(args, fn_ptr, regs.data[RUSTRT_RSP]); + __morestack(args, fn_ptr, regs.data[RUSTRT_RSP]); } }; diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index ff16cde5b189..8353483ebf24 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -73,7 +73,6 @@ upcall_call_shim_on_c_stack upcall_new_stack upcall_del_stack upcall_reset_stack_limit -asm_call_on_stack rust_uv_default_loop rust_uv_loop_new rust_uv_loop_delete