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

Ben Gamari gitlab at gitlab.haskell.org
Fri Dec 4 20:04:09 UTC 2020



Ben Gamari pushed to branch ghc-8.10 at Glasgow Haskell Compiler / GHC


Commits:
391a3f6d by Ben Gamari at 2020-12-04T15:04:01-05:00
hadrian: Don't --export-dynamic on Darwin

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

(cherry picked from commit 35799dda07813e4c510237290a631d4d11fb92d2)

- - - - -


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
@@ -241,6 +242,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
=====================================
@@ -150,7 +150,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/391a3f6d3776a069534a91e34e5915a0c8d0391b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/391a3f6d3776a069534a91e34e5915a0c8d0391b
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/20201204/ccbe4631/attachment-0001.html>


More information about the ghc-commits mailing list