Repository : http://darcs.haskell.org/ghc.git/
On branch : master https://github.com/ghc/ghc/commit/41e5229c297f9ecad95dbbeeedf9feacdce39751 >--------------------------------------------------------------- commit 41e5229c297f9ecad95dbbeeedf9feacdce39751 Author: Ian Lynagh <[email protected]> Date: Wed May 15 01:53:13 2013 +0100 Link to the right RTS whenever we build a .dll on Windows When GHCi makes temporary DLLs, those also need to be linked against the right RTS, or we won't be able to load them. >--------------------------------------------------------------- compiler/ghc.mk | 16 ++++++++++++++++ compiler/main/DynFlags.hs | 2 +- compiler/main/SysTools.lhs | 18 +++++++++++++++--- rules/distdir-way-opts.mk | 12 ------------ 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 1a032cc..c258bf2 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -117,6 +117,22 @@ ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES" else @echo 'cDYNAMIC_GHC_PROGRAMS = False' >> $@ endif +# Note that GhcThreaded just reflects the Makefile variable setting. +# In particular, the stage1 compiler is never actually compiled with +# -threaded, but it will nevertheless have cGhcThreaded = True. +# The "+RTS --info" output will show what RTS GHC is really using. + @echo 'cGhcThreaded :: Bool' >> $@ +ifeq "$(GhcThreaded)" "YES" + @echo 'cGhcThreaded = True' >> $@ +else + @echo 'cGhcThreaded = False' >> $@ +endif + @echo 'cGhcDebugged :: Bool' >> $@ +ifeq "$(GhcDebugged)" "YES" + @echo 'cGhcDebugged = True' >> $@ +else + @echo 'cGhcDebugged = False' >> $@ +endif @echo done. # ----------------------------------------------------------------------------- diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 7dc0ef6..946f00b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -50,7 +50,7 @@ module DynFlags ( printOutputForUser, printInfoForUser, - Way(..), mkBuildTag, wayRTSOnly, updateWays, + Way(..), mkBuildTag, wayRTSOnly, addWay', updateWays, wayGeneralFlags, wayUnsetGeneralFlags, -- ** Safe Haskell diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index bacd53e..3df1a9c 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -1051,10 +1051,22 @@ linesPlatform xs = #endif linkDynLib :: DynFlags -> [String] -> [PackageId] -> IO () -linkDynLib dflags o_files dep_packages +linkDynLib dflags0 o_files dep_packages = do - let verbFlags = getVerbFlags dflags - let o_file = outputFile dflags + let -- 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. + dflags1 = if cGhcThreaded then addWay' WayThreaded dflags0 + else dflags0 + dflags2 = if cGhcDebugged then addWay' WayDebug dflags1 + else dflags1 + dflags = updateWays dflags2 + + verbFlags = getVerbFlags dflags + o_file = outputFile dflags pkgs <- getPreloadPackagesAnd dflags dep_packages diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 23fdf7b..ecd3aa1 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -140,18 +140,6 @@ $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 _______________________________________________ ghc-commits mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-commits
