summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-10-29 13:15:34 -0700
committerAlon Zakai <alonzakai@gmail.com>2015-10-29 13:15:34 -0700
commit4fc6bdf853d112f235cd70ff6608f5b38283a733 (patch)
tree2382509639e1d4fdc30b75290da566a6140f8430 /src
parent29bea2e426d3506a3fd510c9539797a57f542204 (diff)
downloadbinaryen-4fc6bdf853d112f235cd70ff6608f5b38283a733.tar.gz
binaryen-4fc6bdf853d112f235cd70ff6608f5b38283a733.tar.bz2
binaryen-4fc6bdf853d112f235cd70ff6608f5b38283a733.zip
support emcc --separate-asm output
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm.cpp19
1 files changed, 15 insertions, 4 deletions
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<Ref, ValueBuilder> builder;