diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-07-28 13:41:04 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-07-28 13:41:06 -0400 |
commit | 0e3c10160472df082fd3decd98c2489a2f8e68bd (patch) | |
tree | 0fb0045f12ac3aa47431093d122e57383e79a245 /compiler/main/SysTools.hs | |
parent | d08b9ccdf2812e8f8fa34d0c89275deee574524c (diff) | |
download | haskell-0e3c10160472df082fd3decd98c2489a2f8e68bd.tar.gz |
Ensure that we always link against libm
ld.gold is particularly picky that we declare all of our link
dependencies on Nix. See #14022.
Test Plan: Validate on Nix
Reviewers: austin
Subscribers: hvr, rwbarton, thomie
GHC Trac Issues: #14022
Differential Revision: https://phabricator.haskell.org/D3787
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r-- | compiler/main/SysTools.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 3d16124d72..c73e47c16a 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -39,6 +39,9 @@ module SysTools ( Option(..), + -- platform-specifics + libmLinkOpts, + -- frameworks getPkgFrameworkOpts, getFrameworkOpts @@ -1537,6 +1540,7 @@ linkDynLib dflags0 o_files dep_packages runLink dflags ( map Option verbFlags + ++ libmLinkOpts ++ [ Option "-o" , FileOption "" output_fn ] @@ -1556,6 +1560,16 @@ linkDynLib dflags0 o_files dep_packages ++ map Option pkg_link_opts ) +-- | Some platforms require that we explicitly link against @libm@ if any +-- math-y things are used (which we assume to include all programs). See #14022. +libmLinkOpts :: [Option] +libmLinkOpts = +#if defined(HAVE_LIBM) + [Option "-lm"] +#else + [] +#endif + getPkgFrameworkOpts :: DynFlags -> Platform -> [InstalledUnitId] -> IO [String] getPkgFrameworkOpts dflags platform dep_packages | platformUsesFrameworks platform = do |