File tree Expand file tree Collapse file tree 5 files changed +30
-10
lines changed
swift_build_support/swift_build_support
validation-test/BuildSystem Expand file tree Collapse file tree 5 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -1833,16 +1833,8 @@ for host in "${ALL_HOSTS[@]}"; do
18331833 llvm_enable_projects+=(" clang-tools-extra" )
18341834 fi
18351835
1836- # On non-Darwin platforms, build lld so we can always have a
1837- # linker that is compatible with the swift we are using to
1838- # compile the stdlib.
1839- #
1840- # This makes it easier to build target stdlibs on systems that
1841- # have old toolchains without more modern linker features.
1842- if [[ " $( uname -s) " != " Darwin" ]] ; then
1843- if [[ ! " ${SKIP_BUILD_LLD} " ]]; then
1844- llvm_enable_projects+=(" lld" )
1845- fi
1836+ if [[ ! " ${SKIP_BUILD_LLD} " ]]; then
1837+ llvm_enable_projects+=(" lld" )
18461838 fi
18471839
18481840 cmake_options+=(
Original file line number Diff line number Diff line change @@ -721,6 +721,9 @@ def create_argument_parser():
721721 option (['--build-libparser-only' ], toggle_true ('build_libparser_only' ),
722722 help = 'build only libParser for SwiftSyntax' )
723723
724+ option (['--build-lld' ], toggle_true ('build_lld' ),
725+ help = 'build lld as part of llvm' )
726+
724727 option ('--skip-build-clang-tools-extra' ,
725728 toggle_false ('build_clang_tools_extra' ),
726729 default = True ,
Original file line number Diff line number Diff line change 7171 'build_lldb' : False ,
7272 'build_libcxx' : False ,
7373 'build_ninja' : False ,
74+ 'build_lld' : False ,
7475 'build_osx' : True ,
7576 'build_playgroundsupport' : False ,
7677 'build_runtime_with_host_compiler' : False ,
@@ -531,6 +532,7 @@ class BuildScriptImplOption(_BaseOption):
531532 EnableOption ('--android' ),
532533 EnableOption ('--build-external-benchmarks' ),
533534 EnableOption ('--build-ninja' ),
535+ EnableOption ('--build-lld' ),
534536 EnableOption ('--build-runtime-with-host-compiler' ),
535537 EnableOption ('--build-swift-dynamic-sdk-overlay' ),
536538 EnableOption ('--build-swift-dynamic-stdlib' ),
Original file line number Diff line number Diff line change @@ -427,6 +427,20 @@ def convert_to_impl_arguments(self):
427427 "--llvm-install-components=%s" % args .llvm_install_components
428428 ]
429429
430+ # On non-Darwin platforms, build lld so we can always have a
431+ # linker that is compatible with the swift we are using to
432+ # compile the stdlib.
433+ #
434+ # This makes it easier to build target stdlibs on systems that
435+ # have old toolchains without more modern linker features.
436+ #
437+ # On Darwin, only build lld if explicitly requested using --build-lld.
438+ should_build_lld = (platform .system () != 'Darwin' or args .build_lld )
439+ if not should_build_lld :
440+ impl_args += [
441+ "--skip-build-lld"
442+ ]
443+
430444 if not args .clean_libdispatch :
431445 impl_args += [
432446 "--skip-clean-libdispatch"
Original file line number Diff line number Diff line change 1+ # RUN: %empty-directory(%t)
2+ # RUN: mkdir -p %t
3+ # RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --build-lld 2>&1 | %FileCheck %s
4+
5+ # REQUIRES: standalone_build
6+
7+ # Check that lld is in LLVM_ENABLE_PROJECTS of the llvm-project/llvm build
8+
9+ # CHECK: '-DLLVM_ENABLE_PROJECTS={{[^']*}}lld{{[^']*}}'{{.*}}llvm-project/llvm{{$}}
You can’t perform that action at this time.
0 commit comments