Skip to content

Use LLVM runtimes build #60993

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

Closed
wants to merge 12 commits into from
Closed
29 changes: 26 additions & 3 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;stdlib;s
[preset: mixin_buildbot_install_components_with_clang]

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

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

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

[preset: mixin_linux_compiler_rt_configuration]
# When configuring the builtins CMake project
# the detection of the features is done generating
# static archives, and that leads to incorrectly
# detect we can build for x86 -- while the bots
# do not have the content to target it
# We then need to manually override the detection logic
# to avoid build failures
extra-cmake-options=
-DBUILTINS_CMAKE_ARGS:STRING="-DCAN_TARGET_i386:BOOL=OFF"
# This is to prevent failures in linking
# tsan_interceptors_dispatch as part of libclang_rt.tsan
# We are now inheriting the -Wl,-z,defs linker flags
# from HandleLLVMOptions.cmake, so the compiler now complains
# for BlocksRuntime symbols that are undefined
-DCOMPILER_RT_INTERCEPT_LIBDISPATCH:BOOL=OFF
# Swift seems to expect the old layout for the runtime directory
-DRUNTIMES_CMAKE_ARGS=-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR:BOOL=OFF

[preset: mixin_linux_installation]
mixin-preset=
mixin_linux_install_components_with_clang
mixin_linux_compiler_rt_configuration

llbuild
swiftpm
Expand Down Expand Up @@ -1082,6 +1102,9 @@ install-destdir=%(install_destdir)s
installable-package=%(installable_package)s

[preset: buildbot_incremental_linux_base]
mixin-preset=
mixin_linux_compiler_rt_configuration

assertions
release

Expand Down Expand Up @@ -2633,7 +2656,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;sdk-overlay;license;sourcekit-xpc-service;swift-remote-mirror;swift-remote-mirror-headers
symbols-package=%(symbols_package)s
install-symroot=%(install_symroot)s
Expand Down
33 changes: 8 additions & 25 deletions utils/build-script-impl
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -780,21 +780,6 @@ function set_build_options_for_host() {
;;
esac


# We don't currently support building compiler-rt for cross-compile targets.
# It's not clear that's useful anyway.
if [[ $(is_cross_tools_host "${host}") ]] ; then
llvm_cmake_options+=(
-DLLVM_TOOL_COMPILER_RT_BUILD:BOOL=FALSE
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=FALSE
)
else
llvm_cmake_options+=(
-DLLVM_TOOL_COMPILER_RT_BUILD:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
)
fi

# If we are asked to not generate test targets for LLVM and or Swift,
# disable as many LLVM tools as we can. This improves compile time when
# compiling with LTO.
Expand Down Expand Up @@ -1816,9 +1801,12 @@ for host in "${ALL_HOSTS[@]}"; do
)

llvm_enable_projects=("clang")
llvm_enable_runtimes=("")

if [[ ! "${SKIP_BUILD_COMPILER_RT}" && ! $(is_cross_tools_host ${host}) ]]; then
llvm_enable_projects+=("compiler-rt")
llvm_enable_runtimes+=("compiler-rt")
build_targets=("${build_targets[@]}"
runtimes)
fi

if [[ ! "${SKIP_BUILD_CLANG_TOOLS_EXTRA}" ]]; then
Expand All @@ -1831,15 +1819,10 @@ for host in "${ALL_HOSTS[@]}"; do

cmake_options+=(
-DLLVM_ENABLE_PROJECTS="$(join ";" ${llvm_enable_projects[@]})"
# In the near future we are aiming to build compiler-rt with
# LLVM_ENABLE_RUNTIMES
# Until that happens, we need to unset this variable from
# LLVM CMakeCache.txt for two reasons
# * prevent PRs testing this variable to affect other runs landing
# unrelated features
# * avoid fallouts should we land such change and then have to revert
# it to account for unforeseen regressions
-ULLVM_ENABLE_RUNTIMES

-DLLVM_ENABLE_RUNTIMES="$(join ";" ${llvm_enable_runtimes[@]})"
-ULLVM_TOOL_COMPILER_RT_BUILD
-ULLVM_BUILD_EXTERNAL_COMPILER_RT
)

# NOTE: This is not a dead option! It is relied upon for certain
Expand Down