summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asm2wasm.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index fab74189e..fe9bd0f3f 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -1064,8 +1064,8 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
wasm.table.exists = true;
wasm.table.imported = true;
- // Import memory offset
- {
+ // Import memory offset, if not already there
+ if (!wasm.checkImport("memoryBase") && !wasm.checkGlobal("memoryBase")) {
auto* import = new Import;
import->name = Name("memoryBase");
import->module = Name("env");
@@ -1075,8 +1075,8 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
wasm.addImport(import);
}
- // Import table offset
- {
+ // Import table offset, if not already there
+ if (!wasm.checkImport("tableBase") && !wasm.checkGlobal("tableBase")) {
auto* import = new Import;
import->name = Name("tableBase");
import->module = Name("env");