File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "
11
11
12
12
set (LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "" )
13
13
set (LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "" )
14
+ set (LLVM_ENABLE_FATLTO ON CACHE BOOL "" )
14
15
set (LLVM_ENABLE_HTTPLIB ON CACHE BOOL "" )
15
16
set (LLVM_ENABLE_LIBCXX ON CACHE BOOL "" )
16
17
set (LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "" )
Original file line number Diff line number Diff line change @@ -1621,8 +1621,15 @@ function(add_unittest test_suite test_name)
1621
1621
# The runtime benefits of LTO don't outweight the compile time costs for tests.
1622
1622
if(LLVM_ENABLE_LTO)
1623
1623
if((UNIX OR MINGW) AND LINKER_IS_LLD)
1624
- set_property(TARGET ${test_name} APPEND_STRING PROPERTY
1625
- LINK_FLAGS " -Wl,--lto-O0 ")
1624
+ if(LLVM_ENABLE_FATLTO)
1625
+ # When using FatLTO, just use relocatable linking.
1626
+ set_property(TARGET ${test_name} APPEND_STRING PROPERTY
1627
+ LINK_FLAGS " -Wl,--no-fat-lto-objects ")
1628
+ set_property(TARGET ${test_name} APPEND_STRING PROPERTY COMPILE_FLAGS " -fno-lto ")
1629
+ else()
1630
+ set_property(TARGET ${test_name} APPEND_STRING PROPERTY
1631
+ LINK_FLAGS " -Wl,--lto-O0 ")
1632
+ endif()
1626
1633
elseif(LINKER_IS_LLD_LINK)
1627
1634
set_property(TARGET ${test_name} APPEND_STRING PROPERTY
1628
1635
LINK_FLAGS " /opt:lldlto=0 ")
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ endif()
32
32
set (LLVM_ENABLE_LTO OFF CACHE STRING "Build LLVM with LTO. May be specified as Thin or Full to use a particular kind of LTO" )
33
33
string (TOUPPER "${LLVM_ENABLE_LTO} " uppercase_LLVM_ENABLE_LTO )
34
34
35
+ option (LLVM_ENABLE_FATLTO "Build LLVM with -ffat-lto-objects." OFF )
36
+
35
37
# Ninja Job Pool support
36
38
# The following only works with the Ninja generator in CMake >= 3.0.
37
39
set (LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
@@ -1259,6 +1261,10 @@ elseif(LLVM_ENABLE_LTO)
1259
1261
endif ()
1260
1262
endif ()
1261
1263
1264
+ if (LLVM_ENABLE_FATLTO AND (FUCHSIA OR UNIX ))
1265
+ append ("-ffat-lto-objects" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS )
1266
+ endif ()
1267
+
1262
1268
# Set an AIX default for LLVM_EXPORT_SYMBOLS_FOR_PLUGINS based on whether we are
1263
1269
# doing dynamic linking (see below).
1264
1270
set (LLVM_EXPORT_SYMBOLS_FOR_PLUGINS_AIX_default OFF )
You can’t perform that action at this time.
0 commit comments