diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs index 2b6347a2be93bc45cfb687df1a819cbc93857ff5..ea91a450fa0cc10f00cb3425c0cf38ae7f2d887f 100644 --- a/hadrian/src/Oracles/Setting.hs +++ b/hadrian/src/Oracles/Setting.hs @@ -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 - diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs index 6ac8de3d5f9e3828bbfb99fa21e9a03db62b62a6..c1b0584c591edff79e9e7a12911e2f3e15e0c488 100644 --- a/hadrian/src/Settings/Builders/Ghc.hs +++ b/hadrian/src/Settings/Builders/Ghc.hs @@ -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