mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Reenable build of compiler-rt with LLVM_ENABLE_RUNTIMES in Linux bots...
...we disabled in #81354 This requires a couple of supporting changes * under Linux, do not cross compile LLVM when building for the host architecture -- that will ensure that the compiler-rt build will use the just built compiler and not the system one (which may not be new enough for this purpose); * provide sanitizer flags depending on the linker the just built compiler will use -- this detection is brittle, so print a message advising the user how to override this. Addresses rdar://150849329
This commit is contained in:
@@ -242,7 +242,9 @@ class LLVM(cmake_product.CMakeProduct):
|
||||
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
|
||||
@@ -309,10 +311,24 @@ class LLVM(cmake_product.CMakeProduct):
|
||||
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
|
||||
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')
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ class Product(object):
|
||||
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.
|
||||
@@ -402,6 +402,7 @@ class Product(object):
|
||||
|
||||
toolchain_args = {}
|
||||
|
||||
if crosscompiling:
|
||||
toolchain_args['CMAKE_SYSTEM_NAME'] = 'Linux'
|
||||
toolchain_args['CMAKE_SYSTEM_PROCESSOR'] = arch
|
||||
|
||||
|
||||
Reference in New Issue
Block a user