-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: program compiles to wasm but is invalid: go:wasmexport: integer too large #73246
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
can you reduce it to whichever github.com/external-secrets/external-secrets does in init/globals ?
) |
CC @golang/wasm. |
Can you share the WAT format code of |
@Zxilly as a bit of a high level end user, I am not all too familiar with the tooling for doing that. I can try later today. But the script above should produce the offending binary for you. |
@Zxilly I have tried running wasm2wat ./temp.wasm -o ./temp.wat
2b2bbc1: error: unable to read i32 leb128: i32.const value Running in verbose mode does not seem to give us more information:
|
I've reproduce the problem and got the binary, thanks. |
I wrote a patch to try to fix this issue, but I'm not quite sure if I'm doing it right. cc @cherrymui |
Change https://go.dev/cl/663995 mentions this issue: |
Thanks for the report. This looks similar (and probably related) to #64856. When it have more than 32K of functions, a number of places in the code don't handle that many functions well. One difference is that this is signed integer overflow, i.e. more than 32K but not 64K. The CL above may be part of the fix, but it is probably not enough, especially once we get to more than 64K functions, it would certainly be not enough. I'll continue looking into it, along with #64856. |
@davidmdm Could you try if the CL above fix the issue? It probably makes it build and pass verification. It would still be good to know if the resulting binary runs okay. Thanks, The easiest way to do this is to use the gotip command (https://golang.org/dl/gotip) and run |
I confirm that CL 663995 successfully compiles and that wasm binary runs as expected! Now, the question that I am afraid to ask, is this the kind of bug I need to wait 6 months for Go1.25? Or is it something sneaky that can be put through a patch? Thanks for the great turn around! |
We probably can backport to 1.24. Wasmexport is a new feature in Go 1.24. This fixes a case that was missed in 1.24. Even if we don't backport, we don't need to wait for 6 months. Go 1.25 RC is expected to be released early June, 2 months from now, and 1.25.0 in August, 4 months from now. |
@gopherbot please backport this to Go 1.24 release. Wasmexport is a new feature in Go 1.24. This fixes a miscompilation in a case that was missed in 1.24. Thanks. |
Backport issue(s) opened: #73281 (for 1.24). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Go version
go1.24.2 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I compiled a program to wasm using
GOOS=wasip1 GOARCH=wasm
and when I tried to execute it with wazero and wasmtime found that the program was invalid.I have managed to create a minimal reproduction.
Create a new directory and run the following script.
(It seems to only fail if I import the external-secret project and use a wasm export in combination)
What did you see happen?
Both wazero and wasmtime fail to compile the wasm binary produced by the above program.
Wazero:
Wasmtime:
What did you expect to see?
Binary produced by Go Toolchain compiles successfully and can be executed successfully.
The text was updated successfully, but these errors were encountered: