[clang] [llvm] [CMAKE] Enable FatLTO as a build option for LLVM (PR #80480)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 15 16:04:47 PDT 2024


================
@@ -1621,8 +1621,15 @@ 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)
-      set_property(TARGET ${test_name} APPEND_STRING PROPERTY
-                    LINK_FLAGS " -Wl,--lto-O0")
+      if(LLVM_ENABLE_FATLTO)
+        # When using FatLTO, just use relocatable linking.
+        set_property(TARGET ${test_name} APPEND_STRING PROPERTY
+                      LINK_FLAGS " -Wl,--no-fat-lto-objects")
+        set_property(TARGET ${test_name} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-lto")
----------------
petrhosek wrote:

I'd omit it since it shouldn't be necessary.

https://github.com/llvm/llvm-project/pull/80480


More information about the llvm-commits mailing list