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 @@ -1839,16 +1839,8 @@ for host in "${ALL_HOSTS[@]}"; do
18391839 llvm_enable_projects+=(" clang-tools-extra" )
18401840 fi
18411841
1842- # On non-Darwin platforms, build lld so we can always have a
1843- # linker that is compatible with the swift we are using to
1844- # compile the stdlib.
1845- #
1846- # This makes it easier to build target stdlibs on systems that
1847- # have old toolchains without more modern linker features.
1848- if [[ " $( uname -s) " != " Darwin" ]] ; then
1849- if [[ ! " ${SKIP_BUILD_LLD} " ]]; then
1850- llvm_enable_projects+=(" lld" )
1851- fi
1842+ if [[ ! " ${SKIP_BUILD_LLD} " ]]; then
1843+ llvm_enable_projects+=(" lld" )
18521844 fi
18531845
18541846 cmake_options+=(
Original file line number Diff line number Diff line change @@ -736,6 +736,9 @@ def create_argument_parser():
736736 option (['--build-libparser-only' ], toggle_true ('build_libparser_only' ),
737737 help = 'build only libParser for SwiftSyntax' )
738738
739+ option (['--build-lld' ], toggle_true ('build_lld' ),
740+ help = 'build lld as part of llvm' )
741+
739742 option ('--skip-build-clang-tools-extra' ,
740743 toggle_false ('build_clang_tools_extra' ),
741744 default = True ,
Original file line number Diff line number Diff line change 7272 'build_lldb' : False ,
7373 'build_libcxx' : False ,
7474 'build_ninja' : False ,
75+ 'build_lld' : False ,
7576 'build_osx' : True ,
7677 'build_playgroundsupport' : False ,
7778 'build_runtime_with_host_compiler' : False ,
@@ -538,6 +539,7 @@ class BuildScriptImplOption(_BaseOption):
538539 EnableOption ('--android' ),
539540 EnableOption ('--build-external-benchmarks' ),
540541 EnableOption ('--build-ninja' ),
542+ EnableOption ('--build-lld' ),
541543 EnableOption ('--build-runtime-with-host-compiler' ),
542544 EnableOption ('--build-swift-dynamic-sdk-overlay' ),
543545 EnableOption ('--build-swift-dynamic-stdlib' ),
Original file line number Diff line number Diff line change @@ -430,6 +430,20 @@ def convert_to_impl_arguments(self):
430430 "--llvm-install-components=%s" % args .llvm_install_components
431431 ]
432432
433+ # On non-Darwin platforms, build lld so we can always have a
434+ # linker that is compatible with the swift we are using to
435+ # compile the stdlib.
436+ #
437+ # This makes it easier to build target stdlibs on systems that
438+ # have old toolchains without more modern linker features.
439+ #
440+ # On Darwin, only build lld if explicitly requested using --build-lld.
441+ should_build_lld = (platform .system () != 'Darwin' or args .build_lld )
442+ if not should_build_lld :
443+ impl_args += [
444+ "--skip-build-lld"
445+ ]
446+
433447 if not args .clean_libdispatch :
434448 impl_args += [
435449 "--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