This is an archive of the discontinued LLVM Phabricator instance.

If lld binary is named 'ld' on darwin, use darwin driver mode
ClosedPublic

Authored by kledzik on Sep 9 2014, 5:36 PM.

Details

Reviewers
ruiu
joerg
Summary

Based on feedback from Joerg, change check so full tool name has to be "ld". Previously, an lld tool named "x86_86-netbsd-ld" on MacOSX would also be forced into using the darwin driver.

I've now generalized this patch so, if lld is built on an ELF system and named "ld", it will behave as the gnu linker. There is two new test cases where lld is copied to "ld". One on Linux and one on Darwin. If other non-linux ELF system want the test to run, they'll need to update test/lit.cfg.

Diff Detail

Event Timeline

kledzik updated this revision to Diff 13506.Sep 9 2014, 5:36 PM
kledzik retitled this revision from to If lld binary is named 'ld' on darwin, use darwin driver mode.
kledzik updated this object.
kledzik edited the test plan for this revision. (Show Details)
kledzik added a reviewer: joerg.
kledzik added a project: lld.
kledzik added a subscriber: Unknown Object (MLST).
ruiu added a subscriber: ruiu.Sep 9 2014, 6:24 PM
ruiu added inline comments.
lib/Driver/UniversalDriver.cpp
162

argv[0] == "ld" means "the default linker driver" only on Darwin? On other platforms it should also mean the default linker, which is gnu ld driver, for the sake of consistency.

Adding support for "ld" on *nix meaning use-gnu-driver is reasonable, but it is an additional feature (which I have no way to test).

What would be the correct way to test for that?

#if LLVM_ON_UNIX && !__APPLE_
ruiu added a comment.Sep 9 2014, 7:09 PM

It's a small feature. You can write it and the buildbots will tell you you did it right :)

I'm not an expert of lit tests. I'd probably write it using shell and uname command with "REQUIRES: shell", but I'm not sure if it's the correct way.

kledzik updated this revision to Diff 13567.Sep 10 2014, 5:02 PM
kledzik updated this object.
ruiu accepted this revision.Sep 10 2014, 5:07 PM
ruiu added a reviewer: ruiu.

LGTM

This revision is now accepted and ready to land.Sep 10 2014, 5:07 PM
kledzik closed this revision.Sep 10 2014, 6:02 PM

committed as r217566