[PATCH] D30240: enable building with LTO on Windows using clang-cl and lld

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 13:33:52 PST 2017


mehdi_amini added inline comments.


================
Comment at: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake:717
+    append("-flto=thin" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+  endif()
   # On darwin, enable the lto cache. This improves initial build time a little
----------------
rnk wrote:
> mehdi_amini wrote:
> > mehdi_amini wrote:
> > > I don't understand this, this sounds suspicious to me. This is the flag we use to invoke *clang* for the linker step AFAIK, and it is up to clang to not pass the flag down to the lld-link job if not supported. 
> > For instance ld64 on macOS does not accept -flto either, but we still configure -flto here for the link stage invocation and leave up to the clang driver to handle the correct linker invocation.
> On Windows, nobody invokes the compiler to do the link step, except people porting build systems from Unix.
Oh, OK, didn't know that! Nevermind then :)


Repository:
  rL LLVM

https://reviews.llvm.org/D30240





More information about the llvm-commits mailing list