From 892e6524c147c8ff21e68556efee799a9c67f63c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 30 Dec 2016 10:00:59 -0800 Subject: do not add memoryBase/tableBase if already there --- src/asm2wasm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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"); -- cgit v1.2.3