Commit a91dcb66 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

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.
parent 0b995759
...@@ -131,8 +131,6 @@ module GHC.Driver.Session ( ...@@ -131,8 +131,6 @@ module GHC.Driver.Session (
sGhcWithSMP, sGhcWithSMP,
sGhcRTSWays, sGhcRTSWays,
sLibFFI, sLibFFI,
sGhcThreaded,
sGhcDebugged,
sGhcRtsWithLibdw, sGhcRtsWithLibdw,
GhcNameVersion(..), GhcNameVersion(..),
FileSettings(..), FileSettings(..),
......
...@@ -209,8 +209,6 @@ data PlatformMisc = PlatformMisc ...@@ -209,8 +209,6 @@ data PlatformMisc = PlatformMisc
, platformMisc_ghcWithSMP :: Bool , platformMisc_ghcWithSMP :: Bool
, platformMisc_ghcRTSWays :: String , platformMisc_ghcRTSWays :: String
, platformMisc_libFFI :: Bool , platformMisc_libFFI :: Bool
, platformMisc_ghcThreaded :: Bool
, platformMisc_ghcDebugged :: Bool
, platformMisc_ghcRtsWithLibdw :: Bool , platformMisc_ghcRtsWithLibdw :: Bool
, platformMisc_llvmTarget :: String , platformMisc_llvmTarget :: String
} }
...@@ -61,8 +61,6 @@ module GHC.Settings ...@@ -61,8 +61,6 @@ module GHC.Settings
, sGhcWithSMP , sGhcWithSMP
, sGhcRTSWays , sGhcRTSWays
, sLibFFI , sLibFFI
, sGhcThreaded
, sGhcDebugged
, sGhcRtsWithLibdw , sGhcRtsWithLibdw
) where ) where
...@@ -276,9 +274,5 @@ sGhcRTSWays :: Settings -> String ...@@ -276,9 +274,5 @@ sGhcRTSWays :: Settings -> String
sGhcRTSWays = platformMisc_ghcRTSWays . sPlatformMisc sGhcRTSWays = platformMisc_ghcRTSWays . sPlatformMisc
sLibFFI :: Settings -> Bool sLibFFI :: Settings -> Bool
sLibFFI = platformMisc_libFFI . sPlatformMisc sLibFFI = platformMisc_libFFI . sPlatformMisc
sGhcThreaded :: Settings -> Bool
sGhcThreaded = platformMisc_ghcThreaded . sPlatformMisc
sGhcDebugged :: Settings -> Bool
sGhcDebugged = platformMisc_ghcDebugged . sPlatformMisc
sGhcRtsWithLibdw :: Settings -> Bool sGhcRtsWithLibdw :: Settings -> Bool
sGhcRtsWithLibdw = platformMisc_ghcRtsWithLibdw . sPlatformMisc sGhcRtsWithLibdw = platformMisc_ghcRtsWithLibdw . sPlatformMisc
...@@ -155,8 +155,6 @@ initSettings top_dir = do ...@@ -155,8 +155,6 @@ initSettings top_dir = do
ghcWithSMP <- getBooleanSetting "Support SMP" ghcWithSMP <- getBooleanSetting "Support SMP"
ghcRTSWays <- getSetting "RTS ways" ghcRTSWays <- getSetting "RTS ways"
useLibFFI <- getBooleanSetting "Use LibFFI" useLibFFI <- getBooleanSetting "Use LibFFI"
ghcThreaded <- getBooleanSetting "Use Threads"
ghcDebugged <- getBooleanSetting "Use Debugging"
ghcRtsWithLibdw <- getBooleanSetting "RTS expects libdw" ghcRtsWithLibdw <- getBooleanSetting "RTS expects libdw"
return $ Settings return $ Settings
...@@ -225,8 +223,6 @@ initSettings top_dir = do ...@@ -225,8 +223,6 @@ initSettings top_dir = do
, platformMisc_ghcWithSMP = ghcWithSMP , platformMisc_ghcWithSMP = ghcWithSMP
, platformMisc_ghcRTSWays = ghcRTSWays , platformMisc_ghcRTSWays = ghcRTSWays
, platformMisc_libFFI = useLibFFI , platformMisc_libFFI = useLibFFI
, platformMisc_ghcThreaded = ghcThreaded
, platformMisc_ghcDebugged = ghcDebugged
, platformMisc_ghcRtsWithLibdw = ghcRtsWithLibdw , platformMisc_ghcRtsWithLibdw = ghcRtsWithLibdw
, platformMisc_llvmTarget = llvmTarget , platformMisc_llvmTarget = llvmTarget
} }
......
...@@ -244,15 +244,11 @@ linkDynLib dflags0 o_files dep_packages ...@@ -244,15 +244,11 @@ linkDynLib dflags0 o_files dep_packages
-- against libHSrts, then both end up getting loaded, -- against libHSrts, then both end up getting loaded,
-- and things go wrong. We therefore link the libraries -- and things go wrong. We therefore link the libraries
-- with the same RTS flags that we link GHC with. -- with the same RTS flags that we link GHC with.
dflags1 = if platformMisc_ghcThreaded $ platformMisc dflags0 dflags | OSMinGW32 <- os
then addWay' WayThreaded dflags0 , hostWays `hasWay` WayDyn
else dflags0 = dflags0 { ways = hostWays }
win_dflags = if platformMisc_ghcDebugged $ platformMisc dflags1 | otherwise
then addWay' WayDebug dflags1 = dflags0
else dflags1
dflags | OSMinGW32 <- os = win_dflags
| otherwise = dflags0
verbFlags = getVerbFlags dflags verbFlags = getVerbFlags dflags
o_file = outputFile dflags o_file = outputFile dflags
......
...@@ -9,7 +9,6 @@ import Data.Foldable (for_) ...@@ -9,7 +9,6 @@ import Data.Foldable (for_)
import Base import Base
import qualified Context import qualified Context
import Expression import Expression
import Flavour
import Hadrian.Oracles.TextFile (lookupValueOrError) import Hadrian.Oracles.TextFile (lookupValueOrError)
import Oracles.Flag import Oracles.Flag
import Oracles.ModuleFiles import Oracles.ModuleFiles
...@@ -338,8 +337,6 @@ generateSettings = do ...@@ -338,8 +337,6 @@ generateSettings = do
, ("Tables next to code", expr $ yesNo <$> flag TablesNextToCode) , ("Tables next to code", expr $ yesNo <$> flag TablesNextToCode)
, ("Leading underscore", expr $ yesNo <$> flag LeadingUnderscore) , ("Leading underscore", expr $ yesNo <$> flag LeadingUnderscore)
, ("Use LibFFI", expr $ yesNo <$> useLibFFIForAdjustors) , ("Use LibFFI", expr $ yesNo <$> useLibFFIForAdjustors)
, ("Use Threads", expr $ yesNo . ghcThreaded <$> flavour)
, ("Use Debugging", expr $ yesNo . ghcDebugged <$> flavour)
, ("RTS expects libdw", yesNo <$> getFlag WithLibdw) , ("RTS expects libdw", yesNo <$> getFlag WithLibdw)
] ]
let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")" let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")"
......
...@@ -263,12 +263,6 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/. ...@@ -263,12 +263,6 @@ $(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/.
@echo ',("Tables next to code", "$(TablesNextToCode)")' >> $@ @echo ',("Tables next to code", "$(TablesNextToCode)")' >> $@
@echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@
@echo ',("Use LibFFI", "$(UseLibFFIForAdjustors)")' >> $@ @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 ",(\"RTS expects libdw\", \"$(GhcRtsWithLibdw)\")" >> $@
@echo "]" >> $@ @echo "]" >> $@
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment