Skip to content

Commit d60a684

Browse files
Zxillycherrymui
authored andcommitted
cmd/internal/obj/wasm: use i64 for large return addr
Use i64 to avoid overflow when getting PC_F from the return addr. Fixes #73246 Change-Id: I5683dccf7eada4b8536edf53e2e83116a2f6d943 GitHub-Last-Rev: 267d9a1 GitHub-Pull-Request: #73277 Reviewed-on: https://go-review.googlesource.com/c/go/+/663995 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 7a82b6a commit d60a684

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/cmd/internal/obj/wasm/wasmobj.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,10 @@ func genWasmExportWrapper(s *obj.LSym, appendp func(p *obj.Prog, as obj.As, args
10061006
// In the unwinding case, we call wasm_pc_f_loop_export to handle stack switch and rewinding,
10071007
// until a normal return (non-unwinding) back to this function.
10081008
p = appendp(p, AIf)
1009-
p = appendp(p, AI32Const, retAddr)
1010-
p = appendp(p, AI32Const, constAddr(16))
1011-
p = appendp(p, AI32ShrU)
1009+
p = appendp(p, AI64Const, retAddr)
1010+
p = appendp(p, AI64Const, constAddr(16))
1011+
p = appendp(p, AI64ShrU)
1012+
p = appendp(p, AI32WrapI64)
10121013
p = appendp(p, ACall, obj.Addr{Type: obj.TYPE_MEM, Name: obj.NAME_EXTERN, Sym: wasm_pc_f_loop_export})
10131014
p = appendp(p, AEnd)
10141015

0 commit comments

Comments
 (0)