summaryrefslogtreecommitdiff
path: root/rts/StgCRun.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-02-03 09:27:42 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-14 23:28:20 -0400
commit5b08e0c06e038448a63aa9bd7f163b23d824ba4b (patch)
tree73884eca00d5e6a878e6e4d054d6b74a9a5f1c53 /rts/StgCRun.c
parentd0c3b0696f1ca809ebd83b5fc2c0b911cde38e77 (diff)
downloadhaskell-5b08e0c06e038448a63aa9bd7f163b23d824ba4b.tar.gz
StgCRun: Enable unwinding only on Linux
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.
Diffstat (limited to 'rts/StgCRun.c')
-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) */
);
/*