diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-12-30 10:00:59 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-12-30 14:02:15 -0800 |
commit | 892e6524c147c8ff21e68556efee799a9c67f63c (patch) | |
tree | e8ef0f6edb23a8c0cf5c9b847e9b4891b3898f19 | |
parent | 585fd8af473354b9dfa7e57c5c6af396fa60945e (diff) | |
download | binaryen-892e6524c147c8ff21e68556efee799a9c67f63c.tar.gz binaryen-892e6524c147c8ff21e68556efee799a9c67f63c.tar.bz2 binaryen-892e6524c147c8ff21e68556efee799a9c67f63c.zip |
do not add memoryBase/tableBase if already there
-rw-r--r-- | src/asm2wasm.h | 8 |
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"); |