summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2019-03-12 17:06:04 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-15 10:05:38 -0400
commit4df757729dab0a5be07f111843ed3ca9de6c3771 (patch)
treeac2fd98e92a2ce93c0bb74181845301a241581db
parentd10e23687d166ea6656fe0caf9c6eb2642a61b7b (diff)
downloadhaskell-4df757729dab0a5be07f111843ed3ca9de6c3771.tar.gz
Hadrian: remove unneeded rpaths.
Issue #12770
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs17
1 files changed, 13 insertions, 4 deletions
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 76c44efcad..92f1e68ad6 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -74,8 +74,15 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
dynamic = Dynamic `wayUnit` way
distPath = libPath' -/- distDir
originToLibsDir = makeRelativeNoSysLink originPath distPath
- rpath | darwin = "@loader_path" -/- originToLibsDir
- | otherwise = "$ORIGIN" -/- originToLibsDir
+ rpath
+ -- Programs will end up in the bin dir ($ORIGIN) and will link to
+ -- libraries in the lib dir.
+ | isProgram pkg = metaOrigin -/- originToLibsDir
+ -- libraries will all end up in the lib dir, so just use $ORIGIN
+ | otherwise = metaOrigin
+ where
+ metaOrigin | darwin = "@loader_path"
+ | otherwise = "$ORIGIN"
-- TODO: an alternative would be to generalize by linking with extra
-- bundled libraries, but currently the rts is the only use case. It is
@@ -92,8 +99,10 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
[ arg "-dynamic"
-- TODO what about windows?
, isLibrary pkg ? pure [ "-shared", "-dynload", "deploy" ]
- , hostSupportsRPaths ? arg ("-optl-Wl,-rpath," ++ rpath)
- , hostSupportsRPaths ? arg ("-optl-Wl,-rpath,$ORIGIN")
+ , hostSupportsRPaths ? pure
+ [ "-optl-Wl,-rpath," ++ rpath
+ , "-optl-Wl,-zorigin"
+ ]
]
, arg "-no-auto-link-packages"
, nonHsMainPackage pkg ? arg "-no-hs-main"