[Git][ghc/ghc][master] hadrian: Don't --export-dynamic on Darwin

Marge Bot gitlab at gitlab.haskell.org
Sun Apr 12 15:23:01 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
35799dda by Ben Gamari at 2020-04-12T11:22:50-04:00
hadrian: Don't --export-dynamic on Darwin

When fixing #17962 I neglected to consider that --export-dynamic is only
supported on ELF platforms.

- - - - -


2 changed files:

- hadrian/src/Oracles/Setting.hs
- hadrian/src/Settings/Packages.hs


Changes:

=====================================
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.
 --


=====================================
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 -------------------------------



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/35799dda07813e4c510237290a631d4d11fb92d2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/35799dda07813e4c510237290a631d4d11fb92d2
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200412/fc56f070/attachment-0001.html>


More information about the ghc-commits mailing list