@@ -190,6 +190,10 @@ foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unkn
190190 set (RUNTIMES_${target} _LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR} /bin" CACHE BOOL "" )
191191 set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "" )
192192
193+ # Enable FatLTO for Linux and baremetal runtimes
194+ set (RUNTIMES_${target} _LLVM_ENABLE_LTO ON CACHE BOOL "" )
195+ set (RUNTIMES_${target} _LLVM_ENABLE_FATLTO ON CACHE BOOL "" )
196+
193197 # Use .build-id link.
194198 list (APPEND RUNTIME_BUILD_ID_LINK "${target} " )
195199 endif ()
@@ -272,6 +276,10 @@ if(FUCHSIA_SDK)
272276 set (RUNTIMES_${target} +asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "" )
273277 set (RUNTIMES_${target} +asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "" )
274278
279+ # Enable FatLTO for Fuchsia runtimes
280+ set (RUNTIMES_${target} _LLVM_ENABLE_LTO ON CACHE BOOL "" )
281+ set (RUNTIMES_${target} _LLVM_ENABLE_FATLTO ON CACHE BOOL "" )
282+
275283 # Use .build-id link.
276284 list (APPEND RUNTIME_BUILD_ID_LINK "${target} " )
277285 endforeach ()
@@ -363,6 +371,10 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.
363371 set (RUNTIMES_${target} _LLVM_INCLUDE_TESTS OFF CACHE BOOL "" )
364372 set (RUNTIMES_${target} _LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "" )
365373 set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "" )
374+
375+ # Enable FatLTO for baremetal runtimes
376+ set (RUNTIMES_${target} _LLVM_ENABLE_LTO ON CACHE BOOL "" )
377+ set (RUNTIMES_${target} _LLVM_ENABLE_FATLTO ON CACHE BOOL "" )
366378endforeach ()
367379
368380foreach (target riscv32-unknown-elf)
@@ -414,6 +426,10 @@ foreach(target riscv32-unknown-elf)
414426 set (RUNTIMES_${target} _LLVM_INCLUDE_TESTS OFF CACHE BOOL "" )
415427 set (RUNTIMES_${target} _LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "" )
416428 set (RUNTIMES_${target} _LLVM_ENABLE_RUNTIMES "libc;libcxx" CACHE STRING "" )
429+
430+ # Enable FatLTO for baremetal runtimes
431+ set (RUNTIMES_${target} _LLVM_ENABLE_LTO ON CACHE BOOL "" )
432+ set (RUNTIMES_${target} _LLVM_ENABLE_FATLTO ON CACHE BOOL "" )
417433endforeach ()
418434
419435set (LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS} " CACHE STRING "" )
0 commit comments