Commit bec76733 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

Fix GhcThreaded setting

This adopts a patch from NetBSD's packaging fixing the `GhcThreaded`
option of the make build system. In addition we introduce a `ghcThreaded`
option in hadrian's `Flavour` type.

Also fix Hadrian's treatment of the `Use Threaded` entry in `settings`.
Previously it would incorrectly claim `Use Threaded = True` if we were
building the `threaded` runtime way. However, this is inconsistent with
the `make` build system, which defines it to be whether the `ghc`
executable is linked against the threaded runtime.

Fixes #17692.
parent 88bf81aa
Pipeline #15554 failed with stages
in 477 minutes and 7 seconds
......@@ -61,7 +61,13 @@ ifeq "$(GhcThreaded)" "YES"
# Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
ghc_stage2_MORE_HC_OPTS += -threaded
ghc_stage3_MORE_HC_OPTS += -threaded
else
# Opt out from threaded GHC. See ghc-bin.cabal.in
ghc_stage2_CONFIGURE_OPTS += -f-threaded
ghc_stage3_CONFIGURE_OPTS += -f-threaded
endif
# Stage-0 compiler isn't guaranteed to have a threaded RTS.
ghc_stage1_CONFIGURE_OPTS += -f-threaded
ifeq "$(GhcProfiled)" "YES"
ghc_stage2_PROGRAM_WAY = p
......
......@@ -35,6 +35,8 @@ data Flavour = Flavour {
ghcProfiled :: Bool,
-- | Build GHC with debug information.
ghcDebugged :: Bool
-- | Build the GHC executable against the threaded runtime system.
ghcThreaded :: Bool,
-- | Whether to build docs and which ones
-- (haddocks, user manual, haddock manual)
ghcDocs :: Action DocTargets }
......
......@@ -39,6 +39,8 @@ data Flavour = Flavour {
ghcProfiled :: Bool,
-- | Build GHC with debugging assertions.
ghcDebugged :: Bool,
-- | Build the GHC executable against the threaded runtime system.
ghcThreaded :: Bool,
-- | Whether to build docs and which ones
-- (haddocks, user manual, haddock manual)
ghcDocs :: Action DocTargets }
......
......@@ -320,7 +320,7 @@ generateSettings = do
, ("Tables next to code", expr $ yesNo <$> flag TablesNextToCode)
, ("Leading underscore", expr $ yesNo <$> flag LeadingUnderscore)
, ("Use LibFFI", expr $ yesNo <$> useLibFFIForAdjustors)
, ("Use Threads", yesNo . any (wayUnit Threaded) <$> getRtsWays)
, ("Use Threads", expr $ yesNo . ghcThreaded <$> flavour)
, ("Use Debugging", expr $ yesNo . ghcDebugged <$> flavour)
, ("RTS expects libdw", yesNo <$> getFlag WithLibdw)
]
......
......@@ -215,6 +215,7 @@ defaultFlavour = Flavour
, ghciWithDebugger = False
, ghcProfiled = False
, ghcDebugged = False
, ghcThreaded = True
, ghcDocs = cmdDocsArgs }
-- | Default logic for determining whether to build
......
......@@ -96,7 +96,9 @@ packageArgs = do
-- the 'threaded' flag is True by default, but
-- let's record explicitly that we link all ghc
-- executables with the threaded runtime.
, arg "threaded" ] ]
, stage0 ? arg "-threaded"
, notStage0 ? ifM (ghcThreaded <$> expr flavour) (arg "threaded") (arg "-threaded") ]
]
-------------------------------- ghcPkg --------------------------------
, package ghcPkg ?
......
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