Skip to content
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

Export/import tables #46

Closed
pepyakin opened this issue Feb 2, 2018 · 9 comments
Closed

Export/import tables #46

pepyakin opened this issue Feb 2, 2018 · 9 comments

Comments

@pepyakin
Copy link
Member

pepyakin commented Feb 2, 2018

I did two experiments with wasm runtimes (1, 2) and both of them requires access to tables.

Today, in wasm32-unknown-unknown tables are defined inside the wasm but not exported. To workaround this, I have to disassemble wasm, add export for table and then assemble back before I can use the modules (script).

So I think, we need a way to communicate to linker that we need either to import or export tables from binary. I understand, this might be not feasible to do with our binaryen 'linking'.
I just want we make sure that this is not problem for upcoming proper linking with LLD.

@koute
Copy link

koute commented Feb 2, 2018

Yep. This is absolutely essential for rich interop between Rust and JS. I also automatically export the table when compiling with cargo-web.

@pepyakin
Copy link
Member Author

Seems like the patch with LLD won't help with this. At least, I can't find any table related options in the gist posted by Alex.

@mgattozzi
Copy link
Contributor

@alexcrichton do you know if LLD supports/will support this or are going to have to do something else here?

@alexcrichton
Copy link
Contributor

Heh I don't think there's event fully functional import directives yet so I'd imagine that tables are probably still "on the TODO list". I'd imagine though that they'd be receptive to an implementation!

@mgattozzi
Copy link
Contributor

@pepyakin linked this in #29 but it looks like that landed upstream here!

@alexcrichton
Copy link
Contributor

Er yes, but that was the support I was testing out which didn't actually work with LLD, it only worked with LLVM.

@mgattozzi
Copy link
Contributor

Oh that's unfortunate -_-

@alexcrichton
Copy link
Contributor

LLD recently gained support for specifying what to do about the function table, whether it's imported or exported

@pepyakin
Copy link
Member Author

can confirm that it works for me on LLVM 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants