Faster linker

Atila Neves atila.neves at gmail.com
Fri Nov 9 15:08:19 UTC 2018


On Friday, 9 November 2018 at 13:28:42 UTC, Joakim wrote:
> On Friday, 9 November 2018 at 12:19:43 UTC, Atila Neves wrote:
>> On Friday, 9 November 2018 at 03:47:09 UTC, Joakim wrote:
>>> On Friday, 9 November 2018 at 02:47:38 UTC, bennygui wrote:
>>>> [...]
>>>
>>> Yes, LDC has the -linker=gold flag, that you can use to pass 
>>> a different linker to your C compiler. Try it with lld, it's 
>>> the fastest of all the linkers.
>>
>> lld mostly produces crashing binaries for me on Linux.
>
> I find that hard to believe, considering Android is switching 
> to it:

To the extent of my knowledge, Android doesn't link D binaries. 
It may well work for C and C++.

I tried symlinking /usr/bin/ld to /usr/bin/ld.lld, and... it 
seems to work now. The last time I tried (6 to 12 months ago? I 
don't remember) it produced crashing binaries most of the time 
for D code.

I guess I should switch for good now then!

> "LLD is now available for testing. AOSP is in the process of 
> switching to using LLD by default and the NDK will follow 
> (timeline unknown). Test LLD in your app by passing 
> -fuse-ld=lld when linking."
> https://github.com/android-ndk/ndk/wiki/Changelog-r18
>
> It may still have bugs though, maybe you can report your 
> problems.
>
> LDC comes with lld built in, available through the 
> `-link-internally` flag that kinke added.

Only in the unreleased 1.13.0 version, and using it in the beta 
yields this:

% ldc2 -link-internally foo.d
lld: error: unknown argument: --no-warn-search-mismatch
lld: error: unable to find library -lrt
lld: error: unable to find library -ldl
lld: error: unable to find library -lpthread
lld: error: unable to find library -lm

Ok, let's look in /usr/lib explicitly then (which shouldn't be 
needed):

% ldc2 -link-internally -L-L/usr/lib foo.d
lld: error: unknown argument: --no-warn-search-mismatch

Not ready for production, then.


More information about the Digitalmars-d mailing list