From 4fc6bdf853d112f235cd70ff6608f5b38283a733 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Oct 2015 13:15:34 -0700 Subject: support emcc --separate-asm output --- src/asm2wasm.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/asm2wasm.cpp') diff --git a/src/asm2wasm.cpp b/src/asm2wasm.cpp index f46d86c13..bdba9dac0 100644 --- a/src/asm2wasm.cpp +++ b/src/asm2wasm.cpp @@ -980,13 +980,24 @@ int main(int argc, char **argv) { fclose(f); input[num] = 0; - /* - // Separate asm modules look like + // emcc --separate-asm modules look like // // Module["asm"] = (function(global, env, buffer) { + // .. + // }); // - // , we can remove the part until the function. - */ + // we need to clean that up. + if (*input == 'M') { + while (*input != 'f') { + input++; + num--; + } + char *end = input + num - 1; + while (*end != '}') { + *end = 0; + end--; + } + } if (debug) std::cerr << "parsing...\n"; cashew::Parser builder; -- cgit v1.2.3