summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2022-08-05 10:56:49 -0700
committerGitHub <noreply@github.com>2022-08-05 10:56:49 -0700
commitda916dbae19d213321225da2658423c09b85205b (patch)
tree8819182c2c71244618ff042ef85ddae25569fead /src
parent6759371b5239efa3daa9d988455abdd14a8b18ca (diff)
downloadbinaryen-da916dbae19d213321225da2658423c09b85205b.tar.gz
binaryen-da916dbae19d213321225da2658423c09b85205b.tar.bz2
binaryen-da916dbae19d213321225da2658423c09b85205b.zip
wasm-emscripten-finalize: Remove em_js/em_asm start/stop symbols when stripping data segments. (#4876)
This avoid a fatal crash in `--post-emscripten` where it tries to remove data that is no longer part of the file. This fixes bug introduced by #4871 that causes emscripten tests to fail.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-emscripten.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 4daf51410..f143310ce 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -445,6 +445,15 @@ void EmscriptenGlueGenerator::separateDataSegments(Output* outfile,
lastEnd = offset + seg->data.size();
}
wasm.dataSegments.clear();
+ // Remove the start/stop symbols that the PostEmscripten uses to remove
+ // em_asm/em_js data. Since we just removed all the data segments from the
+ // file there is nothing more for that pass to do.
+ // TODO(sbc): Fix the ordering so that the removal the EM_ASM/EM_JS data comes
+ // before this pass.
+ wasm.removeExport("__start_em_asm");
+ wasm.removeExport("__stop_em_asm");
+ wasm.removeExport("__start_em_js");
+ wasm.removeExport("__stop_em_js");
}
} // namespace wasm