Skip to content

Conversation

@alexcrichton
Copy link
Collaborator

This commit updates wasi/api.h to be fully undefined on WASIp2 targets. This prevents leaking WASIp1 definitions on unapplicable targets, such as wasm32-wasip2 and the upcoming wasm32-wasip3.

This involved changing a number of #defines from something symbolic to a number literal. Static assertions throughout the codebase, already present, assert that these numbers match WASIp1 ABI values and for WASIp2+ these numbers are just a libc abstraction, not part of the ABI.

This commit updates `wasi/api.h` to be fully undefined on WASIp2
targets. This prevents leaking WASIp1 definitions on unapplicable
targets, such as `wasm32-wasip2` and the upcoming `wasm32-wasip3`.

This involved changing a number of `#define`s from something symbolic to
a number literal. Static assertions throughout the codebase, already
present, assert that these numbers match WASIp1 ABI values and for
WASIp2+ these numbers are just a libc abstraction, not part of the ABI.
@alexcrichton alexcrichton merged commit 8baf533 into WebAssembly:main Jan 5, 2026
24 checks passed
@alexcrichton alexcrichton deleted the less-wasip1-header branch January 5, 2026 19:03
alexcrichton added a commit to alexcrichton/wasi-libc that referenced this pull request Jan 5, 2026
This fixes the order `#define`s showed up in for C++ introduced in WebAssembly#694
to fix the inclusion of this repository into wasi-sdk. I don't know of a
great way to test this without building a whole C++ sysroot which seems
out-of-scope, so this is something I think will best be left for "try to
not break it and we'll catch it in wasi-sdk".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants