-
Notifications
You must be signed in to change notification settings - Fork 11
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
Use the correct memory for host func #254
Conversation
dyld test failed. https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md says
but libc.so etc doesn't export "memory". actually, wasm-ld rejects -shared -export-memory. similar situation for tables. |
Instead of assuming memory index 0, look up an export with the name "memory".
to be consistent with cconv_deref_func_ptr
to prepare for other strategies to pick a memory to use.
there are no foreseeable users. let's simplify.
maybe it's a bit clear to do: ``` struct host_instance_using_cconv { struct host_instance hi; struct meminst *mem; struct tableinst *func_table; } ``` but i didn't bother to do that right now. i might revisit later. also, do the same for the table as well. also, make the repl initialize them accordingly. (only for memory, just because wasi doesn't happen to use function pointers.)
dyld_func_table is currently unused. but i added it for consistency. it would be necessary if an embedder provides host functions which use function pointers.
i'm not entirely happy with the use of a callback. i may revisit this later.
71d50f3
to
49d3d81
Compare
thread_spawn-simple is failing because it doesn't export memory. |
before this, the single memory was somehow assumed.
after this, the memory exported as "memory" (or the imported memory for dynamic-linking pie executables) is used.
apply the similar to __indirect_function_table as well.