Skip to content

Commit 7bdc402

Browse files
authored
Merge pull request #31647 from gottesmm/pr-ff0d585699a2dcf98bf6077190a869f014d0fec0
[build-script] On non-Darwin build lld by default.
2 parents 43cbf36 + edfbf57 commit 7bdc402

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

utils/build-script-impl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ KNOWN_SETTINGS=(
125125
skip-build-benchmarks "" "set to skip building Swift Benchmark Suite"
126126
skip-build-clang-tools-extra "" "set to skip building clang-tools-extra as part of llvm"
127127
skip-build-compiler-rt "" "set to skip building Compiler-RT"
128+
skip-build-lld "" "set to skip building lld as part of llvm (linux only)"
128129
skip-build-cygwin "" "set to skip building Swift stdlibs for Cygwin"
129130
skip-build-external-benchmarks "1" "set to skip building the external Swift Benchmark Suite. (skipped by default)"
130131
skip-build-freebsd "" "set to skip building Swift stdlibs for FreeBSD"
@@ -1490,6 +1491,7 @@ for host in "${ALL_HOSTS[@]}"; do
14901491
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG"
14911492
-DCMAKE_BUILD_TYPE:STRING="${LLVM_BUILD_TYPE}"
14921493
-DLLVM_TOOL_SWIFT_BUILD:BOOL=NO
1494+
-DLLVM_TOOL_LLD_BUILD:BOOL=TRUE
14931495
-DLLVM_INCLUDE_DOCS:BOOL=TRUE
14941496
-DLLVM_ENABLE_LTO:STRING="${LLVM_ENABLE_LTO}"
14951497
-DCOMPILER_RT_INTERCEPT_LIBDISPATCH=ON
@@ -1506,12 +1508,20 @@ for host in "${ALL_HOSTS[@]}"; do
15061508
llvm_enable_projects+=("clang-tools-extra")
15071509
fi
15081510

1509-
cmake_options+=(
1510-
-DLLVM_ENABLE_PROJECTS="$(join ";" ${llvm_enable_projects[@]})"
1511-
)
1511+
# On non-Darwin platforms, build lld so we can always have a
1512+
# linker that is compatible with the swift we are using to
1513+
# compile the stdlib.
1514+
#
1515+
# This makes it easier to build target stdlibs on systems that
1516+
# have old toolchains without more modern linker features.
1517+
if [[ "$(uname -s)" != "Darwin" ]] ; then
1518+
if [[ ! "${SKIP_BUILD_LLD}" ]]; then
1519+
llvm_enable_projects+=("lld")
1520+
fi
1521+
fi
15121522

15131523
cmake_options+=(
1514-
-DLLVM_TOOL_LLD_BUILD:BOOL=TRUE
1524+
-DLLVM_ENABLE_PROJECTS="$(join ";" ${llvm_enable_projects[@]})"
15151525
)
15161526

15171527
if [[ "${BUILD_TOOLCHAIN_ONLY}" ]]; then

0 commit comments

Comments
 (0)