Skip to content

build-script: Remove support for legacy way of building compiler-rt #82124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ swift-install-components=back-deployment;compiler;clang-builtin-headers;libexec;
[preset: mixin_buildbot_install_components_with_clang]

swift-install-components=autolink-driver;back-deployment;compiler;clang-resource-dir-symlink;libexec;stdlib;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-xpc-service;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;libclang;dsymutil;LTO;clang-features-file;lld
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;dsymutil;LTO;clang-features-file;lld

[preset: mixin_buildbot_trunk_base]
# Build standard library and SDK overlay for iOS device and simulator.
Expand Down Expand Up @@ -848,7 +848,7 @@ no-swift-stdlib-assertions
[preset: mixin_linux_install_components_with_clang]

swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;libexec;stdlib;swift-remote-mirror;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-inproc
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;libclang;lld;LTO;clang-features-file
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;lld;LTO;clang-features-file

[preset: mixin_linux_installation]
mixin-preset=
Expand Down Expand Up @@ -3029,7 +3029,7 @@ darwin-toolchain-display-name-short=Swift Development Snapshot
darwin-toolchain-display-name=Swift Development Snapshot
darwin-toolchain-name=swift-DEVELOPMENT-SNAPSHOT
darwin-toolchain-version=3.999.999
llvm-install-components=clang;clang-resource-headers;compiler-rt;libclang;libclang-headers;dsymutil;clang-features-file
llvm-install-components=clang;clang-resource-headers;builtins;runtimes;libclang;libclang-headers;dsymutil;clang-features-file
swift-install-components=back-deployment;compiler;clang-builtin-headers;stdlib;libexec;sdk-overlay;license;sourcekit-xpc-service;sourcekit-inproc;swift-remote-mirror;swift-remote-mirror-headers
symbols-package=%(symbols_package)s
install-symroot=%(install_symroot)s
Expand Down Expand Up @@ -3186,7 +3186,7 @@ build-subdir=%(build_subdir)s
install-destdir=%(install_destdir)s

swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;toolchain-tools
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;compiler-rt;clang-features-file;llvm-symbolizer
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;builtins;runtimes;clang-features-file;llvm-symbolizer

install-llvm
install-swift
Expand Down Expand Up @@ -3218,7 +3218,7 @@ extra-cmake-options=
-DLLVM_TARGETS_TO_BUILD=AArch64;X86

swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;toolchain-tools;license
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;compiler-rt;clang-features-file;lld
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;builtins;runtimes;clang-features-file;lld

build-subdir=%(build_subdir)s
install-destdir=%(install_destdir)s
Expand Down Expand Up @@ -3256,7 +3256,7 @@ build-subdir=%(build_subdir)s
install-destdir=%(install_destdir)s

swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;toolchain-tools;license
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;compiler-rt;clang-features-file;lld
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;builtins;runtimes;clang-features-file;lld

install-llvm
install-swift
Expand Down
5 changes: 0 additions & 5 deletions utils/build_swift/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,11 +1437,6 @@ def create_argument_parser():
'existing options.',
default=[])

option('--llvm-build-compiler-rt-with-use-runtimes', toggle_true, default=True,
help='Switch to LLVM_ENABLE_RUNTIMES as the mechanism to build compiler-rt'
'It will become the default with LLVM 21, this flag is '
'meant to stage its introduction and account for edge cases')

# -------------------------------------------------------------------------
in_group('Build settings for Android')

Expand Down
2 changes: 0 additions & 2 deletions utils/build_swift/tests/expected_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@
'lldb_build_variant': 'Debug',
'lldb_build_with_xcode': '0',
'llvm_assertions': True,
'llvm_build_compiler_rt_with_use_runtimes': True,
'llvm_build_variant': 'Debug',
'llvm_cmake_options': [],
'llvm_enable_modules': False,
Expand Down Expand Up @@ -865,7 +864,6 @@ class BuildScriptImplOption(_BaseOption):
AppendOption('--llvm-ninja-targets-for-cross-compile-hosts'),
AppendOption('--llvm-cmake-options'),
AppendOption('--extra-llvm-cmake-options'),
EnableOption('--llvm-build-compiler-rt-with-use-runtimes'),
AppendOption('--darwin-symroot-path-filters'),

UnsupportedOption('--build-jobs'),
Expand Down
39 changes: 10 additions & 29 deletions utils/swift_build_support/swift_build_support/products/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,6 @@ def build(self, host_target):

if self.args.build_embedded_stdlib and system() == "Darwin":
# Ask for Mach-O cross-compilation builtins (for Embedded Swift)
llvm_cmake_options.define(
'COMPILER_RT_FORCE_BUILD_BAREMETAL_MACHO_BUILTINS_ARCHS:STRING',
'armv6 armv6m armv7 armv7m armv7em')
llvm_cmake_options.define(
f'BUILTINS_{builtins_runtimes_target_for_darwin}_'
'COMPILER_RT_FORCE_BUILD_BAREMETAL_MACHO_BUILTINS_ARCHS:'
Expand All @@ -369,28 +366,13 @@ def build(self, host_target):

if self.args.build_compiler_rt and \
not self.is_cross_compile_target(host_target):
if self.args.llvm_build_compiler_rt_with_use_runtimes:
llvm_enable_runtimes.append('compiler-rt')
# This accounts for previous incremental runs that may have set
# those in the LLVM CMakeCache.txt
llvm_cmake_options.undefine('LLVM_TOOL_COMPILER_RT_BUILD')
llvm_cmake_options.undefine('LLVM_BUILD_EXTERNAL_COMPILER_RT')
else:
# No need to unset anything,
# since we set LLVM_ENABLE_RUNTIMES explicitly
llvm_enable_projects.append('compiler-rt')
llvm_cmake_options.define(
'LLVM_TOOL_COMPILER_RT_BUILD:BOOL', 'TRUE')
llvm_cmake_options.define(
'LLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL', 'TRUE')
else:
if not self.args.llvm_build_compiler_rt_with_use_runtimes:
# No need to unset anything,
# since we set LLVM_ENABLE_RUNTIMES explicitly
llvm_cmake_options.define(
'LLVM_TOOL_COMPILER_RT_BUILD:BOOL', 'FALSE')
llvm_cmake_options.define(
'LLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL', 'FALSE')
llvm_enable_runtimes.append('compiler-rt')

# This accounts for previous incremental runs using the old
# way of build compiler_rt that may have set
# those in the LLVM CMakeCache.txt
llvm_cmake_options.undefine('LLVM_TOOL_COMPILER_RT_BUILD')
llvm_cmake_options.undefine('LLVM_BUILD_EXTERNAL_COMPILER_RT')

if self.args.build_clang_tools_extra:
llvm_enable_projects.append('clang-tools-extra')
Expand Down Expand Up @@ -572,10 +554,9 @@ def install(self, host_target):
self.args.llvm_install_components != 'all':
install_targets = []
components = self.args.llvm_install_components.split(';')
if self.args.llvm_build_compiler_rt_with_use_runtimes and \
'compiler-rt' in components:
if 'compiler-rt' in components:
# This is a courtesy fallback to avoid breaking downstream presets
# we are not aware of
# that are still using the old compiler-rt install component
components.remove('compiler-rt')
components.append('builtins')
components.append('runtimes')
Expand All @@ -586,7 +567,7 @@ def install(self, host_target):
for component in components:
if self.is_cross_compile_target(host_target) \
or not self.args.build_compiler_rt:
if component in ['compiler-rt', 'builtins', 'runtimes']:
if component in ['builtins', 'runtimes']:
continue
install_targets.append('install-{}'.format(component))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# REQUIRES: standalone_build
# REQUIRES: OS=linux-gnu

# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes --cmake %cmake 2>&1 | %FileCheck --check-prefix=LINUX %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes=1 --cmake %cmake 2>&1 | %FileCheck --check-prefix=LINUX %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --cmake %cmake 2>&1 | %FileCheck --check-prefix=LINUX %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes=0 --cmake %cmake 2>&1 | %FileCheck --check-prefix=LINUX %s

# LINUX: Building llvm
# LINUX-DAG: cmake -G Ninja
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# REQUIRES: OS=macosx

# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes --cmake %cmake 2>&1 | %FileCheck --check-prefix=LLVM-USE-RUNTIMES %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes=1 --cmake %cmake 2>&1 | %FileCheck --check-prefix=LLVM-USE-RUNTIMES %s
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --cmake %cmake 2>&1 | %FileCheck --check-prefix=LLVM-USE-RUNTIMES %s

# LLVM-USE-RUNTIMES: Building llvm
# LLVM-USE-RUNTIMES-DAG: cmake -G Ninja
Expand All @@ -16,13 +14,3 @@
# LLVM-USE-RUNTIMES-NOT: rtsan
# LLVM-USE-RUNTIMES-SAME: -DBUILTINS_{{[^ ]*}}_COMPILER_RT_FORCE_BUILD_BAREMETAL_MACHO_BUILTINS_ARCHS
# LLVM-USE-RUNTIMES-SAME: llvm

# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --cmake %cmake 2>&1 | %FileCheck --check-prefix=EXTERNAL-COMPILER-RT %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes=0 --cmake %cmake 2>&1 | %FileCheck --check-prefix=EXTERNAL-COMPILER-RT %s

# EXTERNAL-COMPILER-RT: Building llvm
# EXTERNAL-COMPILER-RT-DAG: cmake -G Ninja
# EXTERNAL-COMPILER-RT-SAME: -DCOMPILER_RT_FORCE_BUILD_BAREMETAL_MACHO_BUILTINS_ARCHS
# EXTERNAL-COMPILER-RT-SAME: llvm

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --cmake %cmake 2>&1 | %FileCheck --check-prefix=LLVM-USE-RUNTIMES %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes=1 --cmake %cmake 2>&1 | %FileCheck --check-prefix=LLVM-USE-RUNTIMES %s

# LLVM-USE-RUNTIMES: Building llvm
# LLVM-USE-RUNTIMES-DAG: cmake -G Ninja
# LLVM-USE-RUNTIMES-SAME: -ULLVM_TOOL_COMPILER_RT_BUILD
# LLVM-USE-RUNTIMES-SAME: -ULLVM_BUILD_EXTERNAL_COMPILER_RT
# LLVM-USE-RUNTIMES-SAME: -DLLVM_ENABLE_RUNTIMES{{[^ ]*}}={{[^ ]*}}compiler-rt
# LLVM-USE-RUNTIMES-SAME: runtimes
# LLVM-USE-RUNTIMES-SAME: llvm
# LLVM-USE-RUNTIMES-SAME: llvm{{$}}

# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --skip-build-compiler-rt --cmake %cmake 2>&1 | %FileCheck --check-prefix=DONT-BUILD-COMPILER-RT %s
# RUN: %empty-directory(%t)
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --skip-build --llvm-build-compiler-rt-with-use-runtimes=1 --skip-build-compiler-rt --cmake %cmake 2>&1 | %FileCheck --check-prefix=DONT-BUILD-COMPILER-RT %s

# DONT-BUILD-COMPILER-RT: Building llvm
# DONT-BUILD-COMPILER-RT-DAG: cmake -G Ninja
# DONT-BUILD-COMPILER-RT-NOT: LLVM_TOOL_COMPILER_RT_BUILD
# DONT-BUILD-COMPILER-RT-NOT: LLVM_BUILD_EXTERNAL_COMPILER_RT
# DONT-BUILD-COMPILER-RT-NOT: compiler-rt
# DONT-BUILD-COMPILER-RT-SAME: llvm
# DONT-BUILD-COMPILER-RT-SAME: -ULLVM_TOOL_COMPILER_RT_BUILD
# DONT-BUILD-COMPILER-RT-SAME: -ULLVM_BUILD_EXTERNAL_COMPILER_RT
# DONT-BUILD-COMPILER-RT-NOT: -DLLVM_ENABLE_RUNTIMES{{[^ ]*}}={{[^ ]*}}compiler-rt
# DONT-BUILD-COMPILER-RT-SAME: llvm{{$}}