[llvm] 3cd9dcc - [cmake] Disable using FatLTO on Apple platforms (#85708)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 13:03:06 PDT 2024


Author: Paul Kirth
Date: 2024-03-19T13:03:02-07:00
New Revision: 3cd9dccbb4235e057d0e53ab0b9673f3766800d4

URL: https://github.com/llvm/llvm-project/commit/3cd9dccbb4235e057d0e53ab0b9673f3766800d4
DIFF: https://github.com/llvm/llvm-project/commit/3cd9dccbb4235e057d0e53ab0b9673f3766800d4.diff

LOG: [cmake] Disable using FatLTO on Apple platforms (#85708)

FatLTO currently only supports ELF, so ensure we don't use it
on non-ELF platforms.

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index d84d9d7cca68cf..745935f1405170 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1637,7 +1637,7 @@ function(add_unittest test_suite test_name)
   # The runtime benefits of LTO don't outweight the compile time costs for tests.
   if(LLVM_ENABLE_LTO)
     if((UNIX OR MINGW) AND LINKER_IS_LLD)
-      if(LLVM_ENABLE_FATLTO)
+      if(LLVM_ENABLE_FATLTO AND NOT APPLE)
         # When using FatLTO, just use relocatable linking.
         set_property(TARGET ${test_name} APPEND_STRING PROPERTY
                       LINK_FLAGS " -Wl,--no-fat-lto-objects")

diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 92fa9839db652d..185266c0861e86 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1282,7 +1282,7 @@ elseif(LLVM_ENABLE_LTO)
   endif()
 endif()
 
-if(LLVM_ENABLE_FATLTO AND (FUCHSIA OR UNIX))
+if(LLVM_ENABLE_FATLTO AND UNIX AND NOT APPLE)
   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)


        


More information about the llvm-commits mailing list