summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-02-03 09:27:42 -0500
committerBen Gamari <ben@well-typed.com>2020-03-31 12:59:14 -0400
commit03fc3a407d70ab9fa40f4b68754397c34a81706c (patch)
tree3ae4c69ef7360fce81837ea26a75b276652bb170
parent4b9c586472bf99425f7bbcf346472d7c54f05028 (diff)
downloadhaskell-wip/refactor-stgcrun-unwinding.tar.gz
StgCRun: Enable unwinding only on Linuxwip/refactor-stgcrun-unwinding
It's broken on macOS due and SmartOS due to assembler differences (#15207) so let's be conservative in enabling it. Also, refactor things to make the intent clearer.
-rw-r--r--rts/StgCRun.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 2600f1e569..55a3bf0c2d 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -29,6 +29,13 @@
#include "PosixSource.h"
#include "ghcconfig.h"
+// Enable DWARF Call-Frame Information (used for stack unwinding) on Linux.
+// This is not supported on Darwin and SmartOS due to assembler differences
+// (#15207).
+#if defined(linux_HOST_OS)
+#define ENABLE_UNWINDING
+#endif
+
#if defined(sparc_HOST_ARCH) || defined(USE_MINIINTERPRETER)
/* include Stg.h first because we want real machine regs in here: we
* have to get the value of R1 back from Stg land to C land intact.
@@ -405,7 +412,7 @@ StgRunIsImplementedInAssembler(void)
"movq %%xmm15,136(%%rax)\n\t"
#endif
-#if !defined(darwin_HOST_OS)
+#if defined(ENABLE_UNWINDING)
/*
* Let the unwinder know where we saved the registers
* See Note [Unwinding foreign exports on x86-64].
@@ -444,7 +451,7 @@ StgRunIsImplementedInAssembler(void)
#error "RSP_DELTA too big"
#endif
"\n\t"
-#endif /* !defined(darwin_HOST_OS) */
+#endif /* defined(ENABLE_UNWINDING) */
/*
* Set BaseReg
@@ -519,7 +526,7 @@ StgRunIsImplementedInAssembler(void)
"i"(RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE
/* rip relative to cfa */)
-#if !defined(darwin_HOST_OS)
+#if defined(ENABLE_UNWINDING)
, "i"((RSP_DELTA & 127) | (128 * ((RSP_DELTA >> 7) > 0)))
/* signed LEB128-encoded delta from rsp - byte 1 */
#if (RSP_DELTA >> 7) > 0
@@ -538,7 +545,7 @@ StgRunIsImplementedInAssembler(void)
#endif
#undef RSP_DELTA
-#endif /* !defined(darwin_HOST_OS) */
+#endif /* defined(ENABLE_UNWINDING) */
);
/*