diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-10-15 12:02:17 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-17 22:04:02 -0400 |
commit | a91dcb669b3b221c51e8ba8bb85b7ae9806bc4ca (patch) | |
tree | a0fa29c621e5f571fd4d0af9ed04e80ab1d9524d | |
parent | 0b995759ae2ba2161097a1c43efc650ccbce0276 (diff) | |
download | haskell-a91dcb669b3b221c51e8ba8bb85b7ae9806bc4ca.tar.gz |
Don't get host RTS ways via settings (#18651)
To correctly perform a linking hack for Windows we need to link with the
RTS GHC is currently using. We used to query the RTS ways via the
"settings" file but it is fragile (#18651). The hack hasn't been fixed
to take into account all the ways (Tracing) and it makes linking of GHC
with another RTS more difficult (we need to link with another RTS and to
regenerate the settings file).
So this patch uses the ways reported by the RTS itself
(GHC.Platform.Ways.hostWays) instead of the "settings" file.
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Platform.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Settings.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Settings/IO.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/SysTools.hs | 14 | ||||
-rw-r--r-- | hadrian/src/Rules/Generate.hs | 3 | ||||
-rw-r--r-- | includes/ghc.mk | 6 |
7 files changed, 5 insertions, 32 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index ed29aa812c..4c3052d023 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -131,8 +131,6 @@ module GHC.Driver.Session ( sGhcWithSMP, sGhcRTSWays, sLibFFI, - sGhcThreaded, - sGhcDebugged, sGhcRtsWithLibdw, GhcNameVersion(..), FileSettings(..), diff --git a/compiler/GHC/Platform.hs b/compiler/GHC/Platform.hs index 56a18e9c88..856903bbd1 100644 --- a/compiler/GHC/Platform.hs +++ b/compiler/GHC/Platform.hs @@ -209,8 +209,6 @@ data PlatformMisc = PlatformMisc , platformMisc_ghcWithSMP :: Bool , platformMisc_ghcRTSWays :: String , platformMisc_libFFI :: Bool - , platformMisc_ghcThreaded :: Bool - , platformMisc_ghcDebugged :: Bool , platformMisc_ghcRtsWithLibdw :: Bool , platformMisc_llvmTarget :: String } diff --git a/compiler/GHC/Settings.hs b/compiler/GHC/Settings.hs index 8258cb1d72..a26478d3d0 100644 --- a/compiler/GHC/Settings.hs +++ b/compiler/GHC/Settings.hs @@ -61,8 +61,6 @@ module GHC.Settings , sGhcWithSMP , sGhcRTSWays , sLibFFI - , sGhcThreaded - , sGhcDebugged , sGhcRtsWithLibdw ) where @@ -276,9 +274,5 @@ sGhcRTSWays :: Settings -> String sGhcRTSWays = platformMisc_ghcRTSWays . sPlatformMisc sLibFFI :: Settings -> Bool sLibFFI = platformMisc_libFFI . sPlatformMisc -sGhcThreaded :: Settings -> Bool -sGhcThreaded = platformMisc_ghcThreaded . sPlatformMisc -sGhcDebugged :: Settings -> Bool -sGhcDebugged = platformMisc_ghcDebugged . sPlatformMisc sGhcRtsWithLibdw :: Settings -> Bool sGhcRtsWithLibdw = platformMisc_ghcRtsWithLibdw . sPlatformMisc diff --git a/compiler/GHC/Settings/IO.hs b/compiler/GHC/Settings/IO.hs index 792937bd19..cd1c210ee7 100644 --- a/compiler/GHC/Settings/IO.hs +++ b/compiler/GHC/Settings/IO.hs @@ -155,8 +155,6 @@ initSettings top_dir = do ghcWithSMP <- getBooleanSetting "Support SMP" ghcRTSWays <- getSetting "RTS ways" useLibFFI <- getBooleanSetting "Use LibFFI" - ghcThreaded <- getBooleanSetting "Use Threads" - ghcDebugged <- getBooleanSetting "Use Debugging" ghcRtsWithLibdw <- getBooleanSetting "RTS expects libdw" return $ Settings @@ -225,8 +223,6 @@ initSettings top_dir = do , platformMisc_ghcWithSMP = ghcWithSMP , platformMisc_ghcRTSWays = ghcRTSWays , platformMisc_libFFI = useLibFFI - , platformMisc_ghcThreaded = ghcThreaded - , platformMisc_ghcDebugged = ghcDebugged , platformMisc_ghcRtsWithLibdw = ghcRtsWithLibdw , platformMisc_llvmTarget = llvmTarget } diff --git a/compiler/GHC/SysTools.hs b/compiler/GHC/SysTools.hs index 9e4a277957..ee1940c332 100644 --- a/compiler/GHC/SysTools.hs +++ b/compiler/GHC/SysTools.hs @@ -244,15 +244,11 @@ linkDynLib dflags0 o_files dep_packages -- 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 platformMisc_ghcThreaded $ platformMisc dflags0 - then addWay' WayThreaded dflags0 - else dflags0 - win_dflags = if platformMisc_ghcDebugged $ platformMisc dflags1 - then addWay' WayDebug dflags1 - else dflags1 - - dflags | OSMinGW32 <- os = win_dflags - | otherwise = dflags0 + dflags | OSMinGW32 <- os + , hostWays `hasWay` WayDyn + = dflags0 { ways = hostWays } + | otherwise + = dflags0 verbFlags = getVerbFlags dflags o_file = outputFile dflags diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index 03e1649cde..aabcde2438 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -9,7 +9,6 @@ import Data.Foldable (for_) import Base import qualified Context import Expression -import Flavour import Hadrian.Oracles.TextFile (lookupValueOrError) import Oracles.Flag import Oracles.ModuleFiles @@ -338,8 +337,6 @@ generateSettings = do , ("Tables next to code", expr $ yesNo <$> flag TablesNextToCode) , ("Leading underscore", expr $ yesNo <$> flag LeadingUnderscore) , ("Use LibFFI", expr $ yesNo <$> useLibFFIForAdjustors) - , ("Use Threads", expr $ yesNo . ghcThreaded <$> flavour) - , ("Use Debugging", expr $ yesNo . ghcDebugged <$> flavour) , ("RTS expects libdw", yesNo <$> getFlag WithLibdw) ] let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" diff --git a/includes/ghc.mk b/includes/ghc.mk index 08e865b926..98c154bfb6 100644 --- a/includes/ghc.mk +++ b/includes/ghc.mk @@ -263,12 +263,6 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/. @echo ',("Tables next to code", "$(TablesNextToCode)")' >> $@ @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Use LibFFI", "$(UseLibFFIForAdjustors)")' >> $@ -# 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 ",(\"Use Threads\", \"$(GhcThreaded)\")" >> $@ - @echo ",(\"Use Debugging\", \"$(GhcDebugged)\")" >> $@ @echo ",(\"RTS expects libdw\", \"$(GhcRtsWithLibdw)\")" >> $@ @echo "]" >> $@ |