-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Would the maintainers be receptive to a pull request to remove the eager loading of the environment? #452
Comments
Rather than try to fix/remove/refactor static contructors it seems like maybe real solution here is to ensure that the module is initialized before the first call to User code can also run in I guess you could have a chicken and egg problem though since static constructors could (in theory) call out of the component, which could then trigger the calling of the |
I believe that would require a change the wasm component design which seems unlikely. There is the |
I'm not sure what you mean by the "start" section not being implemented. I don't know of any engines that don't implement it. It used by llvm (and emscripten) for certain things (e.g. loading passive data segments in multi-threading, and performs certain fixup in dyanmic linking). Perhaps you are referring to the fact that we don't use the "start" section to run arbitrary user code (e.g. startic ctors) because it runs before the exports are made available to the embedder? |
Oh, that's interesting, what would the llvm look like to emit a For " |
I guess "component-model start function" is different from the start section in a core module. For the core wasm start section: wasm-ld will generate a start section under certain circumstances, but you can't opt into or out it explicitly and you can't run your own code there: https://github.com/llvm/llvm-project/blob/ef3f476097c7a13c0578e331e44b584b706089ed/lld/wasm/Writer.cpp#L1410-L1432 |
Component I suppose I might have to write |
@yowl IIRC if you export |
But what would call |
Ensuring that |
I could be wrong, not an expert in this area either, but I think that is what bytecodealliance/wit-bindgen#777 is the original issue. Other runtimes such as rust workaround this by treating the |
THanks for the input, I will close this now. |
Hi,
For the component model, eagerly loading the environment presents a problem for runtimes that call
_initialize
and__wasm_call_ctors
This sequence results in the stack and failure:When calling the component function
cabi_realloc
it is not permitted to make another component call , but that is what is happening here. Eagerly loading the environment (as I understand it), depends on the presence ofextern char** environ
which the dotnet runtime includes to support https://learn.microsoft.com/en-us/dotnet/api/system.environment.getenvironmentvariables?view=net-8.0 .If I make the change here, would it be likely to be flat out rejected?
Update, there is one other call in
wasm_call_ctors
:This one I don't understand why it needs to be called here, seem that it is designed to only be called when needed?
The text was updated successfully, but these errors were encountered: