[cfe-dev] Unable to use LLD?

Peter Smith via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 13 07:42:45 PDT 2019


On Wed, 13 Mar 2019 at 14:01, Shriramana Sharma via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> On Wed, Mar 13, 2019 at 7:20 PM Shriramana Sharma <samjnaa at gmail.com> wrote:
> > $ clang-9 -fuse-ld=ld.lld-9 -o hello hello.c
> > clang: error: invalid linker name in argument '-fuse-ld=ld.lld-9'
>
> Curiously:
>
> $ clang-9 -fuse-ld=lld -o hello hello.c
> $ ./hello
> Hello!
> $ readelf --string-dump .comment hello
> String dump of section '.comment':
>   [     0]  Linker: LLD 9.0.0
>
> Why is it a problem if I give the explicit linker with version? I had
> rather suspected that it would use some other default lld on my system
> which is why I was hypercorrecting…
>

The -fuse-ld=<linker> accepts three forms, the first is one of the
recognised linkers lld, gold and bfd. The driver prefixes this with
"ld." to make ld.lld, ld.gold and ld.bfd. The second form is the
absolute path to the linker, the third is ld (the default system
linker). In your case I think the driver did not interpret ld.lld-9 as
an absolute path.

It is an open question as to whether clang-9 should actually look for
a matching ld.lld-9 rather than ld.lld . There is always the
possibility that this will break someones expectations though. See
https://bugs.llvm.org/show_bug.cgi?id=40659 for an example of ld.lld
matching something other than a symlink to ld.lld-9.

Peter



> --
> Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा 𑀰𑁆𑀭𑀻𑀭𑀫𑀡𑀰𑀭𑁆𑀫𑀸
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list