summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadrian/cabal.project6
-rw-r--r--utils/ghc-cabal/ghc.mk3
2 files changed, 9 insertions, 0 deletions
diff --git a/hadrian/cabal.project b/hadrian/cabal.project
index 176d1eef94..d9c329141f 100644
--- a/hadrian/cabal.project
+++ b/hadrian/cabal.project
@@ -1,2 +1,8 @@
packages: ./
../libraries/Cabal/Cabal/
+
+# N.B. Compile with -O0 since this is not a performance-critical executable
+# and the Cabal takes nearly twice as long to build with -O1. See #16817.
+package Cabal
+ optimization: False
+
diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
index 3de7a62798..02e8ccd71a 100644
--- a/utils/ghc-cabal/ghc.mk
+++ b/utils/ghc-cabal/ghc.mk
@@ -52,10 +52,13 @@ $(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/Distribution/*/*/*.hs
$(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/Distribution/*/*.hs)
$(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/Distribution/*.hs)
+# N.B. Compile with -O0 since this is not a performance-critical executable
+# and the Cabal takes nearly twice as long to build with -O1. See #16817.
$(ghc-cabal_DIST_BINARY): $(CABAL_LEXER_DEP) utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/.
"$(GHC)" $(SRC_HC_OPTS) \
$(addprefix -optc, $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)) \
$(addprefix -optl, $(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE0)) \
+ -O0 \
-hide-all-packages \
$(addprefix -package , $(CABAL_BUILD_DEPS)) \
--make utils/ghc-cabal/Main.hs -o $@ \