[commit: ghc] master: clarify --no-as-needed is only needed on ELF (13a0d5a)
git at git.haskell.org
git at git.haskell.org
Fri Apr 3 05:33:07 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/13a0d5ac95a80e8b3604e084ae189da405a47270/ghc
>---------------------------------------------------------------
commit 13a0d5ac95a80e8b3604e084ae189da405a47270
Author: Peter Trommler <ptrommler at acm.org>
Date: Fri Apr 3 00:22:59 2015 -0500
clarify --no-as-needed is only needed on ELF
From the code it was not clear that `--no-as-needed` was not necessary
on Windows. Add this fact and describe the fix for #10110 in a separate
note.
See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised
by @thomie.
Reviewed By: thomie
Differential Revision: https://phabricator.haskell.org/D791
GHC Trac Issues: #10110
>---------------------------------------------------------------
13a0d5ac95a80e8b3604e084ae189da405a47270
compiler/main/SysTools.hs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index e6e7fa6..f642213 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -717,6 +717,10 @@ We cache the LinkerInfo inside DynFlags, since clients may link
multiple times. The definition of LinkerInfo is there to avoid a
circular dependency.
+-}
+
+{- Note [ELF needed shared libs]
+
Some distributions change the link editor's default handling of
ELF DT_NEEDED tags to include only those shared objects that are
needed to resolve undefined symbols. For Template Haskell we need
@@ -724,8 +728,10 @@ the last temporary shared library also if it is not needed for the
currently linked temporary shared library. We specify --no-as-needed
to override the default. This flag exists in GNU ld and GNU gold.
--}
+The flag is only needed on ELF systems. On Windows (PE) and Mac OS X
+(Mach-O) the flag is not needed.
+-}
neededLinkArgs :: LinkerInfo -> [Option]
neededLinkArgs (GnuLD o) = o
@@ -763,10 +769,13 @@ getLinkerInfo' dflags = do
-- Set DT_NEEDED for all shared libraries. Trac #10110.
return (GnuLD $ map Option ["-Wl,--hash-size=31",
"-Wl,--reduce-memory-overheads",
+ -- ELF specific flag
+ -- see Note [ELF needed shared libs]
"-Wl,--no-as-needed"])
| any ("GNU gold" `isPrefixOf`) stdo =
-- GNU gold only needs --no-as-needed. Trac #10110.
+ -- ELF specific flag, see Note [ELF needed shared libs]
return (GnuGold [Option "-Wl,--no-as-needed"])
-- Unknown linker.
More information about the ghc-commits
mailing list