This is an archive of the discontinued LLVM Phabricator instance.

Clang: Add support for -fuse-ld= in the mingw driver
ClosedPublic

Authored by martell on Jul 9 2015, 3:11 PM.

Details

Reviewers
rnk
Summary

We will still default to ld until such a time lld become a stable release
lld supports arm NT under the machine name "thumb2pe"

Diff Detail

Event Timeline

martell updated this revision to Diff 29400.Jul 9 2015, 3:11 PM
martell retitled this revision from to Support for -fuse-ld= in the mingw-w64 driver.
martell updated this object.
martell added reviewers: yaron.keren, rnk.
martell retitled this revision from Support for -fuse-ld= in the mingw-w64 driver to Clang: Add support for -fuse-ld= in the mingw driver.Jul 9 2015, 3:11 PM
martell added inline comments.Jul 9 2015, 3:14 PM
lib/Driver/Tools.cpp
9034

lld is much better than gnu at linking libraries.
It searches previously passed libs to find missing functions
This is a flaw in binutils that lld have overcome for PECOFF

martell updated this object.Jul 9 2015, 3:15 PM
martell updated this object.
rnk edited edge metadata.Jul 10 2015, 8:41 AM

This uses the old LLD COFF port, which Rui has rewritten in lld-link2. The new linker is way faster, but 32-bit x86 support isn't ready yet and it doesn't understand the GNU linker command line arguments. At the end of the day, we'll want to use the new linker, since it's faster, supports LTO, and new development and bugfixes are happening there.

Give that this will be temporary, do you want to use the old COFF port in the mingw toolchain for now, or try to use the new one?

In D11088#202752, @rnk wrote:

This uses the old LLD COFF port, which Rui has rewritten in lld-link2. The new linker is way faster, but 32-bit x86 support isn't ready yet and it doesn't understand the GNU linker command line arguments. At the end of the day, we'll want to use the new linker, since it's faster, supports LTO, and new development and bugfixes are happening there.

Give that this will be temporary, do you want to use the old COFF port in the mingw toolchain for now, or try to use the new one?

Hi rnk :)

Yes I would like to use the old linker for now as I have prepared a patch set for that to work with gnu mode.
Also the old COFF linker supports Windows on ARM which I think the new one is lacking .

I don't know what way Rui wants to do this but
I think when the new COFF linker supports everything the old one did maybe he can switch the names from within lld itself so that it becomes the default.
Rather than updating clang code to specify the new linker.

martell added a comment.EditedJul 10 2015, 9:44 AM

Just a note.

Technically this patch doesn't actually specify which coff port to use because it specifies "gnu" mode
lld will just error out with unknown emulation mode atm for i386pe i386pep and thumb2pe.
This would be down to us from within lld to specify which one is actually used for each mode

We could if we wanted from within lld use the old coff for arm and the new one for x86 and x86_64

yaron.keren resigned from this revision.Jul 10 2015, 9:52 AM
yaron.keren removed a reviewer: yaron.keren.
yaron.keren added a subscriber: yaron.keren.
rnk accepted this revision.Jul 10 2015, 10:01 AM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jul 10 2015, 10:01 AM

ping!
can someone commit this please? :)