summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-11 15:05:20 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-22 12:39:38 -0500
commitd4d95e51a463e539fceb1c6f191e84adaa337e3b (patch)
tree691cf2ebf8cbc3d7bf84633fa9117afa8127cca0 /hadrian/src
parent179d0becd2ddfa216f7b221df9fc520a352fdbe7 (diff)
downloadhaskell-d4d95e51a463e539fceb1c6f191e84adaa337e3b.tar.gz
hadrian: Add profiled_ghc and no_dynamic_ghc modifiers
Diffstat (limited to 'hadrian/src')
-rw-r--r--hadrian/src/Flavour.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs
index 6c68df21ff..a7a32ed634 100644
--- a/hadrian/src/Flavour.hs
+++ b/hadrian/src/Flavour.hs
@@ -9,6 +9,8 @@ module Flavour
, enableThreadSanitizer
, enableDebugInfo, enableTickyGhc
, viaLlvmBackend
+ , enableProfiledGhc
+ , disableDynamicGhcPrograms
) where
import Expression
@@ -86,6 +88,8 @@ flavourTransformers = M.fromList
, "split_sections" =: splitSections
, "thread_sanitizer" =: enableThreadSanitizer
, "llvm" =: viaLlvmBackend
+ , "profiled_ghc" =: enableProfiledGhc
+ , "no_dynamic_ghc" =: disableDynamicGhcPrograms
]
where (=:) = (,)
@@ -197,3 +201,13 @@ enableThreadSanitizer = addArgs $ mconcat
-- | Use the LLVM backend in stages 1 and later.
viaLlvmBackend :: Flavour -> Flavour
viaLlvmBackend = addArgs $ notStage0 ? builder Ghc ? arg "-fllvm"
+
+-- | Build the GHC executable with profiling enabled. It is also recommended
+-- that you use this with @'dynamicGhcPrograms' = False@ since GHC does not
+-- support loading of profiled libraries with the dynamically-linker.
+enableProfiledGhc :: Flavour -> Flavour
+enableProfiledGhc flavour = flavour { ghcProfiled = True }
+
+-- | Disable 'dynamicGhcPrograms'.
+disableDynamicGhcPrograms :: Flavour -> Flavour
+disableDynamicGhcPrograms flavour = flavour { dynamicGhcPrograms = pure False }