Skip to content

Commit 5fe2f80

Browse files
authored
Re-enable use of LLD when building with LTO (WebAssembly#8227)
The Chromium CI builders (which build the emsdk release builds) don't support LTO builds with the system linker on Mac (but they do have lld). This reverts the part of WebAssembly#8204 that removed the usage of lld along with LTO, but keeps the part that enables it for non-LTO cases.
1 parent 4245cdc commit 5fe2f80

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ if(NOT MSVC AND NOT EMSCRIPTEN)
219219
endif()
220220
endif()
221221

222-
# The version of clang currently on our Mac bots doesn't seem to support this flag.
222+
# The version of clang currently on Binaryen's Mac CI doesn't seem to support
223+
# this flag, so don't enable it by default. LTO also enables lld separately.
223224
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE)
224225
add_link_flag("-fuse-ld=lld")
225226
endif()
@@ -228,6 +229,7 @@ if(BYN_ENABLE_LTO)
228229
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
229230
message(FATAL_ERROR "ThinLTO is only supported by clang")
230231
endif()
232+
add_link_flag("-fuse-ld=lld")
231233
set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=2)
232234
set(CMAKE_JOB_POOL_LINK link_job_pool)
233235
add_compile_flag("-flto=thin")

0 commit comments

Comments
 (0)