diff options
author | Adam Sandberg Ericsson <adam@sandbergericsson.se> | 2020-05-03 11:49:46 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-07 13:56:02 -0400 |
commit | f496c9550098ffaa3bf25a3447c138626d79bae0 (patch) | |
tree | a0be56bcc35f868f33b60bede633707065aec782 /compiler/GHC/SysTools.hs | |
parent | cdfeb3f24f76e8fd30452016676e56fbc827789a (diff) | |
download | haskell-f496c9550098ffaa3bf25a3447c138626d79bae0.tar.gz |
add -flink-rts flag to link the rts when linking a shared or static library #18072
By default we don't link the RTS when linking shared libraries because in the
most usual mode a shared library is an intermediary product, for example a
Haskell library, that will be linked into some executable in the end. So we
wish to defer the RTS flavour to link to the final link.
However sometimes the final product is the shared library, for example when
writing a plugin for some other system, so we do wish the shared library to
link the RTS.
For consistency we also make -staticlib honor this flag and its inversion.
-staticlib currently implies -flink-shared.
Diffstat (limited to 'compiler/GHC/SysTools.hs')
-rw-r--r-- | compiler/GHC/SysTools.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/SysTools.hs b/compiler/GHC/SysTools.hs index ab83b3bf2a..0b71e8ccde 100644 --- a/compiler/GHC/SysTools.hs +++ b/compiler/GHC/SysTools.hs @@ -274,7 +274,9 @@ linkDynLib dflags0 o_files dep_packages pkgs_no_rts = case os of OSMinGW32 -> pkgs - _ -> + _ | gopt Opt_LinkRts dflags -> + pkgs + | otherwise -> filter ((/= rtsUnitId) . unitId) pkgs let pkg_link_opts = let (package_hs_libs, extra_libs, other_flags) = collectLinkOpts dflags pkgs_no_rts in package_hs_libs ++ extra_libs ++ other_flags |