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.
This commit is contained in:
Brian Anderson 2011-12-11 16:32:36 -08:00 committed by Graydon Hoare
parent e47f8fc709
commit 3e32f6623c

View File

@ -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