Skip to content

Commit c7c5003

Browse files
committed
[build-script-impl][lto] When compiling swift/llvm with lto, pass LLVM_PARALLEL_LINK_JOBS to swift as well as llvm.
The reason to do this is the same reason that we already pass in -DLLVM_ENABLE_LTO=YES to swift, to ensure that parts of our codebase that use the llvm build machinery (e.g. the unittests) do not use too many linker jobs given the memory constraints of a given machine. rdar://24717107
1 parent 87a0ad1 commit c7c5003

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

utils/build-script-impl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,15 @@ function set_build_options_for_host() {
649649
"-DCMAKE_CXX_STANDARD_COMPUTED_DEFAULT=AppleClang"
650650
)
651651
fi
652+
653+
# We need to also pass in this flag so that parts of LLVM's
654+
# build system that we use (for instance when compiling
655+
# unittests) do not use too many threads when we are using lto.
656+
if [[ $(true_false "${LLVM_ENABLE_LTO}") == "TRUE" ]]; then
657+
swift_cmake_options+=(
658+
"-DLLVM_PARALLEL_LINK_JOBS=${LLVM_NUM_PARALLEL_LTO_LINK_JOBS}"
659+
)
660+
fi
652661
swift_cmake_options+=(
653662
"-DSWIFT_PARALLEL_LINK_JOBS=$(num_swift_parallel_lto_link_jobs)"
654663
)

0 commit comments

Comments
 (0)