diff --git a/build-all.sh b/build-all.sh index fd87b67..da476a3 100755 --- a/build-all.sh +++ b/build-all.sh @@ -24,7 +24,7 @@ HOST_ARGS="" while [ $# -gt 0 ]; do case "$1" in - --enable-asserts|--disable-dylib|--with-clang|--thinlto) + --enable-asserts|--disable-dylib|--with-clang|--thinlto|--use-linker=*) LLVM_ARGS="$LLVM_ARGS $1" ;; --host-clang|--host-clang=*) @@ -120,7 +120,7 @@ while [ $# -gt 0 ]; do shift done if [ -z "$PREFIX" ]; then - echo "$0 [--host-clang[=clang]] [--enable-asserts] [--disable-dylib] [--with-clang] [--thinlto] [--full-llvm] [--disable-lldb] [--disable-lldb-mi] [--disable-clang-tools-extra] [--host=triple] [--with-default-win32-winnt=0x601] [--with-default-msvcrt=ucrt] [--enable-cfguard|--disable-cfguard] [--no-runtimes] [--llvm-only] [--no-tools] [--wipe-runtimes] [--clean-runtimes] [--stage1] [--profile[=type]] [--pgo[=profile]] [--full-pgo[=type]] dest [pgo-dest]" + echo "$0 [--host-clang[=clang]] [--enable-asserts] [--disable-dylib] [--with-clang] [--use-linker=linker] [--thinlto] [--full-llvm] [--disable-lldb] [--disable-lldb-mi] [--disable-clang-tools-extra] [--host=triple] [--with-default-win32-winnt=0x601] [--with-default-msvcrt=ucrt] [--enable-cfguard|--disable-cfguard] [--no-runtimes] [--llvm-only] [--no-tools] [--wipe-runtimes] [--clean-runtimes] [--stage1] [--profile[=type]] [--pgo[=profile]] [--full-pgo[=type]] dest [pgo-dest]" exit 1 fi if [ -n "$PREFIX_PGO" ] && [ -z "$PGO" ] && [ -z "$FULL_PGO" ]; then diff --git a/build-llvm.sh b/build-llvm.sh index 1a3e306..e94bb3f 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -40,6 +40,9 @@ while [ $# -gt 0 ]; do WITH_CLANG=1 BUILDDIR="$BUILDDIR-withclang" ;; + --use-linker=*) + USE_LINKER="${1#*=}" + ;; --thinlto) LTO="thin" BUILDDIR="$BUILDDIR-thinlto" @@ -104,7 +107,7 @@ done BUILDDIR="$BUILDDIR$ASSERTSSUFFIX" if [ -z "$CHECKOUT_ONLY" ]; then if [ -z "$PREFIX" ]; then - echo $0 [--enable-asserts] [--with-clang] [--thinlto] [--lto] [--instrumented[=type]] [--pgo[=profile]] [--disable-dylib] [--full-llvm] [--with-python] [--disable-lldb] [--disable-clang-tools-extra] [--host=triple] [--no-llvm-tool-reuse] [--macos-native-tools] dest + echo $0 [--enable-asserts] [--with-clang] [--use-linker=linker] [--thinlto] [--lto] [--instrumented[=type]] [--pgo[=profile]] [--disable-dylib] [--full-llvm] [--with-python] [--disable-lldb] [--disable-clang-tools-extra] [--host=triple] [--no-llvm-tool-reuse] [--macos-native-tools] dest exit 1 fi @@ -190,7 +193,7 @@ if [ -n "$HOST" ]; then if [ -n "$WITH_CLANG" ]; then CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER=clang" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER=clang++" - CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=lld" + CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=${USE_LINKER:-lld}" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_ASM_COMPILER_TARGET=$HOST" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER_TARGET=$HOST" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER_TARGET=$HOST" @@ -267,12 +270,14 @@ elif [ -n "$WITH_CLANG" ]; then # tools. CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER=clang" CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER=clang++" - CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=lld" + CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=${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 + if [ -n "$USE_LINKER" ]; then + CMAKEFLAGS="$CMAKEFLAGS -DLLVM_USE_LINKER=$USE_LINKER" + elif 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"