diff options
author | Sam Clegg <sbc@chromium.org> | 2018-11-06 08:57:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-06 08:57:01 -0800 |
commit | fb8db513e2772654b3804795c72aebd9eb8f3bca (patch) | |
tree | 2f8ef2730e7c476119578f13770c7008dbe236e4 | |
parent | fce199ca454fcac97237273062dd48032899018f (diff) | |
download | binaryen-fb8db513e2772654b3804795c72aebd9eb8f3bca.tar.gz binaryen-fb8db513e2772654b3804795c72aebd9eb8f3bca.tar.bz2 binaryen-fb8db513e2772654b3804795c72aebd9eb8f3bca.zip |
wasm-ctor-eval: Hard error if requested ctor does not exist (#1728)
Not being able to evaluate a ctor is different to that ctor
being absent. This is masked a bug in emscripten where we
were spelling the names of the ctors wrong on the command line.
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 4272c5dba..07e883b8f 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -331,8 +331,12 @@ void evalCtors(Module& wasm, std::vector<std::string> ctors) { // snapshot globals (note that STACKTOP might be modified, but should // be returned, so that works out) auto globalsBefore = instance.globals; + Export *ex = wasm.getExportOrNull(ctor); + if (!ex) { + Fatal() << "export not found: " << ctor; + } try { - instance.callExport(ctor); + instance.callFunction(ex->value, LiteralList()); } catch (FailToEvalException& fail) { // that's it, we failed, so stop here, cleaning up partial // memory changes first |