llvm.org GIT mirror llvm / a9134d2
Add a LLVM_USE_LINKER that defines the linker to use when building LLVM Summary: This string parameter is passed to -fuse-ld when linking. It can be an absolute path to your custom linker, otherwise clang will look for `ld.{name}`. Reviewers: davide, tejohnson, pcc Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28738 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292047 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 3 years ago
2 changed file(s) with 25 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
146146 endif()
147147 endfunction()
148148
149 if(LLVM_ENABLE_LLD)
150 check_cxx_compiler_flag("-fuse-ld=lld" CXX_SUPPORTS_LLD)
151 append_if(CXX_SUPPORTS_LLD "-fuse-ld=lld"
149 if( LLVM_ENABLE_LLD )
150 if ( LLVM_USE_LINKER )
151 message(FATAL_ERROR "LLVM_ENABLE_LLD and LLVM_USE_LINKER can't be set at the same time")
152 endif()
153 set(LLVM_USE_LINKER "lld")
154 endif()
155
156 if( LLVM_USE_LINKER )
157 check_cxx_compiler_flag("-fuse-ld=${LLVM_USE_LINKER}" CXX_SUPPORTS_CUSTOM_LINKER)
158 if ( NOT CXX_SUPPORTS_CUSTOM_LINKER )
159 message(FATAL_ERROR "Host compiler does not support '-fuse-ld=${LLVM_USE_LINKER}'")
160 endif()
161 append("-fuse-ld=${LLVM_USE_LINKER}"
152162 CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
153163 endif()
154164
380380 Add ``-flto`` or ``-flto=`` flags to the compile and link command
381381 lines, enabling link-time optimization. Possible values are ``Off``,
382382 ``On``, ``Thin`` and ``Full``. Defaults to OFF.
383
384 **LLVM_USE_LINKER**:STRING
385 Add ``-fuse-ld={name}`` to the link invocation. The possible value depend on
386 your compiler, for clang the value can be an absolute path to your custom
387 linker, otherwise clang will prefix the name with ``ld.`` and apply its usual
388 search. For example to link LLVM with the Gold linker, cmake can be invoked
389 with ``-DLLVM_USE_LINKER=gold``.
390
391 **LLVM_ENABLE_LLD**:BOOL
392 This option is equivalent to `-DLLVM_USE_LINKER=lld`, except during a 2-stage
393 build where a dependency is added from the first stage to the second ensuring
394 that lld is built before stage2 begins.
383395
384396 **LLVM_PARALLEL_COMPILE_JOBS**:STRING
385397 Define the maximum number of concurrent compilation jobs.