Skip to content

Conversation

@alexcrichton
Copy link
Collaborator

Almost all functions are stubbed out to return errors. This is all done
in preparation for eventually filling out these functions, but the goal
of this commit is to lay down the scaffolding of the target rather than
actually implement anything.

CI jobs are added to build and test this target. Most tests are expected
to fail, but all tests are still run as usual. Once tests are passing
they'll be updated in CMakeLists.txt to flag the test as expected to
pass instead of expected to fail.

This is a very large PR line-wise, but all the major changes with large
chunks of code are generated code and are expected to be easy to review.
The actual changes here in the source are primarily:

  • Adding #elif defined(__wasip3__) cases
  • Sometimes using the WASIp2 definitions of functions for WASIp3
  • Shuffling naming in the network utilities to support both WASIp2 and
    WASIp3 which have the same types, just renamed.
  • Generated bindings for WASIp3 are now vendored like WASIp2 bindings.
  • Wasmtime is updated for testing to be able to run generated WASIp3
    binaries.

@alexcrichton
Copy link
Collaborator Author

Procedurally, I wanted to open this to showcase my thoughts on what wasm32-wasip3 will look like. This isn't ready for usage (everything, including printing, returns an error and is unimplemented) nor distribution. What it is ready for, however, would be to incrementally land implementations of functions after this PR.

This is split up into a number of commits that I plan to land as separate PRs. For example:

@cpetig
Copy link

cpetig commented Dec 28, 2025

I have a first working stdout implementation for p3 based on this patch at https://github.com/cpetig/wasi-libc/tree/wasip3 .

I guess that p3 needs some more infrastructure (exports_wasi_cli_run_result_void_void_t, exports_wasi_cli_run_run_return, ...) to define wasi:cli/run.run (added in my patch) but this should become a separate object file from wasip3.o to enable reactor type binaries. (In Rust I would use --with to separate the non cli-run parts in wit-bindgen, I think C doesn't have this functionality, yet)

@cpetig
Copy link

cpetig commented Dec 28, 2025

PS:
I can separate the stdout implementation (non-controversial) from run whenever you feel this would be helpful.

@cpetig
Copy link

cpetig commented Dec 28, 2025

See also alexcrichton#1

@alexcrichton
Copy link
Collaborator Author

Thanks! My plan was to land implementation work of actual interfaces as separate PRs to make them easier to review so I'm going to hold off on merging that into this PR's branch, but @cpetig would you be willing to do a follow-up once this PR lands? I'd be happy to review!

@alexcrichton alexcrichton mentioned this pull request Jan 5, 2026
@alexcrichton alexcrichton force-pushed the wasip3 branch 3 times, most recently from 211b32a to 6cb5a05 Compare January 6, 2026 05:51
@cpetig
Copy link

cpetig commented Jan 6, 2026

Thanks! My plan was to land implementation work of actual interfaces as separate PRs to make them easier to review so I'm going to hold off on merging that into this PR's branch, but @cpetig would you be willing to do a follow-up once this PR lands? I'd be happy to review!

😉 My plan with alexcrichton#1 was to show that there is benefit in getting this PR merged even in its incomplete state.

I will rebase the patches and move discussion to https://github.com/WebAssembly/wasi-libc/pulls once this PR is merged.

Almost all functions are stubbed out to return errors. This is all done
in preparation for eventually filling out these functions, but the goal
of this commit is to lay down the scaffolding of the target rather than
actually implement anything.

CI jobs are added to build and test this target. Most tests are expected
to fail, but all tests are still run as usual. Once tests are passing
they'll be updated in `CMakeLists.txt` to flag the test as expected to
pass instead of expected to fail.

This is a very large PR line-wise, but all the major changes with large
chunks of code are generated code and are expected to be easy to review.
The actual changes here in the source are primarily:

* Adding `#elif defined(__wasip3__)` cases
* Sometimes using the WASIp2 definitions of functions for WASIp3
* Shuffling naming in the network utilities to support both WASIp2 and
  WASIp3 which have the same types, just renamed.
* Generated bindings for WASIp3 are now vendored like WASIp2 bindings.
* Wasmtime is updated for testing to be able to run generated WASIp3
  binaries.
@alexcrichton alexcrichton marked this pull request as ready for review January 6, 2026 19:26
@alexcrichton
Copy link
Collaborator Author

Ok all the requisite pieces have now landed so this should be good to go

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