Skip to content
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

Enable EM_JS in side modules #19705

Merged
merged 1 commit into from
Jun 26, 2023
Merged

Enable EM_JS in side modules #19705

merged 1 commit into from
Jun 26, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jun 24, 2023

This works in a similar way to EM_ASM. See #18228.

Depends on WebAssembly/binaryen#5780

emcc.py Outdated
@@ -831,6 +831,7 @@ def process_dynamic_libs(dylibs, lib_dirs):
for dylib in dylibs:
exports = webassembly.get_exports(dylib)
exports = set(e.name for e in exports)
exports = [utils.removeprefix(e, '__em_js__') for e in exports]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this prefix? A comment might be good as it looks surprising here I think.

Also, it seems like keeping the prefix might avoid the risk of a conflict with something else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.

The point of this code here is simply to decide which symbols are allowed to be undefined in the main module (i.e. which symbols will be provided by the side module). Duplicates here are not going to be problem, but I'm actually not sure what happens in the normal (non-shared) case when a symbol is exported both as a normal function and as a EM_JS function... whatever the case that would be an existing bug.

src/library_dylink.js Show resolved Hide resolved
This works in a similar way to EM_ASM. See #18228.

Depends on WebAssembly/binaryen#5780
@sbc100 sbc100 merged commit 7c58a8f into main Jun 26, 2023
@sbc100 sbc100 deleted the em_js_side_modules branch June 26, 2023 23:00
sbc100 added a commit to sbc100/emscripten that referenced this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants