-
Notifications
You must be signed in to change notification settings - Fork 52
Description
I'm testing out replacing some basic APIs in the Rust standard library with APIs from this crate for WASIp2. Everything is going swimmingly with bytecodealliance/wit-bindgen#1369 applied, but there's one final gotcha I don't know how best to solve.
The basic problem is that wit-bindgen
emits a static with #[unsafe(link_section = "...")]
to schlep the wasm-encoded-WIT package all the way to wasm-component-ld
. This requires having a unique section name, however, and when the wasi
crate is used both in the standard library and as a dependency this means that the same static shows up twice (once as a libstd dep, once as a normal Cargo dep). The section names aren't currently different meaning they just get concatenated which corrupts them.
My best guess of how to fix this is to sed
the output of wit-bindgen
to replace link_section
with some "clever" #[cfg_attr]
based on feature = "rustc-dep-of-std"
. I wanted to open this though if others had a better idea.