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]
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
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.
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).
We will fix the clang driver to invoke the proper alias for lld so that -flavor is unnecessary.