-
Notifications
You must be signed in to change notification settings - Fork 11
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
Toolchain support in wasm-tools #24
Comments
Amazing, thanks @alexcrichton! Would you be willing to add the invented annotation syntax to the documentation of relevant custom sections in the tool-conventions repo? It would be great if tools could be interoperable even for those quasi-standard custom sections. |
Sure! I was semi-waiting for this to reach phase 4 and/or get merged into the spec, but now feels like a good time as well. I'd love to do the same for reloc/linking sections as well but I think those are much trickier as they deal with binary offsets (either that or I'm exposing my lack of knowledge of those sections) |
for code metadata we deal with binary offsets by placing the annotation next to the item that the offsets points to (instructions in this case), so that the offset is implicit and can be reconstructed (possibly with a different value) when roundtripping. I am not too familiar with these linking sections, but at a glance something similar seems possible |
I've opened WebAssembly/tool-conventions#228 for the @yuri91 indeed! I was referring to how generic printing of To me this is a bit of a tension/tradeoff in being able to print aribtrary custom sections but the output not being round-trippable. The consequence is that any custom section with binary offsets will require a dedicated annotation syntax (such as |
This isn't a bug report or an issue per se but more of a 👋 about the toolchain support for this proposal in the wasm-tools repository. I wanted to open this as a status if it's helpful for phase 4, so feel free to just take note and then close!
A summary of what's implemented is:
@custom
, they must be valid in the sense that they must be only placed in allowed locations and have valid syntax. For example(module (func (@custom)))
is a parse error.@name
as specified in this proposal is implemented.@custom
as specified in this proposal is implemented.@metadata.code.branch_hint
is implemented. (more relevant for https://github.com/WebAssembly/branch-hinting but wanted to note)@producers
is implemented. This corresponds the producers section and uses invented syntax (not specified anywhere). The purpose is to make reading this easier on the eyes.@dylink.0
is implemented. This corresponds to the dynamic linking tooling conventions and also uses invented syntax. This is intended to assist in writing text-format test cases for some component-related things.The binary-to-text printing done by
wasm-tools print
will additionally print all the annotations above. For example:Round-tripping doesn't work in general for binaries like this since custom sections refer to binary offsets and the binary->text->binary transformation can change binary offsets, but it's been very useful to at least even see the presence of custom sections in the text format (whereas before they weren't printed so there wasn't an indication something was being dropped)
The text was updated successfully, but these errors were encountered: