Skip to content

Reenable build of compiler-rt with LLVM_ENABLE_RUNTIMES in Linux bots... #81386

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
3 changes: 0 additions & 3 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,6 @@ mixin-preset=

skip-test-swiftdocc

# to allow to build under aarch64
llvm-build-compiler-rt-with-use-runtime=0

[preset: buildbot_linux,release_foundation_tests]
mixin-preset=buildbot_linux

Expand Down
24 changes: 20 additions & 4 deletions utils/swift_build_support/swift_build_support/products/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ def build(self, host_target):
llvm_cmake_options.define('INTERNAL_INSTALL_PREFIX', 'local')

if host_target.startswith('linux'):
toolchain_file = self.generate_linux_toolchain_file(platform, arch)
toolchain_file = self.generate_linux_toolchain_file(
platform, arch,
crosscompiling=self.is_cross_compile_target(host_target))
llvm_cmake_options.define('CMAKE_TOOLCHAIN_FILE:PATH', toolchain_file)
if not self.is_release():
# On Linux build LLVM and subprojects with -gsplit-dwarf which is more
Expand Down Expand Up @@ -309,12 +311,26 @@ def build(self, host_target):
if host_target.startswith('linux'):
# This preserves the behaviour we had when using
# LLVM_BUILD_EXTERNAL COMPILER_RT --
# that is, having the linker not complaing if symbols used
# that is, having the linker not complaining if symbols used
# by TSan are undefined (namely the ones for Blocks Runtime)
# In the long term, we want to remove this and
# build Blocks Runtime before LLVM
llvm_cmake_options.define(
'SANITIZER_COMMON_LINK_FLAGS:STRING', '-Wl,-z,undefs')
if ("-DCLANG_DEFAULT_LINKER=gold" in llvm_cmake_options
or "-DCLANG_DEFAULT_LINKER:STRING=gold" in llvm_cmake_options):
print("Assuming just built clang will use a gold linker -- "
"if that's not the case, please adjust the value of "
"`SANITIZER_COMMON_LINK_FLAGS` in `extra-llvm-cmake-options`",
flush=True)
llvm_cmake_options.define(
'SANITIZER_COMMON_LINK_FLAGS:STRING',
'-Wl,--unresolved-symbols,ignore-in-object-files')
else:
print("Assuming just built clang will use a non gold linker -- "
"if that's not the case, please adjust the value of "
"`SANITIZER_COMMON_LINK_FLAGS` in `extra-llvm-cmake-options`",
flush=True)
llvm_cmake_options.define(
'SANITIZER_COMMON_LINK_FLAGS:STRING', '-Wl,-z,undefs')

builtins_runtimes_target_for_darwin = f'{arch}-apple-darwin'
if system() == "Darwin":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def get_linux_target(self, platform, arch):
sysroot_arch, vendor, abi = self.get_linux_target_components(arch)
return '{}-{}-linux-{}'.format(sysroot_arch, vendor, abi)

def generate_linux_toolchain_file(self, platform, arch):
def generate_linux_toolchain_file(self, platform, arch, crosscompiling=True):
"""
Generates a new CMake tolchain file that specifies Linux as a target
platform.
Expand All @@ -402,8 +402,9 @@ def generate_linux_toolchain_file(self, platform, arch):

toolchain_args = {}

toolchain_args['CMAKE_SYSTEM_NAME'] = 'Linux'
toolchain_args['CMAKE_SYSTEM_PROCESSOR'] = arch
if crosscompiling:
toolchain_args['CMAKE_SYSTEM_NAME'] = 'Linux'
toolchain_args['CMAKE_SYSTEM_PROCESSOR'] = arch

# We only set the actual sysroot if we are actually cross
# compiling. This is important since otherwise cmake seems to change the
Expand Down