summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-04-10 01:24:37 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-12 11:22:50 -0400
commit35799dda07813e4c510237290a631d4d11fb92d2 (patch)
treea1e00fc67a19e6445a4b95f124a838dd29bb8765
parent54ca66a7d30d7f7cfbf3753ebe547f5a20d76b96 (diff)
downloadhaskell-35799dda07813e4c510237290a631d4d11fb92d2.tar.gz
hadrian: Don't --export-dynamic on Darwin
When fixing #17962 I neglected to consider that --export-dynamic is only supported on ELF platforms.
-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 -------------------------------