[clang] [libcxx] [libcxxabi] [libcxx][cmake] Allow using FatLTO in libc++ builds (PR #112277)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 11:25:15 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Paul Kirth (ilovepi)
<details>
<summary>Changes</summary>
We'd like to build libc++ using FatLTO (see https://llvm.org/docs/FatLTO.html
for details). This gives us more control over how libc++ can be consumed
by users of our toolchain, like the Fuchsia SDK.
---
Full diff: https://github.com/llvm/llvm-project/pull/112277.diff
1 Files Affected:
- (modified) clang/cmake/caches/Fuchsia-stage2.cmake (+8)
``````````diff
diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index 5af98c7b3b3fba..e62f29ecbe6f45 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -192,6 +192,10 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL "")
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
+ # Enable FatLTO for Linux and baremetal runtimes
+ set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
+
# Use .build-id link.
list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
endif()
@@ -274,6 +278,10 @@ if(FUCHSIA_SDK)
set(RUNTIMES_${target}+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+ # Enable FatLTO for Fuchsia runtimes
+ set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
+
# Use .build-id link.
list(APPEND RUNTIME_BUILD_ID_LINK "${target}")
endforeach()
``````````
</details>
https://github.com/llvm/llvm-project/pull/112277
More information about the cfe-commits
mailing list