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

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 19:27:45 PST 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:

What's the motivation for including `-fno-lto` in compile flags here?

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


More information about the cfe-commits mailing list