Skip to content

Commit e397e08

Browse files
authored
Use shared/common symbol export mechanism for tag (i.e. __cpp_exception). NFC (#25286)
1 parent 7c936a6 commit e397e08

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/preamble.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,6 @@ function getWasmImports() {
740740
#endif
741741
#endif
742742

743-
#if hasExportedSymbol('__cpp_exception') && !RELOCATABLE
744-
___cpp_exception = wasmExports['__cpp_exception'];
745-
{{{ receivedSymbol('___cpp_exception') }}};
746-
#endif
747-
748743
#if hasExportedSymbol('__wasm_apply_data_relocs')
749744
__RELOC_FUNCS__.push(wasmExports['__wasm_apply_data_relocs']);
750745
#endif

tools/emscripten.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,6 @@ def trim_asm_const_body(body):
269269
return body
270270

271271

272-
def create_other_export_declarations(tag_exports):
273-
return '\n'.join(f'var {asmjs_mangle(name)};' for name in tag_exports)
274-
275-
276272
def create_global_exports(global_exports):
277273
lines = []
278274
for k, v in global_exports.items():
@@ -953,6 +949,8 @@ def create_receiving(function_exports, tag_exports, library_symbols):
953949
# function assignWasmExports(wasmExport) {
954950
# _main = wasmExports["_main"];
955951
exports = {name: sig for name, sig in function_exports.items() if name != building.WASM_CALL_CTORS}
952+
for t in tag_exports:
953+
exports[t] = None
956954

957955
if settings.ASSERTIONS:
958956
# In debug builds we generate trapping functions in case
@@ -979,16 +977,17 @@ def create_receiving(function_exports, tag_exports, library_symbols):
979977

980978
receiving.append('\nfunction assignWasmExports(wasmExports) {')
981979
for sym, sig in exports.items():
980+
is_function = sig is not None
982981
mangled = asmjs_mangle(sym)
983-
if generate_dyncall_assignment and sym.startswith('dynCall_'):
982+
if generate_dyncall_assignment and is_function and sym.startswith('dynCall_'):
984983
sig_str = sym.replace('dynCall_', '')
985984
dynCallAssignment = f"dynCalls['{sig_str}'] = "
986985
else:
987986
dynCallAssignment = ''
988987
export_assignment = ''
989988
if (settings.MODULARIZE or not settings.MINIMAL_RUNTIME) and should_export(mangled) and settings.MODULARIZE != 'instance':
990989
export_assignment = f"Module['{mangled}'] = "
991-
if install_debug_wrapper(sym):
990+
if is_function and install_debug_wrapper(sym):
992991
nargs = len(sig.params)
993992
receiving.append(f" {export_assignment}{dynCallAssignment}{mangled} = createExportWrapper('{sym}', {nargs});")
994993
else:
@@ -1010,8 +1009,6 @@ def create_module(metadata, function_exports, global_exports, tag_exports, libra
10101009
if settings.WASM_ESM_INTEGRATION:
10111010
module.append(sending)
10121011
else:
1013-
module.append(create_other_export_declarations(tag_exports))
1014-
10151012
if settings.PTHREADS or settings.WASM_WORKERS or (settings.IMPORTED_MEMORY and settings.MODULARIZE == 'instance'):
10161013
sending = textwrap.indent(sending, ' ').strip()
10171014
module.append('''\

0 commit comments

Comments
 (0)