mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj/wasm, runtime: detect wasmexport call before runtime initialization
If a wasmexport function is called from the host before initializing the Go Wasm module, currently it will likely fail with a bounds error, because the uninitialized SP is 0, and any SP decrement will make it out of bounds. As at least some Wasm runtime doesn't call _initialize by default, This error can be common. And the bounds error looks confusing to the users. Therefore, we detect this case and emit a clearer error. Fixes #71240. Updates #65199. Change-Id: I107095f08c76cdceb7781ab0304218eab7029ab6 Reviewed-on: https://go-review.googlesource.com/c/go/+/643115 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
6a4effa08b
commit
0b632d26b9
4 changed files with 48 additions and 2 deletions
|
|
@ -87,6 +87,7 @@ var wasmFuncTypes = map[string]*wasmFuncType{
|
|||
"runtime.gcWriteBarrier6": {Results: []byte{I64}}, // -> bufptr
|
||||
"runtime.gcWriteBarrier7": {Results: []byte{I64}}, // -> bufptr
|
||||
"runtime.gcWriteBarrier8": {Results: []byte{I64}}, // -> bufptr
|
||||
"runtime.notInitialized": {}, //
|
||||
"cmpbody": {Params: []byte{I64, I64, I64, I64}, Results: []byte{I64}}, // a, alen, b, blen -> -1/0/1
|
||||
"memeqbody": {Params: []byte{I64, I64, I64}, Results: []byte{I64}}, // a, b, len -> 0/1
|
||||
"memcmp": {Params: []byte{I32, I32, I32}, Results: []byte{I32}}, // a, b, len -> <0/0/>0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue