summaryrefslogtreecommitdiff
path: root/src/wasm-emscripten.cpp
diff options
context:
space:
mode:
authorJacob Gravelle <jgravelle@google.com>2018-03-08 13:47:00 -0800
committerGitHub <noreply@github.com>2018-03-08 13:47:00 -0800
commit073d3707cb5980a76161105e421034e85ac0f8ce (patch)
tree5dd18cf5d947d07e97301e59a84d86c6cc52cba4 /src/wasm-emscripten.cpp
parentbe9243419302aca1ff088004546205f1c252f9c5 (diff)
downloadbinaryen-073d3707cb5980a76161105e421034e85ac0f8ce.tar.gz
binaryen-073d3707cb5980a76161105e421034e85ac0f8ce.tar.bz2
binaryen-073d3707cb5980a76161105e421034e85ac0f8ce.zip
Let s2wasm emit binary output (#1465)
* Emit invokeFuncs list as metadata * Refactor s2wasm to use ModuleWriter * Fix wasm-emscripten-finalize metadata output for binary output * Add a flag to emit binary from s2wasm NOTE: I chose to emit text by default, and binary behind a flag. This mismatches with asm2wasm (and the expectations of users of a "2wasm" tool), but doesn't break any existing users of s2wasm. If s2wasm is deprecated in favor of lld, this will be the least disruptive change, and we won't have to live with awkward defaults for too long. * Emit source maps in the binary output of s2wasm * Only emit binary with an outfile specified
Diffstat (limited to 'src/wasm-emscripten.cpp')
-rw-r--r--src/wasm-emscripten.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wasm-emscripten.cpp b/src/wasm-emscripten.cpp
index eced376bb..9a393db43 100644
--- a/src/wasm-emscripten.cpp
+++ b/src/wasm-emscripten.cpp
@@ -623,6 +623,15 @@ std::string EmscriptenGlueGenerator::generateEmscriptenMetadata(
}
meta << "]";
+ meta << ", \"invokeFuncs\": [";
+ commaFirst = true;
+ for (const auto& import : wasm.imports) {
+ if (import->name.startsWith("invoke_")) {
+ meta << maybeComma() << '"' << import->name.str << '"';
+ }
+ }
+ meta << "]";
+
meta << " }\n";
return meta.str();