diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-11-09 11:58:14 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-11-09 13:38:35 -0800 |
commit | 7d0bb485aa40492c85181f477ae39e6bca56234b (patch) | |
tree | 5306a49f749ec5ac4559978da0f9c2cd5fccf8d6 /src/tools/wasm-as.cpp | |
parent | 3dac399ba503e05ee014e96a7ce9c82f29f6981c (diff) | |
download | binaryen-7d0bb485aa40492c85181f477ae39e6bca56234b.tar.gz binaryen-7d0bb485aa40492c85181f477ae39e6bca56234b.tar.bz2 binaryen-7d0bb485aa40492c85181f477ae39e6bca56234b.zip |
add a --symbolmap option to wasm-as, which emits a side file with the name mapping (similar to Names section, but external)
Diffstat (limited to 'src/tools/wasm-as.cpp')
-rw-r--r-- | src/tools/wasm-as.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/wasm-as.cpp b/src/tools/wasm-as.cpp index 95e6c9371..067c0f28d 100644 --- a/src/tools/wasm-as.cpp +++ b/src/tools/wasm-as.cpp @@ -29,6 +29,7 @@ using namespace wasm; int main(int argc, const char *argv[]) { bool debugInfo = false; + std::string symbolMap; Options options("wasm-as", "Assemble a .wast (WebAssembly text format) into a .wasm (WebAssembly binary format)"); options.extra["validate"] = "wasm"; options @@ -50,6 +51,9 @@ int main(int argc, const char *argv[]) { .add("--debuginfo", "-g", "Emit names section and debug info", Options::Arguments::Zero, [&](Options *o, const std::string &arguments) { debugInfo = true; }) + .add("--symbolmap", "-s", "Emit a symbol map (indexes => names)", + Options::Arguments::One, + [&](Options *o, const std::string &argument) { symbolMap = argument; }) .add_positional("INFILE", Options::Arguments::One, [](Options *o, const std::string &argument) { o->extra["infile"] = argument; @@ -83,6 +87,7 @@ int main(int argc, const char *argv[]) { BufferWithRandomAccess buffer(options.debug); WasmBinaryWriter writer(&wasm, buffer, options.debug); writer.setDebugInfo(debugInfo); + if (symbolMap.size() > 0) writer.setSymbolMap(symbolMap); writer.write(); if (options.debug) std::cerr << "writing to output..." << std::endl; |