summaryrefslogtreecommitdiff
path: root/compiler/GHC/Linker
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Linker')
-rw-r--r--compiler/GHC/Linker/Dynamic.hs16
-rw-r--r--compiler/GHC/Linker/Static.hs2
2 files changed, 8 insertions, 10 deletions
diff --git a/compiler/GHC/Linker/Dynamic.hs b/compiler/GHC/Linker/Dynamic.hs
index e8c31a1f20..3eca65c6cc 100644
--- a/compiler/GHC/Linker/Dynamic.hs
+++ b/compiler/GHC/Linker/Dynamic.hs
@@ -197,7 +197,8 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages
-------------------------------------------------------------------
let output_fn = case o_file of { Just s -> s; Nothing -> "a.out"; }
- unregisterised = platformUnregisterised (targetPlatform dflags)
+ platform = targetPlatform dflags
+ unregisterised = platformUnregisterised platform
let bsymbolicFlag = -- we need symbolic linking to resolve
-- non-PIC intra-package-relocations for
-- performance (where symbolic linking works)
@@ -206,7 +207,7 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages
runLink logger tmpfs dflags (
map Option verbFlags
- ++ libmLinkOpts
+ ++ libmLinkOpts platform
++ [ Option "-o"
, FileOption "" output_fn
]
@@ -224,13 +225,10 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages
-- | 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
+libmLinkOpts :: Platform -> [Option]
+libmLinkOpts platform
+ | platformHasLibm platform = [Option "-lm"]
+ | otherwise = []
{-
Note [-Bsymbolic assumptions by GHC]
diff --git a/compiler/GHC/Linker/Static.hs b/compiler/GHC/Linker/Static.hs
index c4549d5274..ed67daa347 100644
--- a/compiler/GHC/Linker/Static.hs
+++ b/compiler/GHC/Linker/Static.hs
@@ -197,7 +197,7 @@ linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do
++ [ GHC.SysTools.Option "-o"
, GHC.SysTools.FileOption "" output_fn
]
- ++ libmLinkOpts
+ ++ libmLinkOpts platform
++ map GHC.SysTools.Option (
[]