From 3e32f6623cf89375ad5e07778da614d2b6300778 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 11 Dec 2011 16:32:36 -0800 Subject: [PATCH] rt: Write CFI instructions that (might) work on mac in __morestack The DW_CFA_val_offset_sf instruction doesn't seem to work on mac, even after implementing it in the llvm-mc assembler, so now I'm looking for a different way to communicate the stack pointer adjustment to the unwinder. --- src/rt/arch/x86_64/morestack.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/rt/arch/x86_64/morestack.S b/src/rt/arch/x86_64/morestack.S index 6686071361b..c85f2e142db 100644 --- a/src/rt/arch/x86_64/morestack.S +++ b/src/rt/arch/x86_64/morestack.S @@ -71,6 +71,20 @@ MORESTACK: leaq 16(%rbp), %rax pushq %rax + // During unwinding we want to skip our caller since it's not + // a complete frame and will make the unwinder sad +#if defined(__linux__) + // Don't understand this line + .cfi_offset 16, 0 + // Tell the unwinding where to get the stack pointer for + // our grandparent frame + .cfi_offset %rsp, -24 +#endif + + // Save the grandparent stack pointer for the unwinder + leaq 16(%rbp), %rax + pushq %rax + // FIXME: libgcc also saves rax. not sure if we need to // Save argument registers