-
Notifications
You must be signed in to change notification settings - Fork 745
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
Error more clearly on wasm components #6751
Conversation
Oh components retconned the 32-bit version marker, which is 1 for core wasm, as the low 16 bits being core wasm version and the upper 16 bits being a possible component version. That means that the binary here isn't a valid component and needs a few bytes shuffled. The smallest component is:
whereas the test case in this PR is:
|
Thanks @alexcrichton ! Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions for the error string, otherwise LGTM. Tested on my machine and it works.
auto version = getInt32(); | ||
if (version != BinaryConsts::Version) { | ||
if (version == 0x1000d) { | ||
throwError("this looks like a wasm component, which Binaryen does not " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can change wasm
to Wasm
in the error string, and it could be nice to give a link to #6728. It allows people to follow the progress and maybe help if they're interested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I added a link now.
We use lowercase wasm
which is more informal in our other error strings, so for consistency I didn't change that. Though I agree in proper English it should be capitalized.
test/lit/binary/component-error.test
Outdated
|
||
;; RUN: not wasm-opt %s.wasm 2>&1 | filecheck %s | ||
|
||
;; CHECK: this looks like a wasm component, which Binaryen does not support yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the string in wasm-binary.cpp
is change, adapt the test accordingly.
Binary format, which I hope I read correctly:
https://github.com/WebAssembly/component-model/blob/main/design/mvp/Binary.md#component-definitions
Context: #6728 (comment)