[wasm-merge] Make empty function names explicit with --output-manifest#8871
Open
aheejin wants to merge 3 commits into
Open
[wasm-merge] Make empty function names explicit with --output-manifest#8871aheejin wants to merge 3 commits into
aheejin wants to merge 3 commits into
Conversation
Even for empty function names, they will be written to a manifest file when `--output-manifest` is given. But currently we don't print their names in the name section, making them not searchable by wasm-split that use the manifest file.
tlively
reviewed
Jun 27, 2026
| // Even if function name is empty, if we were to put it in the output | ||
| // manifest, it has to be emitted in the name section. | ||
| if (!manifestFile.empty()) { | ||
| merged.getFunction(func->name)->hasExplicitName = true; |
Member
There was a problem hiding this comment.
The function might have been renamed when it was copied to the merged module, so func->name might refer to a different function, right? I think we have to make the name explicit at the point where we add the copied function to the merged module.
Member
Author
There was a problem hiding this comment.
Renaming is done in in-place currModule before merging, so it will refer to the same function.
binaryen/src/tools/wasm-merge.cpp
Lines 647 to 649 in d39a6d8
aheejin
commented
Jun 28, 2026
| for (auto& func : currModule->functions) { | ||
| if (!func->imported()) { | ||
| funcs.push_back(func->name); | ||
| if (!manifestFile.empty()) { |
Member
Author
There was a problem hiding this comment.
NFC: I wrapped the whole for loop with if(!manifstFile.empty()), given that funcs will only be used for the output manifest file generation.
tlively
approved these changes
Jun 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Even for empty function names, they will be written to a manifest file when
--output-manifestis given. But currently we don't print their names in the name section, making them not searchable by wasm-split that use the manifest file.