-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Reapply "[Fuchsia][cmake] Allow using FatLTO when building runtimes" (#119252) #121820
Merged
ilovepi
merged 13 commits into
main
from
users/ilovepi/spr/reapply-fuchsiacmake-allow-using-fatlto-when-building-runtimes-119252
Jan 27, 2025
Merged
Reapply "[Fuchsia][cmake] Allow using FatLTO when building runtimes" (#119252) #121820
ilovepi
merged 13 commits into
main
from
users/ilovepi/spr/reapply-fuchsiacmake-allow-using-fatlto-when-building-runtimes-119252
Jan 27, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1
llvmbot
added
cmake
Build system in general and CMake in particular
clang
Clang issues not falling into any other category
labels
Jan 6, 2025
@llvm/pr-subscribers-clang Author: Paul Kirth (ilovepi) ChangesThis version of the patch addresses the rtsan failure and mac build Full diff: https://github.com/llvm/llvm-project/pull/121820.diff 2 Files Affected:
diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index e799900094df37..e8040487728d30 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -190,6 +190,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()
@@ -272,6 +276,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()
@@ -369,6 +377,10 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.
set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
+
+ # Enable FatLTO for baremetal runtimes
+ set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
endforeach()
foreach(target riscv32-unknown-elf)
@@ -420,6 +432,10 @@ foreach(target riscv32-unknown-elf)
set(RUNTIMES_${target}_LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "")
+
+ # Enable FatLTO for baremetal runtimes
+ set(RUNTIMES_${target}_LLVM_ENABLE_LTO ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO ON CACHE BOOL "")
endforeach()
set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index f19125eb6bf273..55a87f5fdbb138 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1285,7 +1285,7 @@ elseif(LLVM_ENABLE_LTO)
endif()
endif()
-if(LLVM_ENABLE_FATLTO AND UNIX AND NOT APPLE)
+if(LLVM_ENABLE_FATLTO AND ((UNIX AND NOT APPLE) OR FUCHSIA))
append("-ffat-lto-objects" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
if(NOT LINKER_IS_LLD_LINK)
append("-ffat-lto-objects" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS)
|
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1 [skip ci]
Created using spr 1.3.6-beta.1
@petrhosek I assume we're good to reland this now that the RTSan and libunwind build fixes are in? |
ilovepi
changed the base branch from
users/ilovepi/spr/main.reapply-fuchsiacmake-allow-using-fatlto-when-building-runtimes-119252
to
main
January 16, 2025 21:46
Created using spr 1.3.6-beta.1
zeroomega
approved these changes
Jan 27, 2025
ilovepi
deleted the
users/ilovepi/spr/reapply-fuchsiacmake-allow-using-fatlto-when-building-runtimes-119252
branch
January 27, 2025 21:44
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous failures were addressed with CMake changes in #121819