diff --git a/schemes/main/build/build-target-toolchain.sh b/schemes/main/build/build-target-toolchain.sh index 45150107..f6ec3fa1 100755 --- a/schemes/main/build/build-target-toolchain.sh +++ b/schemes/main/build/build-target-toolchain.sh @@ -148,8 +148,6 @@ main() { -DSWIFT_STDLIB_CONCURRENCY_TRACING=NO \ -DSWIFT_RUNTIME_CRASH_REPORTER_CLIENT=NO \ -DSWIFT_STDLIB_INSTALL_PARENT_MODULE_FOR_SHIMS=NO \ - -DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY=NO \ - -DSWIFT_BUILD_STATIC_SDK_OVERLAY=NO \ " \ --llvm-cmake-options="\ -DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE='-DCMAKE_C_COMPILER=clang;-DCMAKE_CXX_COMPILER=clang++' \ diff --git a/schemes/main/build/run-test.sh b/schemes/main/build/run-test.sh index e8d89efd..a7f56671 100755 --- a/schemes/main/build/run-test.sh +++ b/schemes/main/build/run-test.sh @@ -6,4 +6,4 @@ SOURCE_PATH="$(cd "$(dirname "$0")/../../../.." && pwd)" TARGET_BUILD_ROOT="$SOURCE_PATH/build/WebAssembly" HOST_SUFFIX=$(find "$TARGET_BUILD_ROOT" -name "wasmstdlib-*" -exec basename {} \; | sed 's/wasmstdlib-//') -env "LIT_FILTER_OUT=(IRGen/|embedded/)" ninja check-swift-wasi-wasm32-custom -C "$TARGET_BUILD_ROOT/wasmstdlib-$HOST_SUFFIX" +env "PATH=$TARGET_BUILD_ROOT/llvm-$HOST_SUFFIX/bin:$PATH" "LIT_FILTER_OUT=(IRGen/|embedded/)" ninja check-swift-wasi-wasm32-custom -C "$TARGET_BUILD_ROOT/wasmstdlib-$HOST_SUFFIX" diff --git a/schemes/main/manifest.json b/schemes/main/manifest.json index 16ebb67c..492f3015 100644 --- a/schemes/main/manifest.json +++ b/schemes/main/manifest.json @@ -1,5 +1,5 @@ { - "base-tag": "swift-DEVELOPMENT-SNAPSHOT-2024-09-11-a", + "base-tag": "swift-DEVELOPMENT-SNAPSHOT-2024-09-17-a", "build-compiler": false, "icu4c": [ "https://github.com/swiftwasm/icu4c-wasi/releases/download/0.10.0/icu4c-wasm32-unknown-wasi.tar.xz", diff --git a/schemes/main/swift-corelibs-foundation/5061.patch b/schemes/main/swift-corelibs-foundation/5061.patch deleted file mode 100644 index 5304ae63..00000000 --- a/schemes/main/swift-corelibs-foundation/5061.patch +++ /dev/null @@ -1,357 +0,0 @@ -From 6a78203fc24702ed81a2b2bb2a9949168e694161 Mon Sep 17 00:00:00 2001 -From: Yuta Saito -Date: Thu, 8 Aug 2024 23:33:15 +0000 -Subject: [PATCH 1/3] [XMLParser] Use `TaskLocal` for storing the current - parser - -Instead of thread-local storage, use `TaskLocal` to store the current -parser. This solves three issues: - -1. If someone calls `XMLParser.parse()` with a new parser instance in - a delegate method call, it overwrote the current parser and wrote - it back after the call as `nil`, not the previous current parser. - This reentrancy issue can be a problem especially when someone uses - external entity resolving since the feature depends on the current - parser tracking. Using `TaskLocal` solves this issue since it tracks - values as a stack and restores the previous value at the end of the - `withValue` call. -2. Since jobs of different tasks can be scheduled on the same thread, - different tasks can refer to the same thread-local storage. This - wouldn't be a problem for now since the `parse()` method doesn't - have any suspention points and different tasks can't run on the same - thread during the parsing. However, it's better to use `TaskLocal` - to leverage the concurrency model of Swift. -3. The global variable `_currentParser` existed in the WASI platform - path but it's unsafe in the Swift concurrency model. It wouldn't be a - problem on WASI since it's always single-threaded, we should avoid - platform-specific assumption as much as possible. ---- - Sources/FoundationXML/XMLParser.swift | 85 ++++++++++----------------- - Tests/Foundation/TestXMLParser.swift | 43 +++++++++++++- - 2 files changed, 74 insertions(+), 54 deletions(-) - -diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift -index d89d0ee1f4..e3d718a86f 100644 ---- a/Sources/FoundationXML/XMLParser.swift -+++ b/Sources/FoundationXML/XMLParser.swift -@@ -398,9 +398,7 @@ extension XMLParser : @unchecked Sendable { } - - open class XMLParser : NSObject { - private var _handler: _CFXMLInterfaceSAXHandler --#if !os(WASI) - internal var _stream: InputStream? --#endif - internal var _data: Data? - - internal var _chunkSize = Int(4096 * 32) // a suitably large number for a decent chunk size -@@ -469,33 +467,35 @@ open class XMLParser : NSObject { - open var externalEntityResolvingPolicy: ExternalEntityResolvingPolicy = .never - - open var allowedExternalEntityURLs: Set? -- --#if os(WASI) -- private static var _currentParser: XMLParser? --#endif - -- internal static func currentParser() -> XMLParser? { --#if os(WASI) -- return _currentParser --#else -- if let current = Thread.current.threadDictionary["__CurrentNSXMLParser"] { -- return current as? XMLParser -- } else { -- return nil -+ /// The current parser is stored in a task local variable to allow for -+ /// concurrent parsing in different tasks with different parsers. -+ /// -+ /// Rationale for `@unchecked Sendable`: -+ /// While the ``XMLParser`` class itself is not `Sendable`, `TaskLocal` -+ /// requires the value type to be `Sendable`. The sendability requirement -+ /// of `TaskLocal` is only for the "default" value and values set with -+ /// `withValue` will not be shared between tasks. -+ /// So as long as 1. the default value is safe to be shared between tasks -+ /// and 2. the `Sendable` conformance of `_CurrentParser` is not used -+ /// outside of `TaskLocal`, it is safe to mark it as `@unchecked Sendable`. -+ private struct _CurrentParser: @unchecked Sendable { -+ let parser: XMLParser? -+ -+ static var `default`: _CurrentParser { -+ return _CurrentParser(parser: nil) - } --#endif -+ } -+ -+ @TaskLocal -+ private static var _currentParser: _CurrentParser = .default -+ -+ internal static func currentParser() -> XMLParser? { -+ return _currentParser.parser - } - -- internal static func setCurrentParser(_ parser: XMLParser?) { --#if os(WASI) -- _currentParser = parser --#else -- if let p = parser { -- Thread.current.threadDictionary["__CurrentNSXMLParser"] = p -- } else { -- Thread.current.threadDictionary.removeObject(forKey: "__CurrentNSXMLParser") -- } --#endif -+ internal static func withCurrentParser(_ parser: XMLParser, _ body: () -> R) -> R { -+ return self.$_currentParser.withValue(_CurrentParser(parser: parser), operation: body) - } - - internal func _handleParseResult(_ parseResult: Int32) -> Bool { -@@ -569,7 +569,6 @@ open class XMLParser : NSObject { - return result - } - --#if !os(WASI) - internal func parseFrom(_ stream : InputStream) -> Bool { - var result = true - -@@ -598,37 +597,17 @@ open class XMLParser : NSObject { - - return result - } --#else -- internal func parse(from data: Data) -> Bool { -- var result = true -- var chunkStart = 0 -- var chunkEnd = min(_chunkSize, data.count) -- while result && chunkStart < chunkEnd { -- let chunk = data[chunkStart.. Bool { --#if os(WASI) -- return _data.map { parse(from: $0) } ?? false --#else -- XMLParser.setCurrentParser(self) -- defer { XMLParser.setCurrentParser(nil) } -- -- if _stream != nil { -- return parseFrom(_stream!) -- } else if _data != nil { -- return parseData(_data!, lastChunkOfData: true) -+ return Self.withCurrentParser(self) { -+ if _stream != nil { -+ return parseFrom(_stream!) -+ } else if _data != nil { -+ return parseData(_data!, lastChunkOfData: true) -+ } -+ return false - } -- -- return false --#endif - } - - // called by the delegate to stop the parse. The delegate will get an error message sent to it. -diff --git a/Tests/Foundation/TestXMLParser.swift b/Tests/Foundation/TestXMLParser.swift -index c98741eb38..df3685a82e 100644 ---- a/Tests/Foundation/TestXMLParser.swift -+++ b/Tests/Foundation/TestXMLParser.swift -@@ -198,5 +198,46 @@ class TestXMLParser : XCTestCase { - ElementNameChecker("noPrefix").check() - ElementNameChecker("myPrefix:myLocalName").check() - } -- -+ -+ func testExternalEntity() throws { -+ class Delegate: XMLParserDelegateEventStream { -+ override func parserDidStartDocument(_ parser: XMLParser) { -+ // Start a child parser, updating `currentParser` to the child parser -+ // to ensure that `currentParser` won't be reset to `nil`, which would -+ // ignore any external entity related configuration. -+ let childParser = XMLParser(data: "".data(using: .utf8)!) -+ XCTAssertTrue(childParser.parse()) -+ super.parserDidStartDocument(parser) -+ } -+ } -+ try withTemporaryDirectory { dir, _ in -+ let greetingPath = dir.appendingPathComponent("greeting.xml") -+ try Data("".utf8).write(to: greetingPath) -+ let xml = """ -+ -+ -+ ]> -+ &greeting; -+ """ -+ -+ let parser = XMLParser(data: xml.data(using: .utf8)!) -+ // Explicitly disable external entity resolving -+ parser.externalEntityResolvingPolicy = .never -+ let delegate = Delegate() -+ parser.delegate = delegate -+ // The parse result changes depending on the libxml2 version -+ // because of the following libxml2 commit (shipped in libxml2 2.9.10): -+ // https://gitlab.gnome.org/GNOME/libxml2/-/commit/eddfbc38fa7e84ccd480eab3738e40d1b2c83979 -+ // So we don't check the parse result here. -+ _ = parser.parse() -+ XCTAssertEqual(delegate.events, [ -+ .startDocument, -+ .didStartElement("doc", nil, nil, [:]), -+ // Should not have parsed the external entity -+ .didEndElement("doc", nil, nil), -+ .endDocument, -+ ]) -+ } -+ } - } - -From 7a6125f16e07bb9cdd15e8bee5e7e2c283da4205 Mon Sep 17 00:00:00 2001 -From: Yuta Saito -Date: Fri, 9 Aug 2024 01:51:50 +0000 -Subject: [PATCH 2/3] Remove unnecessary `#if os(WASI)` condition in - XMLParser.swift - ---- - Sources/FoundationXML/XMLParser.swift | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift -index e3d718a86f..39eea6c3d8 100644 ---- a/Sources/FoundationXML/XMLParser.swift -+++ b/Sources/FoundationXML/XMLParser.swift -@@ -412,9 +412,6 @@ open class XMLParser : NSObject { - - // initializes the parser with the specified URL. - public convenience init?(contentsOf url: URL) { --#if os(WASI) -- return nil --#else - setupXMLParsing() - if url.isFileURL { - if let stream = InputStream(url: url) { -@@ -432,7 +429,6 @@ open class XMLParser : NSObject { - return nil - } - } --#endif - } - - // create the parser from data -@@ -448,7 +444,6 @@ open class XMLParser : NSObject { - _CFXMLInterfaceDestroyContext(_parserContext) - } - --#if !os(WASI) - //create a parser that incrementally pulls data from the specified stream and parses it. - public init(stream: InputStream) { - setupXMLParsing() -@@ -456,7 +451,6 @@ open class XMLParser : NSObject { - _handler = _CFXMLInterfaceCreateSAXHandler() - _parserContext = nil - } --#endif - - open weak var delegate: XMLParserDelegate? - - -From a4a80e1c2f6721b7e92e137d10dbf37dacb65be9 Mon Sep 17 00:00:00 2001 -From: Yuta Saito -Date: Fri, 23 Aug 2024 06:20:59 +0000 -Subject: [PATCH 3/3] Keep the current parser in TLS instead of TaskLocal - -TaskLocal storage is inherited by non-detached child tasks, which can -lead to the parser being shared between tasks. This is not our intention -and can lead to inconsistent state. Instead, we should keep the current -parser in thread-local storage. This should be safe as long as we don't -have any structured suspension points in `withCurrentParser` block. ---- - Sources/FoundationXML/XMLParser.swift | 65 ++++++++++++++++++--------- - 1 file changed, 44 insertions(+), 21 deletions(-) - -diff --git a/Sources/FoundationXML/XMLParser.swift b/Sources/FoundationXML/XMLParser.swift -index 39eea6c3d8..952c25cd58 100644 ---- a/Sources/FoundationXML/XMLParser.swift -+++ b/Sources/FoundationXML/XMLParser.swift -@@ -462,34 +462,57 @@ open class XMLParser : NSObject { - - open var allowedExternalEntityURLs: Set? - -- /// The current parser is stored in a task local variable to allow for -- /// concurrent parsing in different tasks with different parsers. -- /// -- /// Rationale for `@unchecked Sendable`: -- /// While the ``XMLParser`` class itself is not `Sendable`, `TaskLocal` -- /// requires the value type to be `Sendable`. The sendability requirement -- /// of `TaskLocal` is only for the "default" value and values set with -- /// `withValue` will not be shared between tasks. -- /// So as long as 1. the default value is safe to be shared between tasks -- /// and 2. the `Sendable` conformance of `_CurrentParser` is not used -- /// outside of `TaskLocal`, it is safe to mark it as `@unchecked Sendable`. -- private struct _CurrentParser: @unchecked Sendable { -- let parser: XMLParser? -- -- static var `default`: _CurrentParser { -- return _CurrentParser(parser: nil) -+ /// The current parser context for the current thread. -+ private class _CurrentParserContext { -+ var _stack: [XMLParser] = [] -+ var _current: XMLParser? { -+ return _stack.last - } - } - -- @TaskLocal -- private static var _currentParser: _CurrentParser = .default -+ #if os(WASI) -+ /// The current parser associated with the current thread. (assuming no multi-threading) -+ /// FIXME: Unify the implementation with the other platforms once we unlock `threadDictionary` -+ /// or migrate to `FoundationEssentials._ThreadLocal`. -+ private static nonisolated(unsafe) var _currentParserContext: _CurrentParserContext? -+ #else -+ /// The current parser associated with the current thread. -+ private static var _currentParserContext: _CurrentParserContext? { -+ get { -+ return Thread.current.threadDictionary["__CurrentNSXMLParser"] as? _CurrentParserContext -+ } -+ set { -+ Thread.current.threadDictionary["__CurrentNSXMLParser"] = newValue -+ } -+ } -+ #endif - -+ /// The current parser associated with the current thread. - internal static func currentParser() -> XMLParser? { -- return _currentParser.parser -+ if let ctx = _currentParserContext { -+ return ctx._current -+ } -+ return nil - } -- -+ -+ /// Execute the given closure with the current parser set to the given parser. - internal static func withCurrentParser(_ parser: XMLParser, _ body: () -> R) -> R { -- return self.$_currentParser.withValue(_CurrentParser(parser: parser), operation: body) -+ var ctx: _CurrentParserContext -+ if let current = _currentParserContext { -+ // Use the existing context if it exists -+ ctx = current -+ } else { -+ // Create a new context in TLS -+ ctx = _CurrentParserContext() -+ _currentParserContext = ctx -+ } -+ // Push the parser onto the stack -+ ctx._stack.append(parser) -+ defer { -+ // Pop the parser off the stack -+ ctx._stack.removeLast() -+ } -+ return body() - } - - internal func _handleParseResult(_ parseResult: Int32) -> Bool { diff --git a/schemes/main/swift/0001-wasm-Fix-cross-compilation-on-macOS-host-machine.patch b/schemes/main/swift/0001-wasm-Fix-cross-compilation-on-macOS-host-machine.patch new file mode 100644 index 00000000..f6c627ca --- /dev/null +++ b/schemes/main/swift/0001-wasm-Fix-cross-compilation-on-macOS-host-machine.patch @@ -0,0 +1,46 @@ +From 59cda3636a7fddb6e68e7c87f5737c6d127c98c8 Mon Sep 17 00:00:00 2001 +From: Yuta Saito +Date: Wed, 18 Sep 2024 17:11:23 +0000 +Subject: [PATCH 1/2] [wasm] Fix cross-compilation on macOS host machine + +We didn't set the CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR when +cross-compiling stdlib for WASI. This caused the build to fail on macOS +host machines as the build system was trying to build some overlays +assuming the target is macOS. +Additionally, add a default "SWIFT_HOST_VARIANT_SDK" for WASI target +even though we don't support it as a host system yet because it's +required anyway. +--- + CMakeLists.txt | 2 ++ + .../swift_build_support/products/wasmstdlib.py | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index edee1dd58e6..f04243464be 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -155,6 +155,8 @@ else() + set(SWIFT_HOST_VARIANT_SDK_default "ANDROID") + elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(SWIFT_HOST_VARIANT_SDK_default "OSX") ++ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "WASI") ++ set(SWIFT_HOST_VARIANT_SDK_default "WASI") + else() + message(FATAL_ERROR "Unable to detect SDK for host system: ${CMAKE_SYSTEM_NAME}") + endif() +diff --git a/utils/swift_build_support/swift_build_support/products/wasmstdlib.py b/utils/swift_build_support/swift_build_support/products/wasmstdlib.py +index 4d8beeaae8a..d042fc38038 100644 +--- a/utils/swift_build_support/swift_build_support/products/wasmstdlib.py ++++ b/utils/swift_build_support/swift_build_support/products/wasmstdlib.py +@@ -44,6 +44,8 @@ class WasmStdlib(cmake_product.CMakeProduct): + def _build(self, host_target, target_triple): + self.cmake_options.define('CMAKE_INSTALL_PREFIX:PATH', '/usr') + self.cmake_options.define('CMAKE_BUILD_TYPE:STRING', self._build_variant) ++ self.cmake_options.define('CMAKE_SYSTEM_NAME:STRING', 'WASI') ++ self.cmake_options.define('CMAKE_SYSTEM_PROCESSOR:STRING', 'wasm32') + self.cmake_options.define( + 'SWIFT_STDLIB_BUILD_TYPE:STRING', self._build_variant) + +-- +2.46.0 + diff --git a/schemes/main/swift/0002-wasm-Configure-LLVM-for-WebAssembly-target-independe.patch b/schemes/main/swift/0002-wasm-Configure-LLVM-for-WebAssembly-target-independe.patch new file mode 100644 index 00000000..eca2c256 --- /dev/null +++ b/schemes/main/swift/0002-wasm-Configure-LLVM-for-WebAssembly-target-independe.patch @@ -0,0 +1,123 @@ +From 24bd384f841df8f357fe35c6cc890cd7b15a4114 Mon Sep 17 00:00:00 2001 +From: Yuta Saito +Date: Thu, 19 Sep 2024 04:45:51 +0000 +Subject: [PATCH 2/2] [wasm] Configure LLVM for WebAssembly target + independently from the native LLVM build + +We have been using the host LLVM build directory to configure the Wasm +Swift stdlib. This has been working fine so far as the stdlib build is +configured with `CMAKE_SYSTEM_NAME` having host system name. However, +we fixed the stdlib build to use `WASI` as the system name properly in +the previous commit. This exposed the issue that the host LLVM build +directory is not suitable for configuring the stdlib build. +--- + .../products/wasmstdlib.py | 60 +++++++++++++++++-- + 1 file changed, 54 insertions(+), 6 deletions(-) + +diff --git a/utils/swift_build_support/swift_build_support/products/wasmstdlib.py b/utils/swift_build_support/swift_build_support/products/wasmstdlib.py +index d042fc38038..70299e37885 100644 +--- a/utils/swift_build_support/swift_build_support/products/wasmstdlib.py ++++ b/utils/swift_build_support/swift_build_support/products/wasmstdlib.py +@@ -17,6 +17,8 @@ from . import llvm + from . import swift + from . import wasisysroot + from . import wasmkit ++from .. import cmake ++from .. import shell + + + class WasmStdlib(cmake_product.CMakeProduct): +@@ -39,13 +41,52 @@ class WasmStdlib(cmake_product.CMakeProduct): + return self.args.test_wasmstdlib + + def build(self, host_target): +- self._build(host_target, 'wasm32-wasi') ++ self._build(host_target, 'wasm32-wasi', 'wasi-wasm32') + +- def _build(self, host_target, target_triple): ++ def _build(self, host_target, target_triple, short_triple): ++ llvm_build_dir = self._configure_llvm(target_triple, short_triple) ++ llvm_cmake_dir = os.path.join(llvm_build_dir, 'lib', 'cmake', 'llvm') ++ self._build_stdlib(host_target, target_triple, llvm_cmake_dir) ++ ++ def _configure_llvm(self, target_triple, short_triple): ++ # Configure LLVM for WebAssembly target independently ++ # from the native LLVM build to turn off zlib and libxml2 ++ build_root = os.path.dirname(self.build_dir) ++ build_dir = os.path.join( ++ build_root, 'llvm-%s' % short_triple) ++ llvm_source_dir = os.path.join( ++ os.path.dirname(self.source_dir), 'llvm-project', 'llvm') ++ cmake_options = cmake.CMakeOptions() ++ cmake_options.define('CMAKE_BUILD_TYPE:STRING', self._build_variant) ++ # compiler-rt for WebAssembly target is not installed in the host toolchain ++ # so skip compiler health checks here. ++ cmake_options.define('CMAKE_C_COMPILER_WORKS:BOOL', 'TRUE') ++ cmake_options.define('CMAKE_CXX_COMPILER_WORKS:BOOL', 'TRUE') ++ cmake_options.define('LLVM_COMPILER_CHECKED:BOOL', 'TRUE') ++ cmake_options.define('LLVM_ENABLE_ZLIB:BOOL', 'FALSE') ++ cmake_options.define('LLVM_ENABLE_LIBXML2:BOOL', 'FALSE') ++ cmake_options.define('LLVM_ENABLE_LIBEDIT:BOOL', 'FALSE') ++ cmake_options.define('LLVM_ENABLE_TERMINFO:BOOL', 'FALSE') ++ ++ llvm_cmake = cmake.CMake( ++ self.args, self.toolchain, prefer_native_toolchain=True) ++ # Only configure LLVM, not build it because we just need ++ # LLVM CMake functionalities ++ shell.call(["env", self.toolchain.cmake, "-B", build_dir] ++ + list(llvm_cmake.common_options(self)) ++ + list(cmake_options) ++ + [llvm_source_dir]) ++ return build_dir ++ ++ def _build_stdlib(self, host_target, target_triple, llvm_cmake_dir): + self.cmake_options.define('CMAKE_INSTALL_PREFIX:PATH', '/usr') + self.cmake_options.define('CMAKE_BUILD_TYPE:STRING', self._build_variant) ++ # Teach about the WebAssembly target. UNIX is explicitly set to TRUE ++ # as CMake still doesn't recognize WASI as a UNIX platform and the ++ # variable is used in LLVM CMake configuration. + self.cmake_options.define('CMAKE_SYSTEM_NAME:STRING', 'WASI') + self.cmake_options.define('CMAKE_SYSTEM_PROCESSOR:STRING', 'wasm32') ++ self.cmake_options.define('UNIX:BOOL', 'TRUE') + self.cmake_options.define( + 'SWIFT_STDLIB_BUILD_TYPE:STRING', self._build_variant) + +@@ -71,9 +112,13 @@ class WasmStdlib(cmake_product.CMakeProduct): + self.cmake_options.define('SWIFT_WASI_SYSROOT_PATH:STRING', + self._wasi_sysroot_path(target_triple)) + +- # It's ok to use the host LLVM build dir just for CMake functionalities +- llvm_cmake_dir = os.path.join(self._host_llvm_build_dir( +- host_target), 'lib', 'cmake', 'llvm') ++ # compiler-rt for WebAssembly target is not installed in the host toolchain ++ # so skip compiler health checks here. ++ self.cmake_options.define('CMAKE_C_COMPILER_WORKS:BOOL', 'TRUE') ++ self.cmake_options.define('CMAKE_CXX_COMPILER_WORKS:BOOL', 'TRUE') ++ self.cmake_options.define('CMAKE_Swift_COMPILER_WORKS:BOOL', 'TRUE') ++ self.cmake_options.define('LLVM_COMPILER_CHECKED:BOOL', 'TRUE') ++ + self.cmake_options.define('LLVM_DIR:PATH', llvm_cmake_dir) + + # Standalone stdlib configuration +@@ -90,6 +135,9 @@ class WasmStdlib(cmake_product.CMakeProduct): + self.cmake_options.define('SWIFT_BUILD_STATIC_STDLIB:BOOL', 'TRUE') + self.cmake_options.define('SWIFT_BUILD_DYNAMIC_STDLIB:BOOL', 'FALSE') + self.cmake_options.define('SWIFT_BUILD_STATIC_SDK_OVERLAY:BOOL', 'TRUE') ++ # TODO: Turn off library evolution once we establish a good way to teach ++ # libraries including swift-testing whether to use the stable ABI. ++ self.cmake_options.define('SWIFT_STDLIB_STABLE_ABI:BOOL', 'TRUE') + self.cmake_options.define('SWIFT_STDLIB_TRACING:BOOL', 'FALSE') + self.cmake_options.define('SWIFT_STDLIB_HAS_ASLR:BOOL', 'FALSE') + self.cmake_options.define('SWIFT_STDLIB_CONCURRENCY_TRACING:BOOL', 'FALSE') +@@ -200,7 +248,7 @@ class WasmStdlib(cmake_product.CMakeProduct): + + class WasmThreadsStdlib(WasmStdlib): + def build(self, host_target): +- self._build(host_target, 'wasm32-wasip1-threads') ++ self._build(host_target, 'wasm32-wasip1-threads', 'wasip1-threads-wasm32') + + def should_test_executable(self): + # TODO(katei): Enable tests once WasmKit supports WASI threads +-- +2.46.0 +