release/21.x: [CMake][Release] Build with -ffat-lto-objects (#140381)#151245
release/21.x: [CMake][Release] Build with -ffat-lto-objects (#140381)#151245llvmbot wants to merge 2 commits into
Conversation
Fixes llvm#133580 (cherry picked from commit cff9ae7)
|
@nikic What do you think about merging this PR to the release branch? |
|
@llvm/pr-subscribers-clang Author: None (llvmbot) ChangesBackport cff9ae7 Requested by: @tstellar Full diff: https://github.com/llvm/llvm-project/pull/151245.diff 2 Files Affected:
diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index fb12dfcdcb5a5..a523cc561b3f9 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -102,7 +102,7 @@ if (LLVM_RELEASE_ENABLE_LTO)
# FIXME: We can't use LLVM_ENABLE_LTO=Thin here, because it causes the CMake
# step for the libcxx build to fail. CMAKE_INTERPROCEDURAL_OPTIMIZATION does
# enable ThinLTO, though.
- set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON" CACHE STRING "")
+ set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_FATLTO=ON" CACHE STRING "")
endif()
# Stage 1 Common Config
@@ -144,3 +144,7 @@ set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
+if (LLVM_RELEASE_ENABLE_LTO)
+ set_final_stage_var(LLVM_ENABLE_FATLTO "ON" BOOL)
+ set_final_stage_var(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/release_cpack_pre_build_strip_lto.cmake" STRING)
+endif()
diff --git a/clang/cmake/caches/release_cpack_pre_build_strip_lto.cmake b/clang/cmake/caches/release_cpack_pre_build_strip_lto.cmake
new file mode 100644
index 0000000000000..743b64fe00f58
--- /dev/null
+++ b/clang/cmake/caches/release_cpack_pre_build_strip_lto.cmake
@@ -0,0 +1,5 @@
+file(GLOB files ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/lib/*.a)
+
+foreach(file ${files})
+ execute_process(COMMAND ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/bin/llvm-strip --no-strip-all -R .llvm.lto ${file})
+endforeach()
|
|
Looks like the release binaries jobs are failing. |
|
The failures aren't related to this change. The Linux failures are due to test failures which was already happening with -rc1. The MacOS failures are happening because the PR testing uses the free runners and they always timeout before they finish. |
|
How do we want to handle this? Some of the errors looks just like it could be fixed with a rebuild? |
|
ping @tstellar |
|
Ping - do we still want to include this in 21.x? |
|
Yes, I think we should. This will help reduce the size of the binary packages. |
Although, it looks like the builds are failing. I need to investigate that first. |
|
Closing this as the last LLVM 21 release has already happened. |
Backport cff9ae7
Requested by: @tstellar