[commit: ghc] master: SysTools: Add detection support for LLD linker (6c0db98)

git at git.haskell.org git at git.haskell.org
Mon Jan 22 01:39:58 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6c0db98bc5d1dceb8fa48544532f85d386900e4a/ghc

>---------------------------------------------------------------

commit 6c0db98bc5d1dceb8fa48544532f85d386900e4a
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Jan 21 13:31:29 2018 -0500

    SysTools: Add detection support for LLD linker
    
    I noticed while trying to test against LLVM 5.0 that GHC would throw "Couldn't
    figure out linker information" warnings due to LLD being chosen by configure.
    Adding detection support to silence these is simple enough, let's just do it.


>---------------------------------------------------------------

6c0db98bc5d1dceb8fa48544532f85d386900e4a
 compiler/main/DynFlags.hs      | 1 +
 compiler/main/SysTools/Info.hs | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 77837e6..05d1ec1 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -5481,6 +5481,7 @@ isBmi2Enabled dflags = case platformArch (targetPlatform dflags) of
 data LinkerInfo
   = GnuLD    [Option]
   | GnuGold  [Option]
+  | LlvmLLD  [Option]
   | DarwinLD [Option]
   | SolarisLD [Option]
   | AixLD    [Option]
diff --git a/compiler/main/SysTools/Info.hs b/compiler/main/SysTools/Info.hs
index e9dc685..6b31057 100644
--- a/compiler/main/SysTools/Info.hs
+++ b/compiler/main/SysTools/Info.hs
@@ -96,6 +96,7 @@ https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc.pdf :
 neededLinkArgs :: LinkerInfo -> [Option]
 neededLinkArgs (GnuLD o)     = o
 neededLinkArgs (GnuGold o)   = o
+neededLinkArgs (LlvmLLD o)   = o
 neededLinkArgs (DarwinLD o)  = o
 neededLinkArgs (SolarisLD o) = o
 neededLinkArgs (AixLD o)     = o
@@ -140,6 +141,9 @@ getLinkerInfo' dflags = do
           -- ELF specific flag, see Note [ELF needed shared libs]
           return (GnuGold [Option "-Wl,--no-as-needed"])
 
+        | any ("LLD" `isPrefixOf`) stdo =
+          return (LlvmLLD [])
+
          -- Unknown linker.
         | otherwise = fail "invalid --version output, or linker is unsupported"
 



More information about the ghc-commits mailing list