[PATCH] D30522: cmake: Configure the ThinLTO cache directory when using ELF lld or gold.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 1 18:46:52 PST 2017
pcc created this revision.
Herald added subscribers: Prazek, mgorny.
https://reviews.llvm.org/D30522
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -715,11 +715,19 @@
if(NOT LINKER_IS_LLD_LINK)
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
- # since we re-link a lot of the same objects, and significantly improves
- # incremental build time.
- append_if(APPLE "-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
- CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+ # If the linker supports it, enable the lto cache. This improves initial build
+ # time a little since we re-link a lot of the same objects, and significantly
+ # improves incremental build time.
+ if(APPLE)
+ append("-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+ elseif(UNIX AND LLVM_USE_LINKER STREQUAL "lld")
+ append("-Wl,--thinlto-cache-dir=${PROJECT_BINARY_DIR}/lto.cache"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+ elseif(LLVM_USE_LINKER STREQUAL "gold")
+ append("-Wl,--plugin-opt,cache-dir=${PROJECT_BINARY_DIR}/lto.cache"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+ endif()
elseif(uppercase_LLVM_ENABLE_LTO STREQUAL "FULL")
append("-flto=full" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
if(NOT LINKER_IS_LLD_LINK)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30522.90269.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170302/df280cae/attachment.bin>
More information about the llvm-commits
mailing list