mirror of https://github.com/WebAssembly/wasi-sdk
This helps ensure that `libc.so` is instantiated first, which matters because other libraries like `libunwind.so` have start functions which call functions like `__wasm_set_tls_base` imported from `libc.so`. Specifically, there's a dependency cycle between `libc.so` and the application `.so` because `libc.so` imports `__main_argc_argv` and the application `.so` imports a bunch of stuff from `libc.so`. `wit-component` will try to break that cycle by having the synthesized `env` module re-export functions using `call_indirect`, but that only works if the start functions of each library participating in the cycle don't call imports from each other, since the table used by the `call_indirect` calls is only initialized as part of the last `__init` module's instantiation. `wit-component` isn't smart enough inspect the code and figure all that out, but it will attempt to preserve the order libraries were specified (programatically or via the CLI), so if we specify `libc.so` first, it will be instantiated first in its "cyclical dependency" group.pull/648/head
parent
6683f1bc11
commit
239a057c04
Loading…
Reference in new issue