[Git][ghc/ghc][master] Don't get host RTS ways via settings (#18651)

Marge Bot gitlab at gitlab.haskell.org
Sun Oct 18 02:04:12 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
a91dcb66 by Sylvain Henry at 2020-10-17T22:04:02-04:00
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.

- - - - -


7 changed files:

- compiler/GHC/Driver/Session.hs
- compiler/GHC/Platform.hs
- compiler/GHC/Settings.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/SysTools.hs
- hadrian/src/Rules/Generate.hs
- includes/ghc.mk


Changes:

=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -131,8 +131,6 @@ module GHC.Driver.Session (
         sGhcWithSMP,
         sGhcRTSWays,
         sLibFFI,
-        sGhcThreaded,
-        sGhcDebugged,
         sGhcRtsWithLibdw,
         GhcNameVersion(..),
         FileSettings(..),


=====================================
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
   }


=====================================
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


=====================================
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
       }


=====================================
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


=====================================
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 ++ ")"


=====================================
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 "]" >> $@
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a91dcb669b3b221c51e8ba8bb85b7ae9806bc4ca

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a91dcb669b3b221c51e8ba8bb85b7ae9806bc4ca
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201017/bd29ef77/attachment-0001.html>


More information about the ghc-commits mailing list