Skip to content

Commit 7d9f885

Browse files
committed
Rename wasm32-wasi-threads target to wasm32-wasi-preview1-threads
Threading support is based on the [wasi-threads](https://github.com/WebAssembly/wasi-threads/) proposal. It was agreed that the proposal will not be included in any of the WASI releases; instead, there's [another proposal](https://github.com/abrown/thread-spawn) which adds spawning threads functionality to the WASM core. `wasm32-wasi-threads` is quite a nice name for the long-term solution, therefore I think it should be reserved for the `thread-spawn` proposal and use it once the proposal is ready. Given we'd like to support both `wasi-threads` and `thread-spawn` (at least for some time), I'm proposing adding another target specifically for wasi threads. I used the `wasm32-wasi-preview1-threads` target as the proposal kind of builds on top of wsp1. It's also the same as the [Rust target](https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md). I don't have strong opininion about the name and I'm open for suggestions; if there's a better name for that target, I'd be happy to update the PR. I keep both `wasm32-wasi-threads` and `wasm32-wasi-preview1-threads` for backward/forward compatibility. I know that `wasm32-wasi-threads` was considered experimental and would probably be safe to delete, but at the same time I think keeping it around is very little effort and can be re-used for thread-spawn in the future. If anybody thinks it's confusing and not worth it, happy to remove it. I also updated the `thread-spawn` import to be consistent with other wsp1 imports.
1 parent ec4566b commit 7d9f885

File tree

8 files changed

+5025
-5
lines changed

8 files changed

+5025
-5
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,15 @@ jobs:
110110
name: ${{ format( 'sysroot-{0}.tgz', matrix.os) }}
111111
path: sysroot
112112

113-
- name: Build libc + threads
113+
- name: Build libc + threads (wasm32-wasi-preview1-threads)
114+
# Only build the thread-capable wasi-libc in the latest supported Clang
115+
# version; the earliest version does not have all necessary builtins
116+
# (e.g., `__builtin_wasm_memory_atomic_notify`).
117+
if: matrix.clang_version != '10.0.0'
118+
shell: bash
119+
run: make -j4 THREAD_MODEL=posix THREAD_IMPL=wasi-threads
120+
121+
- name: Build libc + threads (wasm32-wasi-threads)
114122
# Only build the thread-capable wasi-libc in the latest supported Clang
115123
# version; the earliest version does not have all necessary builtins
116124
# (e.g., `__builtin_wasm_memory_atomic_notify`).

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,15 @@ TARGET_TRIPLE = wasm32-wasi
3838
# Threaded version necessitates a different traget, as objects from different
3939
# targets can't be mixed together while linking.
4040
ifeq ($(THREAD_MODEL), posix)
41+
ifeq ($(THREAD_IMPL), wasi-threads)
42+
TARGET_TRIPLE = wasm32-wasi-preview1-threads
43+
else
44+
# The target tripple is deprecated and only kept for backward compatibility.
45+
# This target will most likely be re-used for implementing thread-spawn proposal
46+
# in the future.
4147
TARGET_TRIPLE = wasm32-wasi-threads
4248
endif
49+
endif
4350

4451
# These variables describe the locations of various files and directories in
4552
# the source tree.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ cross-compiled builds of compiler-rt, `libc++.a`, and `libc++abi.a`.
5050

5151
To enable pthreads support via the [wasi-threads] proposal, follow the above
5252
build directions with one addition: `make ... THREAD_MODEL=posix`. This creates
53-
additional artifacts in `sysroot/lib/wasm32-wasi-threads` to support `--target
54-
wasm32-wasi-threads`.
53+
additional artifacts in `sysroot/lib/wasm32-wasi-preview1-threads` to support `--target
54+
wasm32-wasi-preview1-threads`.
5555

5656
## Arch Linux AUR package
5757

0 commit comments

Comments
 (0)