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

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 20:28:39 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")
----------------
ilovepi wrote:

This makes sure we use the non-LTO part of the build. It's probably pedantic to add them both, but it makes sure we choose the object file part and not the bitcode section.

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


More information about the cfe-commits mailing list