llvm.org GIT mirror llvm / 603d3c6
Re-apply r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold." All known cache-related bugs observed when self hosting have been fixed (r296907 and r297853). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297854 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 3 years ago
1 changed file(s) with 14 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
714714 if(NOT LINKER_IS_LLD_LINK)
715715 append("-flto=thin" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
716716 endif()
717 # On darwin, enable the lto cache. This improves initial build time a little
718 # since we re-link a lot of the same objects, and significantly improves
719 # incremental build time.
720 append_if(APPLE "-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
721 CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
717 # If the linker supports it, enable the lto cache. This improves initial build
718 # time a little since we re-link a lot of the same objects, and significantly
719 # improves incremental build time.
720 # FIXME: We should move all this logic into the clang driver.
721 if(APPLE)
722 append("-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
723 CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
724 elseif(UNIX AND LLVM_USE_LINKER STREQUAL "lld")
725 append("-Wl,--thinlto-cache-dir=${PROJECT_BINARY_DIR}/lto.cache"
726 CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
727 elseif(LLVM_USE_LINKER STREQUAL "gold")
728 append("-Wl,--plugin-opt,cache-dir=${PROJECT_BINARY_DIR}/lto.cache"
729 CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
730 endif()
722731 elseif(uppercase_LLVM_ENABLE_LTO STREQUAL "FULL")
723732 append("-flto=full" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
724733 if(NOT LINKER_IS_LLD_LINK)