Skip to content

Commit cff9ae7

Browse files
authored
[CMake][Release] Build with -ffat-lto-objects (#140381)
Fixes #133580
1 parent d992382 commit cff9ae7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clang/cmake/caches/Release.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ if (LLVM_RELEASE_ENABLE_LTO)
102102
# FIXME: We can't use LLVM_ENABLE_LTO=Thin here, because it causes the CMake
103103
# step for the libcxx build to fail. CMAKE_INTERPROCEDURAL_OPTIMIZATION does
104104
# enable ThinLTO, though.
105-
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON" CACHE STRING "")
105+
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_FATLTO=ON" CACHE STRING "")
106106
endif()
107107

108108
# Stage 1 Common Config
@@ -144,3 +144,7 @@ set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
144144
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
145145

146146
set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
147+
if (LLVM_RELEASE_ENABLE_LTO)
148+
set_final_stage_var(LLVM_ENABLE_FATLTO "ON" BOOL)
149+
set_final_stage_var(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/release_cpack_pre_build_strip_lto.cmake" STRING)
150+
endif()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
file(GLOB files ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/lib/*.a)
2+
3+
foreach(file ${files})
4+
execute_process(COMMAND ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/bin/llvm-strip --no-strip-all -R .llvm.lto ${file})
5+
endforeach()

0 commit comments

Comments
 (0)