diff options
Diffstat (limited to 'src/wasm2js.h')
-rw-r--r-- | src/wasm2js.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h index 9936f492e..a3447749c 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -42,6 +42,7 @@ #include "mixed_arena.h" #include "passes/passes.h" #include "support/base64.h" +#include "support/file.h" #include "wasm-builder.h" #include "wasm-io.h" #include "wasm-validator.h" @@ -123,6 +124,7 @@ public: bool pedantic = false; bool allowAsserts = false; bool emscripten = false; + std::string symbolsFile; }; Wasm2JSBuilder(Flags f, PassOptions options_) : flags(f), options(options_) { @@ -330,6 +332,14 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { runner.run(); } + if (flags.symbolsFile.size() > 0) { + Output out(flags.symbolsFile, wasm::Flags::Text, wasm::Flags::Release); + Index i = 0; + for (auto& func : wasm->functions) { + out.getStream() << i++ << ':' << func->name.str << '\n'; + } + } + #ifndef NDEBUG if (!WasmValidator().validate(*wasm)) { WasmPrinter::printModule(wasm); |