5

The default code generation for compiling with LLVM/Clang to WebAssembly exports memory and ignores tables completely.

Is there a way to emit memory and table imports (and/or exports) when targeting web assembly with clang (--target=wasm32-unknown-unknown-wasm)?

Casper Beyer
  • 2,203
  • 2
  • 22
  • 35
  • What do you mean by "generate"? You'll have to clarify what kind of toolchain you're using, and where you want to generate them from. Are you trying to list them from JavaScript? Auto-bind a C++ module's imports to another's exports? Etc. This answer may be what you're looking for, but without clarification I'm not sure: https://stackoverflow.com/questions/44444050/obtaining-javascript-import-object-entries-from-a-webassembly-wasm-module/44449135#44449135 – JF Bastien Aug 04 '17 at 14:13
  • LLVM-clang, compiling with --target=wasm32-unknown-unknown-wasm. Emit would be a more appropriate word i think? as in emit in the actual bytecode instructions for "import table" and "import memory" so that passing them in to the import descriptor actually takes effect. – Casper Beyer Aug 04 '17 at 14:37

1 Answers1

1

LLD with -flavor wasm has been rolled back into upstream LLVM which does give the ability to decide wether memory and function tables should be imported or exported.

Casper Beyer
  • 2,203
  • 2
  • 22
  • 35