[PATCH] D37727: Driver: Remove custom MinGW linker detection

Martell Malone via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 05:26:04 PDT 2017


martell added a comment.

In https://reviews.llvm.org/D37727#867751, @mstorsjo wrote:

> 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.


I used to do this also but I didn't want to just disable warnings for unused arguments which left me with problems.

The following should work for that if you are happy with it being the default for your linux target also

  -DCLANG_DEFAULT_RTLIB=compiler-rt
  -DCLANG_DEFAULT_CXX_STDLIB=libc++
  -CLANG_DEFAULT_LINKER=lld

Though adding something like this to `Driver/MinGW.h`

  RuntimeLibType GetDefaultRuntimeLibType() const override {
    return RuntimeLibType::RLT_CompilerRT;
  }
  
  CXXStdlibType
  GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
    return ToolChain::CST_Libcxx;
  }
  
  const char *getDefaultLinker() const override {
    return "lld";
  }

should work for what you want more.

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

We posted at roughly the same time so I missed it :)

> Actually, after testing this a bit more and looking at it, I withdraw my earlier complaints - this does indeed seem to work fine with my test setup. The generic `TC.GetLinkerPath()` picks up `-fuse-ld=lld` correctly and converts it into `ld.lld` which should be equivalent to `lld -flavor gnu`, at least in my linux cross compilation setup. And the extra `AddLibGCC()` call doesn't seem harmful for the lld setup.

Great, I'll just wait for reid or peter to approve and merge then.


Repository:
  rL LLVM

https://reviews.llvm.org/D37727





More information about the cfe-commits mailing list