build-llvm: Use a faster linker for native building, if available

Use lld or gold, if available - they are significantly faster than
ld.bfd on Linux.
This commit is contained in:
Martin Storsjö committed 2023-11-28 00:02:50 +02:00
1 parent 0f24a65373
commit 81a72d5762
1 file changed
+9
+9
View File
@@ -221,6 +221,15 @@ elif [ -n "$STAGE2" ]; then
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER=clang"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER=clang++"
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=lld"
else
# Native compilation with the system default compiler.
# Use a faster linker, if available.
if command -v ld.lld >/dev/null; then
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=lld"
elif command -v ld.gold >/dev/null; then
CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=gold"
fi
fi
if [ -n "$TARGET_WINDOWS" ]; then