[commit: ghc] ghc-8.4: SysTools: Add detection support for LLD linker (2d1f6af)

git at git.haskell.org git at git.haskell.org
Thu Feb 1 04:51:52 UTC 2018


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

On branch  : ghc-8.4
Link       : http://ghc.haskell.org/trac/ghc/changeset/2d1f6af42410e21c5425675213cfd34295139ab9/ghc

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

commit 2d1f6af42410e21c5425675213cfd34295139ab9
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.
    
    (cherry picked from commit 6c0db98bc5d1dceb8fa48544532f85d386900e4a)


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

2d1f6af42410e21c5425675213cfd34295139ab9
 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 552c0b5..5e9003a 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -5478,6 +5478,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