From 1720bc2e81c274b463d84bec7484dbc5da87333f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 5 Dec 2011 12:10:55 -0800 Subject: [PATCH] rt: Unwind through __morestack on 32-bit linux --- src/rt/arch/i386/morestack.S | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/rt/arch/i386/morestack.S b/src/rt/arch/i386/morestack.S index 5ed305d9590..7b5446ae235 100644 --- a/src/rt/arch/i386/morestack.S +++ b/src/rt/arch/i386/morestack.S @@ -46,9 +46,25 @@ #if defined(__linux__) || defined(__APPLE__) MORESTACK: +#ifdef __linux__ + .cfi_startproc + + // Some magic that explains to the unwinder the unusal nature + // of this stack frame. Copied verbatim from libgcc, which + // has comments explaining it. + .cfi_offset 8, 8 + .cfi_escape 0x15, 4, 0x7d +#endif pushl %ebp +#ifdef __linux__ + .cfi_def_cfa_offset 8 + .cfi_offset %ebp, -8 +#endif movl %esp, %ebp +#ifdef __linux__ + .cfi_def_cfa_register %ebp +#endif // FIXME (1226): main is compiled with the split-stack prologue, // causing it to call __morestack, so we have to jump back out @@ -105,7 +121,12 @@ MORESTACK: call UPCALL_CALL_C addl $16,%esp + popl %ebp +#ifdef __linux__ + .cfi_restore %ebp + .cfi_def_cfa %esp, 4 +#endif retl $8 .L$bail: @@ -118,6 +139,9 @@ MORESTACK: jmpl *%edx +#ifdef __linux__ + .cfi_endproc +#endif #else MORESTACK: