summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2023-01-21 20:38:52 +0900
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-02-14 11:28:29 -0500
commitaa3a262d1537b30c21a8b887385cc538440e7a44 (patch)
tree3805eec3af42fc11738af72c8239c42224ba70b0 /hadrian
parentb9282cf76f237412bae43e37c7a3deccb9fb22a1 (diff)
downloadhaskell-aa3a262d1537b30c21a8b887385cc538440e7a44.tar.gz
Assume platforms support rpaths if they use either ELF or Mach-O
Not only Linux, Darwin, and FreeBSD support rpaths. Determine the usability of rpaths based on the object format, not on OS.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Oracles/Setting.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
index 462d289cd0..d8492dbe94 100644
--- a/hadrian/src/Oracles/Setting.hs
+++ b/hadrian/src/Oracles/Setting.hs
@@ -272,20 +272,28 @@ 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
+-- | List of OSes that use the ELF object format.
+elfOSes :: [String]
+elfOSes =
[ "linux", "freebsd", "dragonfly", "openbsd", "netbsd", "solaris2", "kfreebsdgnu"
, "haiku", "linux-android"
]
+-- | List of OSes that use the Mach-O object format.
+machoOSes :: [String]
+machoOSes = [ "darwin" ]
+
+-- | Check whether the target OS uses the ELF object format.
+isElfTarget :: Action Bool
+isElfTarget = anyTargetOs elfOSes
+
-- | Check whether the host OS supports the @-rpath@ linker option when
-- using dynamic linking.
--
-- TODO: Windows supports lazy binding (but GHC doesn't currently support
-- dynamic way on Windows anyways).
hostSupportsRPaths :: Action Bool
-hostSupportsRPaths = anyHostOs ["linux", "darwin", "freebsd"]
+hostSupportsRPaths = anyHostOs (elfOSes ++ machoOSes)
-- | Check whether the target supports GHCi.
ghcWithInterpreter :: Action Bool