Skip to content

Commit c09fa4e

Browse files
authored
Merge pull request #73539 from kubamracek/lld-opt-out
[lld] Allow opt-out from building lld via --skip-build-lld
2 parents 340bfcd + ab5425f commit c09fa4e

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
@@ -830,8 +830,10 @@ def create_argument_parser():
830830
option('--build-ninja', toggle_true,
831831
help='build the Ninja tool')
832832

833-
option(['--build-lld'], toggle_true('build_lld'),
833+
option(['--build-lld'], toggle_true('build_lld'), default=True,
834834
help='build lld as part of llvm')
835+
option(['--skip-build-lld'], toggle_false('build_lld'),
836+
help='skip building lld as part of llvm')
835837

836838
option('--skip-build-clang-tools-extra',
837839
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,
@@ -753,6 +753,7 @@ class BuildScriptImplOption(_BaseOption):
753753
DisableOption('--skip-build-zlib', dest='build_zlib'),
754754
DisableOption('--skip-build-curl', dest='build_curl'),
755755
DisableOption('--skip-build-compiler-rt', dest='build_compiler_rt'),
756+
DisableOption('--skip-build-lld', dest='build_lld'),
756757

757758
ChoicesOption('--compiler-vendor',
758759
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
@@ -463,16 +463,7 @@ def convert_to_impl_arguments(self):
463463
"--llvm-install-components=%s" % args.llvm_install_components
464464
]
465465

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

utils/swift_build_support/swift_build_support/products/llvm.py

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

327-
# Always build lld -- on non-Darwin so we can always have a
327+
# Building lld is on by default -- on non-Darwin so we can always have a
328328
# linker that is compatible with the swift we are using to
329329
# compile the stdlib, but on Darwin too for Embedded Swift use cases.
330330
#
331331
# This makes it easier to build target stdlibs on systems that
332332
# have old toolchains without more modern linker features.
333-
llvm_enable_projects.append('lld')
333+
if self.args.build_lld:
334+
llvm_enable_projects.append('lld')
334335

335336
llvm_cmake_options.define('LLVM_ENABLE_PROJECTS',
336337
';'.join(llvm_enable_projects))

0 commit comments

Comments
 (0)