Skip to content

Commit 24a5b12

Browse files
authored
Merge pull request #3210 from compnerd/experimental-linkers
2 parents f0d2d35 + 1baeed7 commit 24a5b12

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ set(SWIFT_COMPILER_VERSION "" CACHE STRING
110110
set(CLANG_COMPILER_VERSION "" CACHE STRING
111111
"The internal version of the Clang compiler")
112112

113+
# Indicate whether Swift should attempt to use the lld linker.
114+
set(SWIFT_ENABLE_LLD_LINKER FALSE CACHE BOOL
115+
"Enable using the lld linker when available")
116+
113117
# Indicate whether Swift should attempt to use the gold linker.
114118
# This is not used on Darwin.
115119
set(SWIFT_ENABLE_GOLD_LINKER FALSE CACHE BOOL

cmake/modules/AddSwift.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,9 @@ function(_add_swift_library_single target name)
888888
"${SWIFT_SDK_${SWIFTLIB_SINGLE_SDK}_OBJECT_FORMAT}" STREQUAL "ELF")
889889
list(APPEND link_flags "-fuse-ld=gold")
890890
endif()
891+
if (SWIFT_ENABLE_LLD_LINKER)
892+
list(APPEND link_flags "-fuse-ld=lld")
893+
endif()
891894

892895
# Configure plist creation for OS X.
893896
set(PLIST_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
@@ -1530,6 +1533,9 @@ function(_add_swift_executable_single name)
15301533
"${SWIFT_SDK_${SWIFTEXE_SINGLE_SDK}_OBJECT_FORMAT}" STREQUAL "ELF")
15311534
list(APPEND link_flags "-fuse-ld=gold")
15321535
endif()
1536+
if(SWIFT_ENABLE_LLD_LINKER)
1537+
list(APPEND link_flags "-fuse-ld=lld")
1538+
endif()
15331539

15341540
# Find the names of dependency library targets.
15351541
#

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function(add_swift_unittest test_dirname)
5454
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY
5555
LINK_FLAGS " -fuse-ld=gold")
5656
endif()
57+
if(SWIFT_ENABLE_LLD_LINKER)
58+
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY
59+
LINK_FLAGS " -fuse-ld=lld")
60+
endif()
5761
endfunction()
5862

5963

0 commit comments

Comments
 (0)