Skip to content

release/21.x: [CMake][Release] Build with -ffat-lto-objects (#140381) #151245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release/21.x
Choose a base branch
from

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Jul 29, 2025

Backport cff9ae7

Requested by: @tstellar

@llvmbot
Copy link
Member Author

llvmbot commented Jul 29, 2025

@nikic What do you think about merging this PR to the release branch?

@llvmbot llvmbot requested a review from nikic July 29, 2025 22:40
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 29, 2025
@llvmbot
Copy link
Member Author

llvmbot commented Jul 29, 2025

@llvm/pr-subscribers-clang

Author: None (llvmbot)

Changes

Backport cff9ae7

Requested by: @tstellar


Full diff: https://github.com/llvm/llvm-project/pull/151245.diff

2 Files Affected:

  • (modified) clang/cmake/caches/Release.cmake (+5-1)
  • (added) clang/cmake/caches/release_cpack_pre_build_strip_lto.cmake (+5)
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()

@nikic
Copy link
Contributor

nikic commented Jul 30, 2025

Looks like the release binaries jobs are failing.

@tstellar
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

3 participants