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

[WebAssembly] Sink wasm section headers #295

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dschuff
Copy link
Contributor

@dschuff dschuff commented Dec 17, 2021

Also support global names in the name section

Also support global names in the name section
@@ -185,6 +185,7 @@ Sections:

# Data section
# FIXME: This is wrong, should be the data section header
# CHECK!!!!: 1c6-1c9 3 [Wasm Section Headers]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Something very strange is going on here. When I run bloaty with -vv I can see in the log:

[shortsymbols, wasm_function] AddFileRange(main, 1b6, 10)
[shortsymbols, wasm_overhead] AddFileRange([Wasm Section Headers], 1c6, 3)

(and no unexpected AddFileRange calls for "main").
But the file map output has

1b6-1c6	         16		main
1c6-1c9	          3		main

i.e. the name from the entry starting at 1b6 entry has overridden the 1c6 entry. "main" is the last entry in the code section, and the section header entry is the first one in the data section. A similar overflow seems to happen between the data and name sections below.
Any idea what might be happening?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I think you might be running into a heuristic that has gone wrong:

https://github.com/google/bloaty/blob/master/src/range_map.cc#L294-L300

https://github.com/google/bloaty/blob/master/src/range_map.h#L170-L173

This is intended to fill in padding gaps between functions. But it's gone wrong here, because your [Wasm Section Headers] is an accurate/precious label, not a fallback.

We should probably change that combining Compress() pass to run prior to AddCatchAll(), and look for truly empty ranges rather than fallback ranges.

@dschuff
Copy link
Contributor Author

dschuff commented Dec 17, 2021

(oops this should still be a draft PR but I can't seem to convert it)

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