summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2016-07-29 00:46:13 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2016-07-29 00:46:13 +0000
commitbbbf7b51db307c107a104e147afabbf7445ad87a (patch)
tree03d5a9ceb34db08d0b4d3adaeb88bbafc3996707
parent7de70738df4c6c112df52139689254864892353c (diff)
downloadbcm5719-llvm-bbbf7b51db307c107a104e147afabbf7445ad87a.tar.gz
bcm5719-llvm-bbbf7b51db307c107a104e147afabbf7445ad87a.zip
Add LLVM_ENABLE_LLD option to use LLD as C/C++ linker.
Differential revision: https://reviews.llvm.org/D22896 llvm-svn: 277093
-rw-r--r--llvm/CMakeLists.txt1
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake6
2 files changed, 7 insertions, 0 deletions
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 839162eef50..c9276b376f3 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -317,6 +317,7 @@ endif()
option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
option(LLVM_ENABLE_LIBCXXABI "Use libc++abi when using libc++." OFF)
+option(LLVM_ENABLE_LLD "Use lld as C and C++ linker." OFF)
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 9dafdc3fc38..6a4f7e5f074 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -144,6 +144,12 @@ function(add_flag_or_print_warning flag name)
endif()
endfunction()
+if(LLVM_ENABLE_LLD)
+ check_cxx_compiler_flag("-fuse-ld=lld" CXX_SUPPORTS_LLD)
+ append_if(CXX_SUPPORTS_LLD "-fuse-ld=lld"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+endif()
+
if( LLVM_ENABLE_PIC )
if( XCODE )
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
OpenPOWER on IntegriCloud