Skip to content

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

Closed
llvmbot wants to merge 2 commits into
llvm:release/21.xfrom
llvmbot:issue140381
Closed

release/21.x: [CMake][Release] Build with -ffat-lto-objects (#140381)#151245
llvmbot wants to merge 2 commits into
llvm:release/21.xfrom
llvmbot:issue140381

Conversation

@llvmbot

@llvmbot llvmbot commented Jul 29, 2025

Copy link
Copy Markdown
Member

Backport cff9ae7

Requested by: @tstellar

@llvmbot

llvmbot commented Jul 29, 2025

Copy link
Copy Markdown
Member Author

@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

llvmbot commented Jul 29, 2025

Copy link
Copy Markdown
Member Author

@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

nikic commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

Looks like the release binaries jobs are failing.

@tstellar

Copy link
Copy Markdown
Contributor

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.

@tru

tru commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

How do we want to handle this? Some of the errors looks just like it could be fixed with a rebuild?

@tru tru moved this from Needs Triage to Needs Review in LLVM Release Status Aug 5, 2025
@tru

tru commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

ping @tstellar

@tru

tru commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

Ping - do we still want to include this in 21.x?

@tstellar

Copy link
Copy Markdown
Contributor

Yes, I think we should. This will help reduce the size of the binary packages.

@tstellar

Copy link
Copy Markdown
Contributor

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.

@dyung

dyung commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Ping. Can we get an update/review @nikic and/or @tstellar?

@nikic nikic moved this from Needs Review to Won't Merge in LLVM Release Status Dec 23, 2025
@nikic

nikic commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

Closing this as the last LLVM 21 release has already happened.

@nikic nikic closed this Dec 23, 2025
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: Won't Merge

Development

Successfully merging this pull request may close these issues.

5 participants