Skip to content

Commit b7c3cea

Browse files
[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` (rust-lang/compiler-team#607) - wasi-sdk: Renamed `wasm32-wasi` to `wasm32-wasip1` (WebAssembly/wasi-sdk#386) - Go: Already uses `wasip1` naming convention (golang/go#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**: #83167 - **Risk**: Low, just a change to Wasm Swift SDK - **Testing**: CI. - **Reviewers**: @MaxDesiatov
1 parent 7429124 commit b7c3cea

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ macro(configure_sdk_unix name architectures)
466466
if(SWIFT_ENABLE_WASI_THREADS)
467467
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1-threads")
468468
else()
469-
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasi")
469+
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasip1")
470470
endif()
471471
elseif("${prefix}" STREQUAL "EMSCRIPTEN")
472472
set(SWIFT_SDK_EMSCRIPTEN_ARCH_${arch}_TRIPLE "${arch}-unknown-emscripten")

utils/swift_build_support/swift_build_support/products/wasisysroot.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ def should_install(self, host_target):
4444
return False
4545

4646
def build(self, host_target):
47-
self._build(host_target)
47+
self._build(host_target, thread_model='single',
48+
target_triple='wasm32-wasip1')
4849
self._build(host_target, thread_model='posix',
4950
target_triple='wasm32-wasip1-threads')
5051

51-
def _build(self, host_target, thread_model='single', target_triple='wasm32-wasi'):
52+
def _build(self, host_target, thread_model, target_triple):
5253
build_root = os.path.dirname(self.build_dir)
5354
llvm_build_bin_dir = os.path.join(
5455
'..', build_root, '%s-%s' % ('llvm', host_target), 'bin')
@@ -83,14 +84,6 @@ def _build(self, host_target, thread_model='single', target_triple='wasm32-wasi'
8384
'TARGET_TRIPLE=' + target_triple,
8485
])
8586

86-
if target_triple == "wasm32-wasi":
87-
# Alias wasm32-wasip1 to wasm32-wasi as Embedded modules use
88-
# wasm32-unknown-wasip1 as the target triple.
89-
for subpath in ["lib", "include"]:
90-
dest_path = os.path.join(sysroot_install_path, subpath, "wasm32-wasip1")
91-
if not os.path.exists(dest_path):
92-
shell.symlink("wasm32-wasi", dest_path)
93-
9487
@classmethod
9588
def get_dependencies(cls):
9689
return [llvm.LLVM]
@@ -142,7 +135,7 @@ def build(self, host_target):
142135
self._build(host_target)
143136

144137
def _build(self, host_target, enable_wasi_threads=False,
145-
compiler_rt_os_dir='wasi', target_triple='wasm32-wasi'):
138+
compiler_rt_os_dir='wasip1', target_triple='wasm32-wasip1'):
146139
build_root = os.path.dirname(self.build_dir)
147140
llvm_build_bin_dir = os.path.join(
148141
'..', build_root, '%s-%s' % ('llvm', host_target), 'bin')

utils/swift_build_support/swift_build_support/products/wasmstdlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def should_test(self, host_target):
4141
return self.args.test_wasmstdlib
4242

4343
def build(self, host_target):
44-
self._build(host_target, 'wasm32-wasi', 'wasi-wasm32')
44+
self._build(host_target, 'wasm32-wasip1', 'wasip1-wasm32')
4545

4646
def _build(self, host_target, target_triple, short_triple):
4747
llvm_build_dir = self._configure_llvm(target_triple, short_triple)
@@ -169,10 +169,10 @@ def _build_stdlib(self, host_target, target_triple, llvm_cmake_dir):
169169
'SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING', 'TRUE')
170170
self.cmake_options.define(
171171
'SWIFT_SDK_embedded_ARCH_wasm32_PATH:PATH',
172-
self._wasi_sysroot_path("wasm32-wasi"))
172+
self._wasi_sysroot_path("wasm32-wasip1"))
173173
self.cmake_options.define(
174174
'SWIFT_SDK_embedded_ARCH_wasm32-unknown-wasip1_PATH:PATH',
175-
self._wasi_sysroot_path("wasm32-wasi"))
175+
self._wasi_sysroot_path("wasm32-wasip1"))
176176

177177
self.add_extra_cmake_options()
178178

utils/swift_build_support/swift_build_support/products/wasmswiftsdk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def build(self, host_target):
230230
# and header paths from the sysroot
231231
# https://github.com/llvm/llvm-project/blob/73ef397fcba35b7b4239c00bf3e0b4e689ca0add/clang/lib/Driver/ToolChains/WebAssembly.cpp#L29-L36
232232
for swift_host_triple, clang_multiarch_triple, build_basename, build_sdk, has_pthread in [
233-
('wasm32-unknown-wasi', 'wasm32-wasi', 'wasmstdlib', True, False),
233+
('wasm32-unknown-wasip1', 'wasm32-wasip1', 'wasmstdlib', True, False),
234234
# TODO: Include p1-threads in the Swift SDK once sdk-generator supports multi-target SDK
235235
# ('wasm32-unknown-wasip1-threads', 'wasm32-wasip1-threads',
236236
# 'wasmthreadsstdlib', False, True),

0 commit comments

Comments
 (0)