diff --git a/tools/emscripten.py b/tools/emscripten.py index cc2bd42b73e08..9957ce072bd69 100644 --- a/tools/emscripten.py +++ b/tools/emscripten.py @@ -778,18 +778,15 @@ def create_em_js(metadata): def add_standard_wasm_imports(send_items_map): extra_sent_items = [] - if settings.IMPORTED_MEMORY: - memory_import = 'wasmMemory' - if settings.MODULARIZE and settings.PTHREADS: - # Pthreads assign wasmMemory in their worker startup. In MODULARIZE mode, they cannot assign inside the - # Module scope, so lookup via Module as well. - memory_import += " || Module['wasmMemory']" - send_items_map['memory'] = memory_import - if settings.SAFE_HEAP: extra_sent_items.append('segfault') extra_sent_items.append('alignfault') + # Special case for importing memory and table + # TODO(sbc): can we make these into normal library symbols? + if settings.IMPORTED_MEMORY: + send_items_map['memory'] = 'wasmMemory' + if settings.RELOCATABLE: send_items_map['__indirect_function_table'] = 'wasmTable'