Skip to content
Snippets Groups Projects
Commit b45080a3 authored by Cheng Shao's avatar Cheng Shao
Browse files

hadrian: add the host_fully_static flavour transformer

This commit adds the host_fully_static flavour transformer to hadrian,
which ensures stage0 is fully statically linked while still permitting
stage1 libdir to contain shared libraries. This is intended to be used
by the wasm backend to build portable linux bindists that contain wasm
shared libraries.
parent 775410fd
No related branches found
No related tags found
No related merge requests found
......@@ -299,6 +299,10 @@ The supported transformers are listed below:
<td><code>fully_static</code></td>
<td>Produce fully statically-linked executables and build libraries suitable for static linking.</td>
</tr>
<tr>
<td><code>host_fully_static</code></td>
<td>Ensure host executables are fully static, while still permitting shared target libraries.</td>
</tr>
<tr>
<td><code>collect_timings</code></td>
<td>Collects timings while building the stage2+ compiler by adding the
......
......@@ -60,6 +60,7 @@ flavourTransformers = M.fromList
, "omit_pragmas" =: omitPragmas
, "ipe" =: enableIPE
, "fully_static" =: fullyStatic
, "host_fully_static" =: hostFullyStatic
, "collect_timings" =: collectTimings
, "assertions" =: enableAssertions
, "debug_ghc" =: debugGhc Stage2
......@@ -371,6 +372,23 @@ fullyStatic flavour =
, builder (Ghc LinkHs) ? pure [ "-optl", "-static" ]
]
-- | Ensure stage0 executables and libraries are fully static. Useful
-- for building cross GHC bindists that still contain shared target
-- libraries.
hostFullyStatic :: Flavour -> Flavour
hostFullyStatic flavour =
addArgs staticExec $ disableDynamicGhcPrograms flavour
where
-- Unlike 'fullyStatic', we need to ensure these flags are only
-- applied to host code.
staticExec :: Args
staticExec = stage0 ? mconcat
[
builder (Ghc CompileHs) ? pure [ "-fPIC", "-static" ]
, builder (Ghc CompileCWithGhc) ? pure [ "-fPIC", "-optc", "-static"]
, builder (Ghc LinkHs) ? pure [ "-optl", "-static" ]
]
-- | Build stage2 dependencies with options to enable collection of compiler
-- stats.
collectTimings :: Flavour -> Flavour
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment