Page MenuHomePhabricator

[lld] Accept -flavor FLAVOR anywhere on the command line
AbandonedPublic

Authored by gkm on Mon, May 18, 10:19 PM.

Details

Summary

While developing the new MachO port of lld, we wish to select it via clang -Wl,-flavor,darwinnew .... The compiler driver does not place -Wl,... args at the front of the lld command line, so lld must accept it at locations beyond argv[1]

Diff Detail

Event Timeline

gkm created this revision.Mon, May 18, 10:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMon, May 18, 10:19 PM
gkm added a comment.Mon, May 18, 10:24 PM
This comment was removed by gkm.
grimar added a subscriber: grimar.Tue, May 19, 2:10 AM
gkm updated this revision to Diff 264941.Tue, May 19, 9:07 AM
gkm removed a subscriber: grimar.

Add lld Driver tests

gkm added a subscriber: grimar.Tue, May 19, 9:09 AM

I think the problem here is that we should give thew new Darwin port a symlink like ld.lld, wasm-ld and lld-link.
Then we can teach clang to support -fuse-ld=foobar by locating the executable foobar (not ld.foobar as hard-coded by -fuse-ld=bfd -fuse-ld=gold -fuse-ld=lld) for non-ELF platforms. This requires a clang driver change.

I actually have a GCC patch sitting there for a while. https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543324.html
I need to finish it.

gkm added a comment.Tue, May 19, 10:59 AM

True--this is no substitute for clang integration.
But meanwhile, is there harm in proceeding with this fix?

gkm updated this revision to Diff 264973.Tue, May 19, 11:04 AM

loosen expected output pattern for tests

In D80184#2044576, @gkm wrote:

True--this is no substitute for clang integration.
But meanwhile, is there harm in proceeding with this fix?

There is some little harm. In GNU ld, -flavor means --auxillary lavor.

I think using -Wl,-flavor,* to change the linker is weird. Let's see if -fuse-ld= can be fixed (D80225).

gkm added a comment.Tue, May 19, 12:01 PM

Fair enough.
How shall we name the new MachO lld?

gkm abandoned this revision.Thu, May 28, 3:46 PM

We will fix the clang driver to invoke the proper alias for lld so that -flavor is unnecessary.