Skip to content
Snippets Groups Projects
Commit 92eed1ed authored by Cheng Shao's avatar Cheng Shao :beach: Committed by Zubin
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.

(cherry picked from commit a6a82cdb)
(cherry picked from commit 7e1f1b07)
parent 1fa9b36b
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ module Oracles.Setting ( ...@@ -5,7 +5,7 @@ module Oracles.Setting (
ToolchainSetting (..), settingsFileSetting, ToolchainSetting (..), settingsFileSetting,
-- * Helpers -- * Helpers
ghcCanonVersion, cmdLineLengthLimit, hostSupportsRPaths, topDirectory, ghcCanonVersion, cmdLineLengthLimit, targetSupportsRPaths, topDirectory,
libsuf, ghcVersionStage, bashPath, targetStage, libsuf, ghcVersionStage, bashPath, targetStage,
-- ** Target platform things -- ** Target platform things
...@@ -184,15 +184,15 @@ anyTargetOs oss = (`elem` oss) <$> queryTargetTarget (archOS_OS . tgtArchOs) ...@@ -184,15 +184,15 @@ anyTargetOs oss = (`elem` oss) <$> queryTargetTarget (archOS_OS . tgtArchOs)
isElfTarget :: Action Bool isElfTarget :: Action Bool
isElfTarget = queryTargetTarget (osElfTarget . archOS_OS . tgtArchOs) 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. -- using dynamic linking.
-- --
-- ROMES:TODO: Whether supports -rpath should be determined by ghc-toolchain -- ROMES:TODO: Whether supports -rpath should be determined by ghc-toolchain
-- --
-- TODO: Windows supports lazy binding (but GHC doesn't currently support -- TODO: Windows supports lazy binding (but GHC doesn't currently support
-- dynamic way on Windows anyways). -- dynamic way on Windows anyways).
hostSupportsRPaths :: Action Bool targetSupportsRPaths :: Action Bool
hostSupportsRPaths = queryHostTarget (\t -> let os = archOS_OS (tgtArchOs t) targetSupportsRPaths = queryTargetTarget (\t -> let os = archOS_OS (tgtArchOs t)
in osElfTarget os || osMachOTarget os) in osElfTarget os || osMachOTarget os)
-- | Check whether the target supports GHCi. -- | Check whether the target supports GHCi.
...@@ -265,4 +265,3 @@ targetStage (Stage0 {}) = getHostTarget ...@@ -265,4 +265,3 @@ targetStage (Stage0 {}) = getHostTarget
targetStage (Stage1 {}) = getTargetTarget targetStage (Stage1 {}) = getTargetTarget
targetStage (Stage2 {}) = getTargetTarget -- the last two only make sense if the target can be executed locally targetStage (Stage2 {}) = getTargetTarget -- the last two only make sense if the target can be executed locally
targetStage (Stage3 {}) = getTargetTarget targetStage (Stage3 {}) = getTargetTarget
...@@ -144,7 +144,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do ...@@ -144,7 +144,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
[ arg "-dynamic" [ arg "-dynamic"
-- TODO what about windows? -- TODO what about windows?
, isLibrary pkg ? pure [ "-shared", "-dynload", "deploy" ] , isLibrary pkg ? pure [ "-shared", "-dynload", "deploy" ]
, hostSupportsRPaths ? mconcat , notStage0 ? targetSupportsRPaths ? mconcat
[ arg ("-optl-Wl,-rpath," ++ rpath) [ arg ("-optl-Wl,-rpath," ++ rpath)
, isProgram pkg ? arg ("-optl-Wl,-rpath," ++ bindistRpath) , isProgram pkg ? arg ("-optl-Wl,-rpath," ++ bindistRpath)
-- The darwin and Windows linkers don't support/require the -zorigin option -- 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