diff options
author | Sam Clegg <sbc@chromium.org> | 2019-10-14 11:06:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-14 11:06:28 -0700 |
commit | d63b8a44d8db26f88d2b30920ad4eea4afe43fae (patch) | |
tree | 2bf4b319ac9c61c110de58b0222dcdd4669aef0a /src | |
parent | 66cb7b3f80f6ce32f426c3cb52eaf19430289ac2 (diff) | |
download | binaryen-d63b8a44d8db26f88d2b30920ad4eea4afe43fae.tar.gz binaryen-d63b8a44d8db26f88d2b30920ad4eea4afe43fae.tar.bz2 binaryen-d63b8a44d8db26f88d2b30920ad4eea4afe43fae.zip |
Don't add __wasm_call_ctors to startup function list in wasm standalone mode (#2384)
In this mode crt1 takes care of calling it.
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/wasm-emscripten-finalize.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp index 75744a822..234438460 100644 --- a/src/tools/wasm-emscripten-finalize.cpp +++ b/src/tools/wasm-emscripten-finalize.cpp @@ -241,8 +241,12 @@ int main(int argc, const char* argv[]) { wasm.addExport(ex); initializerFunctions.push_back(F->name); } - if (auto* e = wasm.getExportOrNull(WASM_CALL_CTORS)) { - initializerFunctions.push_back(e->name); + // Costructors get called from crt1 in wasm standalone mode. + // Unless there is no entry point. + if (!standaloneWasm || !wasm.getExportOrNull("_start")) { + if (auto* e = wasm.getExportOrNull(WASM_CALL_CTORS)) { + initializerFunctions.push_back(e->name); + } } } |