]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.24] cmd/internal/obj/wasm: use i64 for large return addr
authorZxilly <zxilly@outlook.com>
Wed, 9 Apr 2025 12:17:21 +0000 (12:17 +0000)
committerCarlos Amedee <carlos@golang.org>
Tue, 29 Apr 2025 17:11:30 +0000 (10:11 -0700)
Use i64 to avoid overflow when getting PC_F from the return addr.

For #73246.
Fixes #73281.

Change-Id: I5683dccf7eada4b8536edf53e2e83116a2f6d943
GitHub-Last-Rev: 267d9a1a031868430d0af530de14229ee1ae8609
GitHub-Pull-Request: golang/go#73277
Reviewed-on: https://go-review.googlesource.com/c/go/+/663995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit d60a684c87104ed7836403eab74eb2be1e4a97cb)
Reviewed-on: https://go-review.googlesource.com/c/go/+/668615
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/cmd/internal/obj/wasm/wasmobj.go

index 42e5534f3b6254cc31960c0f92c30b6be76db4b7..9a3520f31950989fadfc4b2fff34122a809b9712 100644 (file)
@@ -1006,9 +1006,10 @@ func genWasmExportWrapper(s *obj.LSym, appendp func(p *obj.Prog, as obj.As, args
        // In the unwinding case, we call wasm_pc_f_loop_export to handle stack switch and rewinding,
        // until a normal return (non-unwinding) back to this function.
        p = appendp(p, AIf)
-       p = appendp(p, AI32Const, retAddr)
-       p = appendp(p, AI32Const, constAddr(16))
-       p = appendp(p, AI32ShrU)
+       p = appendp(p, AI64Const, retAddr)
+       p = appendp(p, AI64Const, constAddr(16))
+       p = appendp(p, AI64ShrU)
+       p = appendp(p, AI32WrapI64)
        p = appendp(p, ACall, obj.Addr{Type: obj.TYPE_MEM, Name: obj.NAME_EXTERN, Sym: wasm_pc_f_loop_export})
        p = appendp(p, AEnd)