Skip to content

Commit 7178c57

Browse files
committed
build: support lld as the linker
For cross-compiling to Windows, lld is a requirement. It also can be used for ELF targets. Add an option to have lld be used as the linker to mirror the gold option.
1 parent f151b33 commit 7178c57

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ else()
9999
endif()
100100
option(USE_GOLD_LINKER "use the gold linker" ${USE_GOLD_LINKER_DEFAULT})
101101

102+
option(USE_LLD_LINKER "use the lld linker" OFF)
103+
102104
option(ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via __thread" ON)
103105
set(DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE})
104106

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ if(USE_GOLD_LINKER)
211211
PROPERTY LINK_FLAGS
212212
-fuse-ld=gold)
213213
endif()
214+
if(USE_LLD_LINKER)
215+
set_property(TARGET dispatch
216+
APPEND_STRING
217+
PROPERTY LINK_FLAGS
218+
-fuse-ld=lld)
219+
endif()
214220

215221
# Temporary staging; the various swift projects that depend on libdispatch
216222
# all expect libdispatch.so to be in src/.libs/libdispatch.so

0 commit comments

Comments
 (0)