[PATCH] D77162: libclc: Fix LLVM library linking on Windows

Daniel Stone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 08:39:01 PDT 2020


daniels added a comment.

Thanks for the review!

In D77162#1954860 <https://reviews.llvm.org/D77162#1954860>, @jvesely wrote:

> I think the first part should use `separate_arguments` the same way as `LLVM_CXXFLAGS` does. (you can also add the following change while at it:
>
>   -set( LLVM_CXX_FLAGS ${LLVM_CXX_FLAGS} -fno-rtti -fno-exceptions )
>   +list( APPEND LLVM_CXX_FLAGS -fno-rtti -fno-exceptions )
>


Sure, I didn't know about these. Done and will push later this evening.

> I don't see what the second part is trying to address. Does visual studio not detect the static libraries on the command line? I presume the dynamic versions are not present.
>  If anything it should check `llvm-config --shared-mode` if available instead of checking for win32. Do all visual studio/clang/mingw use the same flag?

Yes, clang runs as `clang-cl` which accepts MSVC-type arguments, though you can also invoke `clang` to pass UNIX-style arguments. For the linker, however, there is no option; `lld-link` only accepts MSVC-type arguments on Windows and nothing else. I don't know what MinGW does. Is there an easy way to test that? Do you currently build on MinGW?

I could test `llvm-config --shared-mode == static && WIN32` to apply `/MT`, as I tried various other methods of convincing Windows to link statically and not dynamically with no luck. On UNIX this isn't an issue as you can happily mix the two modes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77162/new/

https://reviews.llvm.org/D77162





More information about the llvm-commits mailing list