Skip to content

Commit 2549627

Browse files
Merge pull request #82123 from kateinoigakukun/yt/fix-swt-crash-wmo
2 parents c2271e2 + e46480e commit 2549627

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

utils/swift_build_support/swift_build_support/products/wasmswiftsdk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@ def _build_swift_testing(self, swift_host_triple, short_triple, wasi_sysroot):
6969
'CMAKE_Swift_COMPILER_TARGET', swift_host_triple)
7070
swift_testing.cmake_options.define('CMAKE_SYSROOT', wasi_sysroot)
7171
swift_resource_dir = os.path.join(dest_dir, 'usr', 'lib', 'swift_static')
72+
# For statically linked objects in an archive, we have to use singlethreaded
73+
# LLVM codegen unit to prevent runtime metadata sections from being stripped
74+
# at link-time.
7275
swift_testing.cmake_options.define(
7376
'CMAKE_Swift_FLAGS',
74-
f'-sdk {wasi_sysroot} -resource-dir {swift_resource_dir}')
77+
f'-sdk {wasi_sysroot} -resource-dir {swift_resource_dir} -Xfrontend -enable-single-module-llvm-emission')
7578
clang_resource_dir = os.path.join(dest_dir, 'usr', 'lib', 'clang')
7679
swift_testing.cmake_options.define(
7780
'CMAKE_CXX_FLAGS', f'-resource-dir {clang_resource_dir}')

0 commit comments

Comments
 (0)