Skip to content

Don't check exports for being valid C/C++ identifiers in side modules #24359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tools/emscripten.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,13 @@ def finalize_wasm(infile, outfile, js_syms):
# These are any exports that were not requested on the command line and are
# not known auto-generated system functions.
unexpected_exports = [e for e in metadata.all_exports if shared.is_user_export(e)]
for n in unexpected_exports:
if not n.isidentifier():
exit_with_error(f'invalid export name: {n}')
# Rust side modules may have exported symbols that are not valid
# identifiers. They are meant to be called from native code in the main
# module not from JavaScript anyways, so don't perform this check on them.
if not settings.SIDE_MODULE:
for n in unexpected_exports:
if not n.isidentifier():
exit_with_error(f'invalid export name: {n}')
unexpected_exports = [asmjs_mangle(e) for e in unexpected_exports]
unexpected_exports = [e for e in unexpected_exports if e not in expected_exports]

Expand Down