[Git][ghc/ghc][wip/hadrian-no-export-dynamic-on-darwin] hadrian: Don't --export-dynamic on Darwin

Ben Gamari gitlab at gitlab.haskell.org
Sat Apr 11 20:23:30 UTC 2020



Ben Gamari pushed to branch wip/hadrian-no-export-dynamic-on-darwin at Glasgow Haskell Compiler / GHC


Commits:
16700ffb by Ben Gamari at 2020-04-11T16:23:07-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/16700ffbf8dd39dfd0ee880ba1c6aff08c051a14

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16700ffbf8dd39dfd0ee880ba1c6aff08c051a14
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/20200411/c55b7ae5/attachment-0001.html>


More information about the ghc-commits mailing list