Repository navigation
Conversation
Register a startup marker that sets the existing run-once flag when constructors are invoked by _initialize or _start. Preserve the older toolchain fallback and add a constructor-counting component test covering the first and second export calls.
|
Thanks! I think it might actually be time though to just go ahead and outright delete this workaround. IIRC this was needed for... something in the past but I have no idea what, and I also have a vague recollection that the need for it was fixed long ago. Mind just deleting all the infrastructure to do this instead? |
|
Looks to me like this is the original issue. I started looking into removal, and for |
|
Another possible fix might be to limit the workaround to non-wasi targets since I think it's just the wasi targets using |
|
Ah that would be easier to implement. One other wrinkle though. Removing the work around for wasi targets before rust 1.100 breaks since when cdylibs will start getting The cleanest option I see is a build script that no-ops Unless there's another mechanism I'm missing, I'd guess merging this as is for now and revisiting the deletion once our MSRV reaches a Rust version where If you have any simpler approaches in mind, I'm happy go for one of those too. |
|
Personally I'd prefer to time-box the workaround here to avoid it getting cemented too much -- I think the best option for now would be to detect the rustc version in a build script and then change this function based on that. Once MSRV is beyond that then this can all be dropped entriely |
Since rust-lang/rust#161421,
_initializeruns constructors in WASI cdylibs before the first export call, butwit-bindgen’s separateRUNguard remains unset, sorun_ctors_onceruns them again.This PR registers an
.init_arraymarker that sets the existingRUNguard when constructors run. Exported functions can then recognize initialization already performed by_initializeor_start