mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[6.2][wasm] Rename wasm32-unknown-wasi to wasm32-unknown-wasip1 (#83199)
- **Explanation**: Renames the WebAssembly target triple from `wasm32-unknown-wasi` to `wasm32-unknown-wasip1` to align with the broader WebAssembly ecosystem's naming conventions. It's important to include this in 6.2, which is going to be the first stable release of Swift SDK for Wasm, so that we won't introduce a breaking triple change in the stable version series later. The WebAssembly ecosystem has been migrating from the generic wasi target name to more explicit version-specific names like `wasip1` and `wasip2`. This change has been adopted across multiple toolchains and language ecosystems: - Rust: Renamed `wasm32-wasi` to `wasm32-wasip1` (https://github.com/rust-lang/compiler-team/issues/607) - wasi-sdk: Renamed `wasm32-wasi` to `wasm32-wasip1` (https://github.com/WebAssembly/wasi-sdk/pull/386) - Go: Already uses `wasip1` naming convention (https://github.com/golang/go/issues/58141) The "p1" suffix explicitly indicates WASI Preview 1, which helps distinguish it from the newer WASI Preview 2 (wasip2) and provides clarity about which version of the WASI specification is being targeted. Also we already use `wasm32-unknown-wasip1` for Embedded WASI target, and having different names for Embedded and non-Embedded is confusing users. - **Scope**: Narrow, only affects Wasm Swift SDK. - **Original PRs**: https://github.com/swiftlang/swift/pull/83167 - **Risk**: Low, just a change to Wasm Swift SDK - **Testing**: CI. - **Reviewers**: @MaxDesiatov
This commit is contained in:
@@ -466,7 +466,7 @@ macro(configure_sdk_unix name architectures)
|
||||
if(SWIFT_ENABLE_WASI_THREADS)
|
||||
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1-threads")
|
||||
else()
|
||||
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasi")
|
||||
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1")
|
||||
endif()
|
||||
elseif("${prefix}" STREQUAL "EMSCRIPTEN")
|
||||
set(SWIFT_SDK_EMSCRIPTEN_ARCH_${arch}_TRIPLE "${arch}-unknown-emscripten")
|
||||
|
||||
@@ -44,11 +44,12 @@ class WASILibc(product.Product):
|
||||
return False
|
||||
|
||||
def build(self, host_target):
|
||||
self._build(host_target)
|
||||
self._build(host_target, thread_model='single',
|
||||
target_triple='wasm32-wasip1')
|
||||
self._build(host_target, thread_model='posix',
|
||||
target_triple='wasm32-wasip1-threads')
|
||||
|
||||
def _build(self, host_target, thread_model='single', target_triple='wasm32-wasi'):
|
||||
def _build(self, host_target, thread_model, target_triple):
|
||||
build_root = os.path.dirname(self.build_dir)
|
||||
llvm_build_bin_dir = os.path.join(
|
||||
'..', build_root, '%s-%s' % ('llvm', host_target), 'bin')
|
||||
@@ -83,14 +84,6 @@ class WASILibc(product.Product):
|
||||
'TARGET_TRIPLE=' + target_triple,
|
||||
])
|
||||
|
||||
if target_triple == "wasm32-wasi":
|
||||
# Alias wasm32-wasip1 to wasm32-wasi as Embedded modules use
|
||||
# wasm32-unknown-wasip1 as the target triple.
|
||||
for subpath in ["lib", "include"]:
|
||||
dest_path = os.path.join(sysroot_install_path, subpath, "wasm32-wasip1")
|
||||
if not os.path.exists(dest_path):
|
||||
shell.symlink("wasm32-wasi", dest_path)
|
||||
|
||||
@classmethod
|
||||
def get_dependencies(cls):
|
||||
return [llvm.LLVM]
|
||||
@@ -142,7 +135,7 @@ class WasmLLVMRuntimeLibs(cmake_product.CMakeProduct):
|
||||
self._build(host_target)
|
||||
|
||||
def _build(self, host_target, enable_wasi_threads=False,
|
||||
compiler_rt_os_dir='wasi', target_triple='wasm32-wasi'):
|
||||
compiler_rt_os_dir='wasip1', target_triple='wasm32-wasip1'):
|
||||
build_root = os.path.dirname(self.build_dir)
|
||||
llvm_build_bin_dir = os.path.join(
|
||||
'..', build_root, '%s-%s' % ('llvm', host_target), 'bin')
|
||||
|
||||
@@ -41,7 +41,7 @@ class WasmStdlib(cmake_product.CMakeProduct):
|
||||
return self.args.test_wasmstdlib
|
||||
|
||||
def build(self, host_target):
|
||||
self._build(host_target, 'wasm32-wasi', 'wasi-wasm32')
|
||||
self._build(host_target, 'wasm32-wasip1', 'wasip1-wasm32')
|
||||
|
||||
def _build(self, host_target, target_triple, short_triple):
|
||||
llvm_build_dir = self._configure_llvm(target_triple, short_triple)
|
||||
@@ -169,10 +169,10 @@ class WasmStdlib(cmake_product.CMakeProduct):
|
||||
'SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING', 'TRUE')
|
||||
self.cmake_options.define(
|
||||
'SWIFT_SDK_embedded_ARCH_wasm32_PATH:PATH',
|
||||
self._wasi_sysroot_path("wasm32-wasi"))
|
||||
self._wasi_sysroot_path("wasm32-wasip1"))
|
||||
self.cmake_options.define(
|
||||
'SWIFT_SDK_embedded_ARCH_wasm32-unknown-wasip1_PATH:PATH',
|
||||
self._wasi_sysroot_path("wasm32-wasi"))
|
||||
self._wasi_sysroot_path("wasm32-wasip1"))
|
||||
|
||||
self.add_extra_cmake_options()
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ class WasmSwiftSDK(product.Product):
|
||||
# and header paths from the sysroot
|
||||
# https://github.com/llvm/llvm-project/blob/73ef397fcba35b7b4239c00bf3e0b4e689ca0add/clang/lib/Driver/ToolChains/WebAssembly.cpp#L29-L36
|
||||
for swift_host_triple, clang_multiarch_triple, build_basename, build_sdk, has_pthread in [
|
||||
('wasm32-unknown-wasi', 'wasm32-wasi', 'wasmstdlib', True, False),
|
||||
('wasm32-unknown-wasip1', 'wasm32-wasip1', 'wasmstdlib', True, False),
|
||||
# TODO: Include p1-threads in the Swift SDK once sdk-generator supports multi-target SDK
|
||||
# ('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
|
||||
# 'wasmthreadsstdlib', False, True),
|
||||
|
||||
Reference in New Issue
Block a user