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
Pipeline #26449 canceled with stages
......@@ -131,8 +131,6 @@ module GHC.Driver.Session (
sGhcWithSMP,
sGhcRTSWays,
sLibFFI,
sGhcThreaded,
sGhcDebugged,
sGhcRtsWithLibdw,
GhcNameVersion(..),
FileSettings(..),
......
......@@ -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
}
......@@ -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
......@@ -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
}
......
......@@ -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
......
......@@ -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 ++ ")"
......
......@@ -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 "]" >> $@
......
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