Skip to content

Initial support for webp2 - #883

Merged
alexcrichton merged 99 commits into
WebAssembly:mainfrom
bvisness:webp2
Nov 9, 2026
Merged

alexcrichton merged 99 commits into
WebAssembly:mainfrom
bvisness:webp2

Conversation

@bvisness

@bvisness bvisness commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds initial support for a webp2 target. Filesystem and socket stuff is all stubbed out and should trap. Time and randomness functionality has been implemented using web APIs. Absolutely none of this has yet been tested in any meaningful way, and I'm quite confident that some stuff must be wildly incomplete. But if you're interested, you can take a look and see if I'm doing things in a generally reasonable way.

  • Figure out exec model stuff (reactor + _initialize hook)
  • Depend on actual release of wit-bindgen with accessor support
  • Tests!

See also:

@bvisness

bvisness commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

What happened here? Did they just time out or something?

@alexcrichton

Copy link
Copy Markdown
Collaborator

ah probably today's github actions incident, I restarted

@alexcrichton

Copy link
Copy Markdown
Collaborator

Overall looks good yeah. Main comment is I'd recommend going over all the webp2-specific locations and removing the webp2-specific logic where possible. My hope is that only where things bottom out in wasip2/wasip3/webp2 differing implementations is where the unsupported log would be necessary as opposed to each layer of functions (e.g. usleep calls clock_nanosleep so they don't both need webp2-specific things).

Many logs of unsupported functions have been removed since they will
fall back on deeper functions that will also fail. Additionally, there
are now fewer webp2-specific exceptions in the build.
I didn't know they were supposed to be atomic.
@bvisness

Copy link
Copy Markdown
Contributor Author

@alexcrichton Ready for another review. I went over every single changed file again and tried to make sure that everything was delegating to existing implementations as much as possible. Much of the diff is now adding webp2 to existing ifdefs. And I tried to clean up unnecessary includes that were left over from previous updates. Some includes were alphabetized but hopefully there shouldn't be any lingering useless ones.

I will fix up the dumb CI mistakes in the meantime.

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I believe I've now covered and looked at everything in this PR now, thanks for your patience! My main comment here below is about buffering and stdio -- you commented above as well and I think it'd be appropriate to flag stdout/stderr as a tty. In my experience that primarily controls buffering within libc and while it's used as a signal for things like ansi codes IMO that's best resolved on a per-library basis since it's not the most common thing in the world. I'd ideally like to remove p2-specific buffering altogether (trading that for worse outputs in some situations) but would want to get your thoughts on this too. I'm ok to defer to what you would prefer, but I think the least surprising thing in terms of compat is going to be removing buffering vs keeping it. One possible nice benefit of removing buffering would mean that sprinkled modifications to the top-half I think would no longer be necessary, but I'm not certain of that.

Comment thread libc-bottom-half/crt/crt1-command.c Resolved
Comment thread libc-bottom-half/crt/crt1-command.c Resolved
Comment thread test/CMakeLists.txt Resolved
Comment thread libc-bottom-half/sources/webp2_stdio.c Resolved
Comment thread libc-bottom-half/sources/webp2_stdio.c Resolved
Comment thread libc-bottom-half/sources/webp2_stdio.c Resolved
Comment thread libc-bottom-half/sources/webp2_stdio.c Resolved
@alexcrichton
alexcrichton merged commit 9ce2514 into WebAssembly:main Nov 9, 2026
72 of 74 checks passed
alexcrichton pushed a commit to WebAssembly/wasi-sdk that referenced this pull request Nov 11, 2026
WIP. Adds support for wasm32-webp2, to be later repackaged in
https://github.com/WebAssembly/component-sdk.

- [x] Remove dependence on custom branch of wasi-libc
- [x] Depend on patched version of wasm-component-ld (getter/setter
support)

See also:
- WebAssembly/wasi-libc#883
- bytecodealliance/wasm-component-ld#131
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.

3 participants