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
36 changes: 33 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 @@ -802,7 +802,7 @@ 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_installation]
mixin-preset=
Expand Down Expand Up @@ -852,6 +852,21 @@ installable-package=%(installable_package)s
# in Linux CI bots
relocate-xdg-cache-home-under-build-subdir

# 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

[preset: buildbot_linux]
mixin-preset=mixin_linux_installation
Expand Down Expand Up @@ -1084,6 +1099,21 @@ reconfigure
# in Linux CI bots
relocate-xdg-cache-home-under-build-subdir

# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be turned off, otherwise we will break TSan. @edymtt

Can we fix the undefined references by linking the blocks runtime -fblocks?

The CMake code here is trying to do this:
https://github.com/llvm/llvm-project/blob/f418f88824905c372cb9252b3f675012a3fc799d/compiler-rt/CMakeLists.txt#L172

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try explore that -- to the best of my understanding that is not present in CI nodes, and we are building that ourselves when we are building Swift, but likely I'm missing something


[preset: buildbot_incremental_linux]
mixin-preset=
Expand Down Expand Up @@ -2611,7 +2641,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
21 changes: 5 additions & 16 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -777,21 +777,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 @@ -1803,9 +1788,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 @@ -1818,6 +1806,7 @@ for host in "${ALL_HOSTS[@]}"; do

cmake_options+=(
-DLLVM_ENABLE_PROJECTS="$(join ";" ${llvm_enable_projects[@]})"
-DLLVM_ENABLE_RUNTIMES="$(join ";" ${llvm_enable_runtimes[@]})"
)

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