]> Cypherpunks repositories - gostls13.git/commit
cmd/link: produce valid binaries with large data section on wasm
authorRichard Musiol <mail@richard-musiol.de>
Sat, 5 Oct 2019 22:49:52 +0000 (00:49 +0200)
committerRichard Musiol <neelance@gmail.com>
Mon, 7 Oct 2019 18:09:29 +0000 (18:09 +0000)
commit30521d5126c47c9db0dd4cafc3de5bcf3c6348dd
tree6c8ffcf501b41dcff0b672f3976991ca97b22c1d
parent30da79d958cff1b91cc97a241c916f1b43a2ad20
cmd/link: produce valid binaries with large data section on wasm

CL 170950 had a regression that makes the compiler produce
an invalid wasm binary if the data section is too large.
Loading such a binary gives the following error:
"LinkError: WebAssembly.instantiate(): data segment is out of bounds"

This change fixes the issue by ensuring that the minimum size of the
linear memory is larger than the end of the data section.

Fixes #34395.

Change-Id: I0c8629de7ffd0d85895ad31bf8c9d45fef197a57
Reviewed-on: https://go-review.googlesource.com/c/go/+/199358
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/link/internal/wasm/asm.go
test/fixedbugs/issue34395.go [new file with mode: 0644]