Stream: rust-toolchain

Topic: Update `wasi` crate to preview 2


view this post on Zulip Yoshua Wuyts (Jan 30 2024 at 09:47):

Heya, just wanted to highlight I've opened an issue on the wasi crate to update the published bindings to preview 2. I believe now that Preview 2 is launched, we should be able to do this? Mostly sharing it here to ask whether there are any other blockers / things we need to do to unblock this?

Now that Preview 2 has been ratified, we should publish a checked-in version of the generated Preview 2 bindings. I'm not sure what the full range of dependencies for this are, but presumably we'll...

view this post on Zulip Yoshua Wuyts (Jan 30 2024 at 10:00):

Oh, I didn't realize we also have a #wit-bindgen channel. Maybe I should have opened that there instead.

view this post on Zulip Joel Dice (Feb 23 2024 at 20:23):

Sounds great to me. One thing to consider: wit-bindgen will generate a custom section for the component type with a name derived from the world the bindings were generated from. If an application developer happens to use the same world name in their application and also link with the new wasi crate, wasmld will try to combine the custom sections, generating output that wit-component can't understand. We ran into this while updating wasi-libc, hence https://github.com/bytecodealliance/wit-bindgen/issues/788 and https://github.com/bytecodealliance/wit-bindgen/pull/805

Currently, wit-bindgen generates the custom section name using the format "component-type:{world_name}". This can lead to issues when linking separately-compiled code together, each containing code...
These are both useful for supporting the wasm32-wasi-preview2 target in wasi-libc. --rename-world lets us give the files more meaningful names than e.g. "imports.h" when generating bindings for wa...

view this post on Zulip Alex Crichton (Feb 23 2024 at 21:11):

good point!

This will help prevent clashes with any other world called "bindings" by ensuring that wasm-ld doesn't concatenate sections and corrupt the internal contents.

Last updated: Dec 23 2024 at 13:07 UTC