Skip to content

Commit ae12ced

Browse files
authored
Merge pull request #74046 from al45tair/eng/PR-129053233
[6.0][lld] Allow opt-out from building lld via --skip-build-lld
2 parents 8c09df1 + 307c32c commit ae12ced

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,10 @@ def create_argument_parser():
841841
option('--build-ninja', toggle_true,
842842
help='build the Ninja tool')
843843

844-
option(['--build-lld'], toggle_true('build_lld'),
844+
option(['--build-lld'], toggle_true('build_lld'), default=True,
845845
help='build lld as part of llvm')
846+
option(['--skip-build-lld'], toggle_false('build_lld'),
847+
help='skip building lld as part of llvm')
846848

847849
option('--skip-build-clang-tools-extra',
848850
toggle_false('build_clang_tools_extra'),

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
'build_libcxx': False,
7575
'build_linux_static': False,
7676
'build_ninja': False,
77-
'build_lld': False,
77+
'build_lld': True,
7878
'build_osx': True,
7979
'build_playgroundsupport': False,
8080
'build_runtime_with_host_compiler': False,
@@ -758,6 +758,7 @@ class BuildScriptImplOption(_BaseOption):
758758
DisableOption('--skip-build-zlib', dest='build_zlib'),
759759
DisableOption('--skip-build-curl', dest='build_curl'),
760760
DisableOption('--skip-build-compiler-rt', dest='build_compiler_rt'),
761+
DisableOption('--skip-build-lld', dest='build_lld'),
761762

762763
ChoicesOption('--compiler-vendor',
763764
choices=['none', 'apple']),

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,7 @@ def convert_to_impl_arguments(self):
465465
"--llvm-install-components=%s" % args.llvm_install_components
466466
]
467467

468-
# On non-Darwin platforms, build lld so we can always have a
469-
# linker that is compatible with the swift we are using to
470-
# compile the stdlib.
471-
#
472-
# This makes it easier to build target stdlibs on systems that
473-
# have old toolchains without more modern linker features.
474-
#
475-
# On Darwin, only build lld if explicitly requested using --build-lld.
476-
should_build_lld = (platform.system() != 'Darwin' or args.build_lld)
477-
if not should_build_lld:
468+
if not args.build_lld:
478469
impl_args += [
479470
"--skip-build-lld"
480471
]

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,14 @@ def build(self, host_target):
295295
if self.args.build_clang_tools_extra:
296296
llvm_enable_projects.append('clang-tools-extra')
297297

298-
# Always build lld -- on non-Darwin so we can always have a
298+
# Building lld is on by default -- on non-Darwin so we can always have a
299299
# linker that is compatible with the swift we are using to
300300
# compile the stdlib, but on Darwin too for Embedded Swift use cases.
301301
#
302302
# This makes it easier to build target stdlibs on systems that
303303
# have old toolchains without more modern linker features.
304-
llvm_enable_projects.append('lld')
304+
if self.args.build_lld:
305+
llvm_enable_projects.append('lld')
305306

306307
llvm_cmake_options.define('LLVM_ENABLE_PROJECTS',
307308
';'.join(llvm_enable_projects))

0 commit comments

Comments
 (0)