From 7178c57c16a13bb796980d59b40dceb26972c319 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 29 Mar 2018 14:08:42 -0700 Subject: [PATCH] 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. --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0adcb598..71e55b173 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,8 @@ else() endif() option(USE_GOLD_LINKER "use the gold linker" ${USE_GOLD_LINKER_DEFAULT}) +option(USE_LLD_LINKER "use the lld linker" OFF) + option(ENABLE_THREAD_LOCAL_STORAGE "enable usage of thread local storage via __thread" ON) set(DISPATCH_USE_THREAD_LOCAL_STORAGE ${ENABLE_THREAD_LOCAL_STORAGE}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a7cd89bbd..0286d4fc1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -211,6 +211,12 @@ if(USE_GOLD_LINKER) PROPERTY LINK_FLAGS -fuse-ld=gold) endif() +if(USE_LLD_LINKER) + set_property(TARGET dispatch + APPEND_STRING + PROPERTY LINK_FLAGS + -fuse-ld=lld) +endif() # Temporary staging; the various swift projects that depend on libdispatch # all expect libdispatch.so to be in src/.libs/libdispatch.so