summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2022-02-08 13:08:03 +0900
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-08 10:43:19 -0500
commitbd493ed6a63e41855f90c210f6cf1bace9199cf0 (patch)
treee8d5c298c84e5b0931da11a3210373bbe93335a7
parentb33f0cfabfcace98bb8b77a5bce6c6efba076cf6 (diff)
downloadhaskell-bd493ed6a63e41855f90c210f6cf1bace9199cf0.tar.gz
Don't try to build stage1 with -eventlog if stage0 doesn't provide it
Like -threaded, stage0 isn't guaranteed to have an event-logging RTS.
-rw-r--r--configure.ac11
-rw-r--r--ghc/ghc-bin.cabal.in9
-rw-r--r--ghc/ghc.mk5
-rw-r--r--hadrian/cfg/system.config.in1
-rw-r--r--hadrian/src/Expression.hs8
-rw-r--r--hadrian/src/Oracles/Flag.hs2
-rw-r--r--hadrian/src/Settings/Packages.hs3
-rw-r--r--mk/config.mk.in3
8 files changed, 38 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index cb670a2a14..cf3d586590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -212,13 +212,21 @@ if test "$WithGhc" != ""; then
dnl See Note [Linking ghc-bin against threaded stage0 RTS] in
dnl hadrian/src/Settings/Packages.hs for details.
dnl SMP support which implies a registerised stage0 is also required (see issue 18266)
- if echo ${RTS_WAYS_STAGE0} | grep '.*thr.*' 2>&1 >/dev/null && \
+ if echo ${RTS_WAYS_STAGE0} | tr ' ' '\n' | grep '^thr$' 2>&1 >/dev/null && \
test "$SUPPORT_SMP_STAGE0" = "YES"
then
AC_SUBST(GhcThreadedRts, YES)
else
AC_SUBST(GhcThreadedRts, NO)
fi
+
+ dnl Same for an event-logging RTS.
+ if echo ${RTS_WAYS_STAGE0} | tr ' ' '\n' | grep '^l$' 2>&1 >/dev/null
+ then
+ AC_SUBST(GhcEventLoggingRts, YES)
+ else
+ AC_SUBST(GhcEventLoggingRts, NO)
+ fi
fi
dnl ** Must have GHC to build GHC
@@ -1364,6 +1372,7 @@ echo "\
Bootstrapping using : $WithGhc
which is version : $GhcVersion
with threaded RTS? : $GhcThreadedRts
+ with eventlog RTS? : $GhcEventLoggingRts
"
if test "x$CcLlvmBackend" = "xYES"; then
diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in
index cde0cbcb3e..3a1b4922f6 100644
--- a/ghc/ghc-bin.cabal.in
+++ b/ghc/ghc-bin.cabal.in
@@ -29,6 +29,11 @@ Flag threaded
Default: True
Manual: True
+Flag eventlog
+ Description: Link the ghc executable against the event-logging RTS
+ Default: True
+ Manual: True
+
Executable ghc
Default-Language: Haskell2010
@@ -91,7 +96,9 @@ Executable ghc
if flag(threaded)
ghc-options: -threaded
- ghc-options: -eventlog
+ -- Same for GhcEventLoggingRts
+ if flag(eventlog)
+ ghc-options: -eventlog
Other-Extensions:
CPP
diff --git a/ghc/ghc.mk b/ghc/ghc.mk
index fcfb61f65a..627f4bc13c 100644
--- a/ghc/ghc.mk
+++ b/ghc/ghc.mk
@@ -67,6 +67,11 @@ else
ghc_stage1_CONFIGURE_OPTS += -f-threaded
endif
+# Same for an event-logging RTS.
+ifeq "$(GhcEventLoggingRts)" "NO"
+ghc_stage1_CONFIGURE_OPTS += -f-eventlog
+endif
+
ifeq "$(GhcProfiled)" "YES"
ghc_stage2_PROGRAM_WAY = p
endif
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index 003d9d0029..2f8ebe6713 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -86,6 +86,7 @@ ghc-minor-version = @GhcMinVersion@
ghc-patch-level = @GhcPatchLevel@
bootstrap-threaded-rts = @GhcThreadedRts@
+bootstrap-event-logging-rts = @GhcEventLoggingRts@
supports-this-unit-id = @SUPPORTS_THIS_UNIT_ID@
diff --git a/hadrian/src/Expression.hs b/hadrian/src/Expression.hs
index a70aa75e9d..821b7d5a1e 100644
--- a/hadrian/src/Expression.hs
+++ b/hadrian/src/Expression.hs
@@ -9,8 +9,8 @@ module Expression (
-- ** Predicates
(?), stage, stage0, stage1, stage2, notStage0, threadedBootstrapper,
- package, notPackage, packageOneOf, libraryPackage, builder, way, input,
- inputs, output, outputs,
+ eventLoggingBootstrapper, package, notPackage, packageOneOf,
+ libraryPackage, builder, way, input, inputs, output, outputs,
-- ** Evaluation
interpret, interpretInContext,
@@ -132,6 +132,10 @@ notStage0 = notM stage0
threadedBootstrapper :: Predicate
threadedBootstrapper = expr (flag BootstrapThreadedRts)
+-- | Whether or not the bootstrapping compiler provides an event-logging RTS.
+eventLoggingBootstrapper :: Predicate
+eventLoggingBootstrapper = expr (flag BootstrapEventLoggingRts)
+
-- | Is a certain package /not/ built right now?
notPackage :: Package -> Predicate
notPackage = notM . package
diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs
index 49f670645f..22da18f134 100644
--- a/hadrian/src/Oracles/Flag.hs
+++ b/hadrian/src/Oracles/Flag.hs
@@ -25,6 +25,7 @@ data Flag = ArSupportsAtFile
| HaveLibMingwEx
| UseSystemFfi
| BootstrapThreadedRts
+ | BootstrapEventLoggingRts
| UseLibffiForAdjustors
-- Note, if a flag is set to empty string we treat it as set to NO. This seems
@@ -46,6 +47,7 @@ flag f = do
HaveLibMingwEx -> "have-lib-mingw-ex"
UseSystemFfi -> "use-system-ffi"
BootstrapThreadedRts -> "bootstrap-threaded-rts"
+ BootstrapEventLoggingRts -> "bootstrap-event-logging-rts"
UseLibffiForAdjustors -> "use-libffi-for-adjustors"
value <- lookupValueOrError configFile key
when (value `notElem` ["YES", "NO", ""]) . error $ "Configuration flag "
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 6fc47b05fd..6114661e14 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -85,6 +85,9 @@ packageArgs = do
-- We build a threaded stage N, N>1 if the configuration calls
-- for it.
((ghcThreaded <$> expr flavour) `cabalFlag` "threaded")
+ -- Don't try to build stage 1 with an event-logging RTS if
+ -- the bootstrapping compiler doesn't support it.
+ , orM [notStage0, eventLoggingBootstrapper] `cabalFlag` "eventlog"
]
]
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 9476179606..1559e98ea3 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -169,6 +169,9 @@ GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised
# Whether or not the bootstrapping GHC supplies a threaded RTS.
GhcThreadedRts = @GhcThreadedRts@
+# Whether or not the bootstrapping GHC supplies an event-logging RTS.
+GhcEventLoggingRts = @GhcEventLoggingRts@
+
# Whether to include GHCi in the compiler. Depends on whether the RTS linker
# has support for this OS/ARCH combination.