summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadrian/src/Oracles/Setting.hs8
-rw-r--r--hadrian/src/Settings/Packages.hs7
2 files changed, 14 insertions, 1 deletions
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
index ac343fc67e..bd4d239e68 100644
--- a/hadrian/src/Oracles/Setting.hs
+++ b/hadrian/src/Oracles/Setting.hs
@@ -11,6 +11,7 @@ module Oracles.Setting (
-- ** Target platform things
anyTargetPlatform, anyTargetOs, anyTargetArch, anyHostOs,
+ isElfTarget,
ArmVersion(..),
targetArmVersion,
ghcWithInterpreter, useLibFFIForAdjustors
@@ -231,6 +232,13 @@ anyTargetArch = matchSetting TargetArch
anyHostOs :: [String] -> Action Bool
anyHostOs = matchSetting HostOs
+-- | Check whether the target OS uses the ELF object format.
+isElfTarget :: Action Bool
+isElfTarget = anyTargetOs
+ [ "linux", "freebsd", "dragonfly", "openbsd", "netbsd", "solaris2", "kfreebsdgnu"
+ , "haiku", "linux-android"
+ ]
+
-- | Check whether the host OS supports the @-rpath@ linker option when
-- using dynamic linking.
--
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 9337198b99..5d32397252 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -127,7 +127,12 @@ packageArgs = do
-- refer to the RTS. This is harmless if you don't use it (adds a bit
-- of overhead to startup and increases the binary sizes) but if you
-- need it there's no alternative.
- , package iserv ? mconcat
+ --
+ -- The Solaris linker does not support --export-dynamic option. It also
+ -- does not need it since it exports all dynamic symbols by default
+ , package iserv
+ ? expr isElfTarget
+ ? notM (expr $ anyTargetOs ["freebsd", "solaris2"])? mconcat
[ builder (Ghc LinkHs) ? arg "-optl-Wl,--export-dynamic" ]
-------------------------------- haddock -------------------------------