summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-12-05 11:57:49 -0800
committerGitHub <noreply@github.com>2018-12-05 11:57:49 -0800
commite4b9f0f7d07c0c156dc2dec806945e31a5a7093a (patch)
tree4150cd42060f8da3a42b312a1d9763ca3d8d8c76
parent3be44c1a2c4219aab20d4d23567dc0ff91a40062 (diff)
downloadbinaryen-e4b9f0f7d07c0c156dc2dec806945e31a5a7093a.tar.gz
binaryen-e4b9f0f7d07c0c156dc2dec806945e31a5a7093a.tar.bz2
binaryen-e4b9f0f7d07c0c156dc2dec806945e31a5a7093a.zip
Fix initializerFunctions output by wasm-emscripten-finalize (#1803)
I broke this to be alwasy empty in #1795.
-rw-r--r--src/tools/wasm-emscripten-finalize.cpp3
-rw-r--r--test/lld/duplicate_imports.wast.out2
-rw-r--r--test/lld/em_asm.wast.out2
-rw-r--r--test/lld/hello_world.wast.mem.out2
-rw-r--r--test/lld/hello_world.wast.out2
-rw-r--r--test/lld/init.wast.out2
-rw-r--r--test/lld/recursive.wast.out2
-rw-r--r--test/lld/reserved_func_ptr.wast.jscall.out2
-rw-r--r--test/lld/reserved_func_ptr.wast.out2
9 files changed, 10 insertions, 9 deletions
diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp
index 861af845a..6b13bd5ce 100644
--- a/src/tools/wasm-emscripten-finalize.cpp
+++ b/src/tools/wasm-emscripten-finalize.cpp
@@ -180,6 +180,7 @@ int main(int argc, const char *argv[]) {
if (wasm.memory.imported()) {
if (wasm.table.base != "memory") wasm.memory.base = Name("memory");
}
+ wasm.updateMaps();
if (isSideModule) {
generator.replaceStackPointerGlobal();
@@ -188,7 +189,7 @@ int main(int argc, const char *argv[]) {
generator.generateMemoryGrowthFunction();
// emscripten calls this by default for side libraries so we only need
// to include in as a static ctor for main module case.
- if (wasm.getFunctionOrNull("__post_instantiate")) {
+ if (wasm.getExportOrNull("__post_instantiate")) {
initializerFunctions.push_back("__post_instantiate");
}
}
diff --git a/test/lld/duplicate_imports.wast.out b/test/lld/duplicate_imports.wast.out
index 6e5868afa..996a419fa 100644
--- a/test/lld/duplicate_imports.wast.out
+++ b/test/lld/duplicate_imports.wast.out
@@ -101,4 +101,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 13, "initializers": [], "declares": ["puts"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": ["invoke_ffd"] }
+;; METADATA: { "asmConsts": {},"staticBump": 13, "initializers": ["__post_instantiate"], "declares": ["puts"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": ["invoke_ffd"] }
diff --git a/test/lld/em_asm.wast.out b/test/lld/em_asm.wast.out
index f33743f7a..f878bb9cf 100644
--- a/test/lld/em_asm.wast.out
+++ b/test/lld/em_asm.wast.out
@@ -75,4 +75,4 @@
)
)
)
-;; METADATA: { "asmConsts": {"2": ["{ Module.print(\"Got \" + $0); }", ["ii"], [""]],"0": ["{ Module.print(\"Hello world\"); }", ["i"], [""]],"1": ["{ return $0 + $1; }", ["iii"], [""]]},"staticBump": 84, "initializers": [], "declares": [], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {"2": ["{ Module.print(\"Got \" + $0); }", ["ii"], [""]],"0": ["{ Module.print(\"Hello world\"); }", ["i"], [""]],"1": ["{ return $0 + $1; }", ["iii"], [""]]},"staticBump": 84, "initializers": ["__post_instantiate"], "declares": [], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
diff --git a/test/lld/hello_world.wast.mem.out b/test/lld/hello_world.wast.mem.out
index 4e2ad9312..b38b7ff3e 100644
--- a/test/lld/hello_world.wast.mem.out
+++ b/test/lld/hello_world.wast.mem.out
@@ -58,4 +58,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 13, "initializers": [], "declares": ["puts"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {},"staticBump": 13, "initializers": ["__post_instantiate"], "declares": ["puts"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
diff --git a/test/lld/hello_world.wast.out b/test/lld/hello_world.wast.out
index 72df62ec6..40fd6a1fe 100644
--- a/test/lld/hello_world.wast.out
+++ b/test/lld/hello_world.wast.out
@@ -59,4 +59,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 13, "initializers": [], "declares": ["puts"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {},"staticBump": 13, "initializers": ["__post_instantiate"], "declares": ["puts"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
diff --git a/test/lld/init.wast.out b/test/lld/init.wast.out
index d82e9d989..3c9afa227 100644
--- a/test/lld/init.wast.out
+++ b/test/lld/init.wast.out
@@ -71,4 +71,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 8, "initializers": [], "declares": [], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {},"staticBump": 8, "initializers": ["__post_instantiate"], "declares": [], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
diff --git a/test/lld/recursive.wast.out b/test/lld/recursive.wast.out
index 8d9dc411e..e17247950 100644
--- a/test/lld/recursive.wast.out
+++ b/test/lld/recursive.wast.out
@@ -117,4 +117,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 19, "initializers": [], "declares": ["printf"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {},"staticBump": 19, "initializers": ["__post_instantiate"], "declares": ["printf"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory"], "invokeFuncs": [] }
diff --git a/test/lld/reserved_func_ptr.wast.jscall.out b/test/lld/reserved_func_ptr.wast.jscall.out
index 9d979b3a2..7e612a72c 100644
--- a/test/lld/reserved_func_ptr.wast.jscall.out
+++ b/test/lld/reserved_func_ptr.wast.jscall.out
@@ -294,4 +294,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 0, "initializers": [], "jsCallStartIndex": 3, "jsCallFuncType": ["ddi","fffi","iii","v","vi","viii"], "declares": ["_Z4atoiPKc"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory","_dynCall_viii"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory","dynCall_viii"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {},"staticBump": 0, "initializers": ["__post_instantiate"], "jsCallStartIndex": 3, "jsCallFuncType": ["ddi","fffi","iii","v","vi","viii"], "declares": ["_Z4atoiPKc"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory","_dynCall_viii"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory","dynCall_viii"], "invokeFuncs": [] }
diff --git a/test/lld/reserved_func_ptr.wast.out b/test/lld/reserved_func_ptr.wast.out
index 230a94f59..0b244a9bd 100644
--- a/test/lld/reserved_func_ptr.wast.out
+++ b/test/lld/reserved_func_ptr.wast.out
@@ -155,4 +155,4 @@
)
)
)
-;; METADATA: { "asmConsts": {},"staticBump": 0, "initializers": [], "declares": ["_Z4atoiPKc"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory","_dynCall_viii"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory","dynCall_viii"], "invokeFuncs": [] }
+;; METADATA: { "asmConsts": {},"staticBump": 0, "initializers": ["__post_instantiate"], "declares": ["_Z4atoiPKc"], "externs": [], "implementedFunctions": ["___post_instantiate","_main","_stackSave","_stackAlloc","_stackRestore","___growWasmMemory","_dynCall_viii"], "exports": ["memory","__post_instantiate","main","__heap_base","__data_end","stackSave","stackAlloc","stackRestore","__growWasmMemory","dynCall_viii"], "invokeFuncs": [] }