diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2022-01-08 12:59:14 +0100 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-01-10 09:55:45 +0330 |
commit | 162606f3586878d6eaf9a034be84aea8ca60e829 (patch) | |
tree | dfa081d3b74ad3f30dacd02d6012a97c62005efd /Toolchain/BuildClang.sh | |
parent | d21c38a72df2f69b48bcd500978c701045c29e6b (diff) | |
download | serenity-162606f3586878d6eaf9a034be84aea8ca60e829.zip |
Toolchain+CI: Link LLVM with LLD if available
According to most benchmarks, LLD is faster than GNU ld and the macOS
linker, so let's use it if possible in order to speed up the toolchain
build.
Diffstat (limited to 'Toolchain/BuildClang.sh')
-rwxr-xr-x | Toolchain/BuildClang.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Toolchain/BuildClang.sh b/Toolchain/BuildClang.sh index 4dd1865b29..160c41d766 100755 --- a/Toolchain/BuildClang.sh +++ b/Toolchain/BuildClang.sh @@ -130,6 +130,18 @@ then exit 1 fi +link_lld= +buildstep dependencies echo "Checking whether the LLD linker is available..." +if ${CXX:-c++} -o /dev/null -fuse-ld=lld -xc - >/dev/null 2>/dev/null << 'PROGRAM' +int main() {} +PROGRAM +then + link_lld=1 + buildstep dependencies echo "Using LLD for linking LLVM." +else + buildstep dependencies echo "LLD not found. Using the default linker." +fi + # === CHECK CACHE AND REUSE === pushd "$DIR" @@ -254,6 +266,7 @@ pushd "$DIR/Build/clang" -DCMAKE_INSTALL_PREFIX="$PREFIX" \ -DSERENITY_MODULE_PATH="$DIR/CMake" \ -C "$DIR/CMake/LLVMConfig.cmake" \ + ${link_lld:+"-DLLVM_ENABLE_LLD=ON"} \ ${dev:+"-DLLVM_CCACHE_BUILD=ON"} \ ${ci:+"-DLLVM_CCACHE_BUILD=ON"} \ ${ci:+"-DLLVM_CCACHE_DIR=$LLVM_CCACHE_DIR"} \ |