summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vinokurov <serg.foo@gmail.com>2022-01-05 01:33:06 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-01-10 15:16:49 +0000
commit7dc805ead3540075433c381ca43ccc4ffc91ee60 (patch)
treefab27f65118152474840ffa2163c952c0cf4eeed
parentf583eb8e5e7077f77fba035a454fafd945d4a4ea (diff)
downloadhaskell-7dc805ead3540075433c381ca43ccc4ffc91ee60.tar.gz
Improve detection of lld linker
Newer lld versions may include vendor info in --version output and thus the version string may not start with ‘LLD’. Fixes #20907
-rw-r--r--compiler/GHC/SysTools/Info.hs2
-rw-r--r--m4/find_ld.m42
2 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/SysTools/Info.hs b/compiler/GHC/SysTools/Info.hs
index 12be61ea0b..83a76b9efb 100644
--- a/compiler/GHC/SysTools/Info.hs
+++ b/compiler/GHC/SysTools/Info.hs
@@ -142,7 +142,7 @@ getLinkerInfo' logger dflags = do
-- ELF specific flag, see Note [ELF needed shared libs]
return (GnuGold [Option "-Wl,--no-as-needed"])
- | any ("LLD" `isPrefixOf`) stdo =
+ | any (\line -> "LLD" `isPrefixOf` line || "LLD" `elem` words line) stdo =
return (LlvmLLD $ map Option [ --see Note [ELF needed shared libs]
"-Wl,--no-as-needed"])
diff --git a/m4/find_ld.m4 b/m4/find_ld.m4
index a6b5c9c598..3d4443be54 100644
--- a/m4/find_ld.m4
+++ b/m4/find_ld.m4
@@ -41,6 +41,8 @@ AC_DEFUN([FIND_LD],[
;;
"LLD"*)
FP_CC_LINKER_FLAG_TRY(lld, $2) ;;
+ *" LLD "*)
+ FP_CC_LINKER_FLAG_TRY(lld, $2) ;;
*) AC_MSG_NOTICE([unknown linker version $out]) ;;
esac
if test "z$$2" = "z"; then