mstorsjo added a comment.

In https://reviews.llvm.org/D37727#867753, @martell wrote:

> In https://reviews.llvm.org/D37727#867627, @mstorsjo wrote:
>
> > I'm not sure I like this direction. In my setups, a build-time default 
> > isn't right since I'm using the same clang builds for both native-on-linux 
> > building (with the default `ld` as linker) and cross-building targeting 
> > windows (using `ldd`), and keeping the code that reads `-fuse-ld=` is 
> > essential.
>
>
> The `GetLinkerPath` function in `lib/Driver/ToolChain.cpp` that I replaced 
> this with already checks `-fuse-ld` and does everything we need correctly.


Yup, figured it out later after reading it more thorhoughly later.

>> I haven't followed the changes closely on how this works with the build-time 
>> `CLANG_DEFAULT_LINKER`, but can't we just make the current code check this 
>> define if `-fuse-ld` isn't set?
> 
> If you specifically want a toolchain that uses lld by default for MINGW but 
> ld for the platform and or host you should override the `getDefaultLinker` 
> function in the Mingw driver with an out of tree patch.
>  This is now what I do in my own builds since applying this patch.

I do the same by adding `-rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld 
-Qunused-arguments` in the frontend script wrapper (a wrapper named 
`<arch>-w64-mingw32-clang` that just calls `clang -target <arch>-w64-mingw32 
-rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld -Qunused-arguments`.


Repository:
  rL LLVM

https://reviews.llvm.org/D37727



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to