summaryrefslogtreecommitdiff
path: root/rules/distdir-way-opts.mk
diff options
context:
space:
mode:
Diffstat (limited to 'rules/distdir-way-opts.mk')
-rw-r--r--rules/distdir-way-opts.mk12
1 files changed, 12 insertions, 0 deletions
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index acf68823e4..f288d3919e 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -132,6 +132,18 @@ $1_$2_$3_GHC_LD_OPTS += \
else ifeq "$$(TargetOS_CPP)" "darwin"
$1_$2_$3_GHC_LD_OPTS += -optl-Wl,-headerpad_max_install_names
endif
+
+# This is a rather ugly hack to fix dynamically linked GHC on Windows.
+# If GHC is linked with -threaded, then it links against libHSrts_thr.
+# But if base is linked against libHSrts, then both end up getting
+# loaded, and things go wrong. We therefore link the libraries with the
+# same RTS flags that we link GHC with.
+ifeq "$$(GhcThreaded)" "YES"
+$1_$2_$3_GHC_LD_OPTS += -threaded
+endif
+ifeq "$$(GhcDebugged)" "YES"
+$1_$2_$3_GHC_LD_OPTS += -debug
+endif
endif
endif