Skip to content
Snippets Groups Projects
Commit a6a82cdb authored by Cheng Shao's avatar Cheng Shao
Browse files

hadrian: use targetSupportsRPaths predicate

This commit changes the hostSupportsRPaths predicate to
targetSupportsRPaths and use that to decide whether to pass
RPATH-related link-time options. It's not applied to stage0, we should
just use the default link-time options of stageBoot ghc.
parent bef94bde
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ module Oracles.Setting (
ToolchainSetting (..), settingsFileSetting,
-- * Helpers
ghcCanonVersion, cmdLineLengthLimit, hostSupportsRPaths, topDirectory,
ghcCanonVersion, cmdLineLengthLimit, targetSupportsRPaths, topDirectory,
libsuf, ghcVersionStage, bashPath, targetStage,
-- ** Target platform things
......@@ -184,15 +184,15 @@ anyTargetOs oss = (`elem` oss) <$> queryTargetTarget (archOS_OS . tgtArchOs)
isElfTarget :: Action Bool
isElfTarget = queryTargetTarget (osElfTarget . archOS_OS . tgtArchOs)
-- | Check whether the host OS supports the @-rpath@ linker option when
-- | Check whether the target OS supports the @-rpath@ linker option when
-- using dynamic linking.
--
-- ROMES:TODO: Whether supports -rpath should be determined by ghc-toolchain
--
-- TODO: Windows supports lazy binding (but GHC doesn't currently support
-- dynamic way on Windows anyways).
hostSupportsRPaths :: Action Bool
hostSupportsRPaths = queryHostTarget (\t -> let os = archOS_OS (tgtArchOs t)
targetSupportsRPaths :: Action Bool
targetSupportsRPaths = queryTargetTarget (\t -> let os = archOS_OS (tgtArchOs t)
in osElfTarget os || osMachOTarget os)
-- | Check whether the target supports GHCi.
......@@ -265,4 +265,3 @@ targetStage (Stage0 {}) = getHostTarget
targetStage (Stage1 {}) = getTargetTarget
targetStage (Stage2 {}) = getTargetTarget -- the last two only make sense if the target can be executed locally
targetStage (Stage3 {}) = getTargetTarget
......@@ -144,7 +144,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
[ arg "-dynamic"
-- TODO what about windows?
, isLibrary pkg ? pure [ "-shared", "-dynload", "deploy" ]
, hostSupportsRPaths ? mconcat
, notStage0 ? targetSupportsRPaths ? mconcat
[ arg ("-optl-Wl,-rpath," ++ rpath)
, isProgram pkg ? arg ("-optl-Wl,-rpath," ++ bindistRpath)
-- The darwin and Windows linkers don't support/require the -zorigin option
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment