about summary refs log tree commit diff
path: root/src/rt/arch
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-12-19 19:50:52 -0800
committerBrian Anderson <banderson@mozilla.com>2011-12-19 22:05:40 -0800
commit05bf105c90e7f0dee866fb15f6616afe25fe209f (patch)
treed79c145430f5351ca96c8b5405e7fabbe34fade3 /src/rt/arch
parentf302b79d61165641fb090986a607d8d7e6c317c8 (diff)
rt: Rename asm_call_on_stack to __morestack
Newer gdb's will backtrace through functions named __morestack even
if they change the stack.
Diffstat (limited to 'src/rt/arch')
-rw-r--r--src/rt/arch/i386/ccall.S18
-rw-r--r--src/rt/arch/i386/context.h4
-rw-r--r--src/rt/arch/x86_64/ccall.S17
-rw-r--r--src/rt/arch/x86_64/context.h4
4 files changed, 30 insertions, 13 deletions
diff --git a/src/rt/arch/i386/ccall.S b/src/rt/arch/i386/ccall.S
index 76edf84e8d0..a8b89dc6b0f 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 03b97fa7b51..13775f95510 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 e74b8677a4a..c208c7ae643 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 59d7bfa51f3..75902fd7954 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]);
     }
 };