Skip to content

Commit 6c0fe7c

Browse files
authored
Merge pull request #75375 from kubamracek/embedded-macho-builtins2
[embedded] Ask LLVM to build armv6 armv6m armv7 armv7m armv7em Mach-O builtins
2 parents d81f8db + 4f0d2e9 commit 6c0fe7c

File tree

1 file changed

+16
-0
lines changed
  • utils/swift_build_support/swift_build_support/products

1 file changed

+16
-0
lines changed

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,13 @@ def copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
142142
if not os.path.isfile(dest_lib_path):
143143
if os.path.isfile(host_lib_path):
144144
if _os == 'tvos':
145+
print('{} -> {} (stripping i386)'.format(
146+
host_lib_path, dest_lib_path))
145147
self.copy_lib_stripping_architecture(host_lib_path,
146148
dest_lib_path,
147149
'i386')
148150
else:
151+
print('{} -> {}'.format(host_lib_path, dest_lib_path))
149152
shutil.copy(host_lib_path, dest_lib_path)
150153
elif self.args.verbose_build:
151154
print('no file exists at {}'.format(host_lib_path))
@@ -161,9 +164,13 @@ def copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
161164
if _os == 'tvos':
162165
# This is to avoid strip failures when generating
163166
# a toolchain
167+
print('{} -> {} (stripping i386)'.format(
168+
host_sim_lib_path, dest_sim_lib_path))
164169
self.copy_lib_stripping_architecture(
165170
host_sim_lib_path, dest_sim_lib_path, 'i386')
166171
else:
172+
print('{} -> {}'.format(
173+
host_sim_lib_path, dest_sim_lib_path))
167174
shutil.copy(host_sim_lib_path, dest_sim_lib_path)
168175

169176
elif os.path.isfile(host_lib_path):
@@ -181,6 +188,8 @@ def copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
181188
shell.call(['lipo', '-remove', 'i386', host_lib_path,
182189
'-output', dest_sim_lib_path])
183190
else:
191+
print('{} -> {}'.format(host_lib_path,
192+
dest_sim_lib_path))
184193
shutil.copy(host_lib_path, dest_sim_lib_path)
185194
elif self.args.verbose_build:
186195
print('no file exists at {}', host_sim_lib_path)
@@ -195,6 +204,7 @@ def copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
195204
dest_lib_path = os.path.join(dest_builtins_dir, lib_name)
196205
if not os.path.isfile(dest_lib_path):
197206
if os.path.isfile(host_lib_path):
207+
print('{} -> {}'.format(host_lib_path, dest_lib_path))
198208
shutil.copy(host_lib_path, dest_lib_path)
199209
elif self.args.verbose_build:
200210
print('no file exists at {}'.format(host_lib_path))
@@ -286,6 +296,12 @@ def build(self, host_target):
286296
llvm_cmake_options.define('LLVM_ENABLE_LTO:STRING', self.args.lto_type)
287297
llvm_cmake_options.define('COMPILER_RT_INTERCEPT_LIBDISPATCH', 'ON')
288298

299+
if system() == 'Darwin':
300+
# Ask for Mach-O cross-compilation builtins (for Embedded Swift)
301+
llvm_cmake_options.define(
302+
'COMPILER_RT_FORCE_BUILD_BAREMETAL_MACHO_BUILTINS_ARCHS:STRING',
303+
'armv6 armv6m armv7 armv7m armv7em')
304+
289305
llvm_enable_projects = ['clang']
290306

291307
if self.args.build_compiler_rt and \

0 commit comments

Comments
 (0)