-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: go:buildinfo
was not written in wasm
#73741
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
Comments
Change https://go.dev/cl/673475 mentions this issue: |
Thanks for the issue. What is the user-visible effect of this? Thanks. |
Of course, before we can do any of this, we'll probably also need a |
In fact, we probably don't need a separate ref: #73731 |
Okay, thanks. I agree that if we do this, we probably want to be consistent with other platforms, i.e. using a separate .go.buildinfo section, instead of reaching to specific symbols. (One can strip symbol names, but usually not section names.) Yeah, we don't currently have a way to parse wasm files, so (Personally I'd like to have a wasm file parser, even if just internal, so go tool objdump etc. works. But it needs work.) |
In fact, there is a much simpler way to do this, by checking However, this logic does not apply to wasm, because wasm's linker implements memory pack optimization, and consecutive After retore the wasm memory, such logic can apply to wasm. There is a reference implementation in https://github.com/Zxilly/go-size-analyzer/blob/afd50eccac019aa51bca4dbc5eeca1cb7903e64e/internal/wrapper/wasm.go#L92-L123 |
It makes sense to provide an wasm parser in the standard library, because after checking the go ecosystem I found that there isn't a sufficiently robust implementation of a wasm parser, the best library I found came from |
Probably. Or it could be a third-party package. That would be a separate discussion (and proposal), though. |
For this issue specifically, do you have a need for buildinfo now, before we have any parsing logic? Thanks. |
I don't need it, as I said above, I implemented the |
I plan to add the magic-based parsing logic to |
I reviewed the current implementation again, and it seems that parsing the build info on WebAssembly cannot be achieved before adding WASM parsing support. This is because the Go version information is added to the producers custom section, and without parsing the specific format of the WASM file, it's not possible to read it from the correct location. |
Go version
go version go1.24.3 windows/amd64
Output of
go env
in your module/workspace:What did you do?
Build a binary with
GOOS=js GOARCH=wasm go build -o main.wasm main.go
What did you see happen?
go:buildinfo
was not written into the binary.What did you expect to see?
go:buildinfo
was written like other arch.The text was updated successfully, but these errors were encountered: