golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.72k stars 17.5k forks source link

cmd/link: wasm function size limited to 2^16 bytes [1.21 backport] #64868

Closed gopherbot closed 6 months ago

gopherbot commented 8 months ago

@mauri870 requested issue #64856 to be considered for backport to the next 1.21 minor release.

I managed to reproduce it consistently in go 1.21 now, thanks. I would not trust on my initial bisecting results because the repro was not very consistent.

I was able to reproduce the issue with:

git clone https://github.com/HarikrishnanBalagopal/move2kube.git -b feat/starlark
cd move2kube
GOOS=wasip1 GOARCH=wasm go1.21.5 build

Since 1.20 does not have the wasip1 port, I tried with GOOS=js and it compiled just fine, so it appears to not be affected.

It is unclear to me where the issue is, but since programs compile just fine in Go 1.20 and we have the same function size in 1.20, 1.21 and tip something changed between 1.20 and 1.21 that caused the error to appear.

@gopherbot please backport to Go 1.21, this is a linker issue when compiling large wasm programs without a workaround.

prattmic commented 6 months ago

In our backport review meeting today, we don't think that this qualifies for a backport at this time because the fix is fairly complex (higher risk) and the underlying issue here is not really a regression. This port always had a 2^16 byte limit. For applications right on the edge of this limit, 1.22 did regress because std got slightly larger, but if the application code had gotten slightly larger it would have encountered the same issue. This should still be fixed for 1.23, of course.