Skip to content

std: Implement futex on wasip3 targets, update target spec#159731

Open
alexcrichton wants to merge 1 commit into
rust-lang:mainfrom
alexcrichton:wasip3-futex
Open

std: Implement futex on wasip3 targets, update target spec#159731
alexcrichton wants to merge 1 commit into
rust-lang:mainfrom
alexcrichton:wasip3-futex

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit is in preparation for eventual tier 2 status for the wasm32-wasip3 target. Initially this target will not have support for threads but it's expected to come ~later this year. The first step in supporting this is switching internal #[cfg] in the standard library to "ok this target has threads", and this commit is the update for synchronization primitives. All synchronization primitives on the wasm32-wasip3 now use a futex-based implementation, and the implementation of the futex itself is located in wasi-libc (see WebAssembly/wasi-libc#834). Other WASI targets can eventually all use this implementation as well, but wasi-libc's implementation of these symbols will need to percolate, so those targets aren't changed yet. For wasm32-wasip3, however, any supporting wasi-libc will have these symbols.

This then additionally fixes the target to actually build with a modern LLVM by passing a necessary flag to wasm-ld. This flag isn't supported until LLVM 23, but the wasm32-wasip3 target isn't fully supported until LLVM 23 anyway (hence its Tier 3 status currently).

@rustbot

rustbot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added O-wasi Operating system: Wasi, Webassembly System Interface S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 22, 2026
@rustbot

rustbot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

r? @clarfonthey

rustbot has assigned @clarfonthey.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

This commit is in preparation for eventual [tier 2 status] for the
`wasm32-wasip3` target. Initially this target will not have support for
threads but it's expected to come ~later this year. The first step in
supporting this is switching internal `#[cfg]` in the standard library
to "ok this target has threads", and this commit is the update for
synchronization primitives. All synchronization primitives on the
`wasm32-wasip3` now use a `futex`-based implementation, and the
implementation of the futex itself is located in wasi-libc (see
WebAssembly/wasi-libc/834). Other WASI targets can eventually all use
this implementation as well, but `wasi-libc`'s implementation of these
symbols will need to percolate, so those targets aren't changed yet. For
`wasm32-wasip3`, however, any supporting `wasi-libc` will have these
symbols.

This then additionally fixes the target to actually build with a modern
LLVM by passing a necessary flag to `wasm-ld`. This flag isn't supported
until LLVM 23, but the `wasm32-wasip3` target isn't fully supported
until LLVM 23 anyway (hence its Tier 3 status currently).

[tier 2 status]: rust-lang/compiler-team#1001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-wasi Operating system: Wasi, Webassembly System Interface S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants