@@ -26,6 +26,7 @@ set target_arch=x64
2626set ltcg =
2727set thin_lto =
2828set lto =
29+ set lto_jobs =
2930set pgo_generate =
3031set pgo_use =
3132set target_env =
@@ -110,6 +111,7 @@ if /i "%1"=="nonpm" set nonpm=1&goto arg-ok
110111if /i " %1 " == " ltcg" set ltcg = 1& goto arg-ok
111112if /i " %1 " == " thin-lto" set thin_lto = 1& goto arg-ok
112113if /i " %1 " == " lto" set lto = 1& goto arg-ok
114+ if /i " %1 " == " lto-jobs" set " lto_jobs = %2 " & goto arg-ok-2
113115if /i " %1 " == " pgo-generate" set pgo_generate = 1& goto arg-ok
114116if /i " %1 " == " pgo-use" set pgo_use = 1& goto arg-ok
115117if /i " %1 " == " v8temporal" set v8temporal = 1& goto arg-ok
@@ -197,6 +199,8 @@ if defined build_release (
197199 set projgen = 1
198200 set cctest = 1
199201 set thin_lto = 1
202+ @ REM Parallel LTO link jobs can cause OOM issues, so we limit it to 2 by default for release builds in the release CI.
203+ set lto_jobs = 2
200204)
201205
202206:: LTO mutual exclusion
@@ -243,6 +247,7 @@ if defined nonpm set configure_flags=%configure_flags% --without-npm
243247if defined ltcg set configure_flags = %configure_flags% --with-ltcg
244248if defined thin_lto set configure_flags = %configure_flags% --enable-thin-lto
245249if defined lto set configure_flags = %configure_flags% --enable-lto
250+ if defined lto_jobs set configure_flags = %configure_flags% --lto-jobs=%lto_jobs%
246251if defined pgo_generate set configure_flags = %configure_flags% --enable-pgo-generate
247252if defined pgo_use set configure_flags = %configure_flags% --enable-pgo-use
248253if defined release_urlbase set configure_flags = %configure_flags% --release-urlbase=%release_urlbase%
@@ -908,7 +913,7 @@ set exit_code=1
908913goto exit
909914
910915:help
911- echo vcbuild.bat [debug/release] [msi] [doc] [test/test-all/test-addons/test-doc/test-js-native-api/test-node-api/test-internet/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [build-addons/build-js-native-api-tests/build-node-api-tests/build-ffi-tests] [ignore-flaky] [static/dll] [noprojgen] [projgen] [clang-cl] [ccache path-to-ccache] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [nonpm] [ltcg] [thin-lto] [lto] [pgo-generate] [pgo-use] [licensetf] [sign] [x64/arm64] [vs2022/vs2026] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-md] [lint-md-build] [format-md] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm]
916+ echo vcbuild.bat [debug/release] [msi] [doc] [test/test-all/test-addons/test-doc/test-js-native-api/test-node-api/test-internet/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [build-addons/build-js-native-api-tests/build-node-api-tests/build-ffi-tests] [ignore-flaky] [static/dll] [noprojgen] [projgen] [clang-cl] [ccache path-to-ccache] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [nonpm] [ltcg] [thin-lto] [lto] [lto-jobs number-of-jobs] [ pgo-generate] [pgo-use] [licensetf] [sign] [x64/arm64] [vs2022/vs2026] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-md] [lint-md-build] [format-md] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [cctest] [no-cctest] [openssl-no-asm]
912917echo Examples:
913918echo vcbuild.bat : builds release build
914919echo vcbuild.bat debug : builds debug build
@@ -922,6 +927,7 @@ echo vcbuild.bat no-cctest : skip building cctest.exe
922927echo vcbuild.bat ccache c:\ccache\ : use ccache to speed build
923928echo vcbuild.bat thin-lto : builds with Thin LTO applied globally to all targets
924929echo vcbuild.bat lto : builds with Full LTO applied globally to all targets
930+ echo vcbuild.bat thin-lto lto-jobs 2 : builds with Thin LTO applied globally to all targets and limits parallel LTO link jobs (reduces peak memory usage)
925931echo vcbuild.bat pgo-generate : builds instrumented binary for PGO (profile first, then rebuild with pgo-use)
926932echo vcbuild.bat pgo-use : builds optimized binary using PGO profile data
927933goto exit
0 commit comments