[PATCH] Accept LLD as a GNU ld compatible linker

Fangrui Song <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
The ELF port of LLD (the LLVM linker) is a drop-in replacement for GNU
ld and is widely used nowadays.

https://reviews.llvm.org/D31199 added a User-Agent style hack to make
libtool recognize lld as a GNU ld compatible linker, but it would be
nice to support the "LLD" version string directly so that LLD can
eventually get rid of the hack.

`ld.lld -v` output:

LLD 11.0.0 (compatible with GNU linkers)
---
 m4/libtool.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index f2d1f398..4e2d8fdf 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3321,7 +3321,7 @@ AC_CACHE_VAL(lt_cv_path_LD,
       # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
+      *GNU* | *'with BFD'* | *LLD*)
 	test no != "$with_gnu_ld" && break
 	;;
       *)
@@ -3361,7 +3361,7 @@ m4_defun([_LT_PATH_LD_GNU],
 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
+*GNU* | *'with BFD'* | *LLD*)
   lt_cv_prog_gnu_ld=yes
   ;;
 *)
-- 
2.26.0.292.g33ef6b2f38-goog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.