summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-02-28 17:36:59 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-07 14:06:16 -0500
commitc9c31c3cf6fbba4c469d493b94634b180146024a (patch)
treeac7c06b3fb341e1fdb31be5701700a2f52d18ced
parent14e900989ce1e2de733fbbcebe853ae363703e3a (diff)
downloadhaskell-c9c31c3cf6fbba4c469d493b94634b180146024a.tar.gz
hadrian: Add little flavour transformer to build stage2 with assertions
This can be useful to build a `perf+assertions` build or even better `default+no_profiled_libs+omit_pragmas+assertions`.
-rw-r--r--hadrian/doc/flavours.md8
-rw-r--r--hadrian/src/Flavour.hs8
2 files changed, 15 insertions, 1 deletions
diff --git a/hadrian/doc/flavours.md b/hadrian/doc/flavours.md
index 9788a0593f..b4b36f556d 100644
--- a/hadrian/doc/flavours.md
+++ b/hadrian/doc/flavours.md
@@ -219,7 +219,9 @@ The supported transformers are listed below:
It is recommended that you use this in conjunction with `no_dynamic_ghc` since
GHC does not support loading of profiled libraries with the
dynamic linker. You should use a flavour that builds profiling libs and rts,
- i.e. not <code>quick</code>.</td>
+ i.e. not <code>quick</code>.
+
+ This flag adds cost centres with the -fprof-late-ccs flag. </td>
</tr>
<tr>
<td><code>no_dynamic_ghc</code></td>
@@ -241,6 +243,10 @@ The supported transformers are listed below:
<td>Build the stage2 libraries with IPE debugging information for use with -hi profiling.</td>
</tr>
<tr>
+ <td><code>assertions</code></td>
+ <td>Build the stage2 compiler with assertions enabled. </td>
+ </tr>
+ <tr>
<td><code>fully_static</code></td>
<td>Produce fully statically-linked executables and build libraries suitable for static linking.</td>
</tr>
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index 5268815f5a..04eddf8e88 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -47,6 +47,7 @@ flavourTransformers = M.fromList
, "ipe" =: enableIPE
, "fully_static" =: fullyStatic
, "collect_timings" =: collectTimings
+ , "assertions" =: enableAssertions
]
where (=:) = (,)
@@ -210,6 +211,13 @@ enableLateCCS =
Right transformer = applySetting kv
in transformer
+-- | Enable assertions for the stage2 compiler
+enableAssertions :: Flavour -> Flavour
+enableAssertions =
+ let Right kv = parseKV "stage1.*.ghc.hs.opts += -DDEBUG"
+ Right transformer = applySetting kv
+ in transformer
+
-- | Produce fully statically-linked executables and build libraries suitable
-- for static linking.
fullyStatic :: Flavour -> Flavour