buildcfg: disable regabiwrappers along with regabiargs

This (1) "just makes sense"
and (2) avoids a weird bug in some name-dependent calling conventions
in wasm code generation, when the local pkg has a real name instead of "".
The calling conventions are triggered for a "wrapper" function, and somehow
an abiwrapper was taken to be a "wrapper" function, resulting in the use of
an invalid register.  But abiwrapping has no business being in js/wasm code
generation, so just turn that off.

Updates #51734.

For posterity, that crash is:

GOSSAFUNC=wasmTruncU GOMAXPROCS=1 \
GOOS=js GOARCH=wasm GOEXPERIMENT=regabi,regabiargs
/Users/drchase/work/go-quick/bin/go build \
-gcflags=all=-d=abiwrap -o a.exe \
GOROOT/test/abi/bad_select_crash.go

<autogenerated>:1: internal compiler error: panic: bad Get: invalid register

goroutine 1 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0xc80?, 0x0?}, {0x195c85e, 0x9}, {0xc005ef72c8, 0x1, 0x1})
	/Users/drchase/work/go-quick/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	/Users/drchase/work/go-quick/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/gc.handlePanic()
	/Users/drchase/work/go-quick/src/cmd/compile/internal/gc/main.go:48 +0x85
panic({0x18bf3c0, 0x1ad0430})
	runtime/panic.go:854 +0x26d
cmd/internal/obj/wasm.assemble(0xc0000f8200, 0xc001c74880, 0x0?)
	/Users/drchase/work/go-quick/src/cmd/internal/obj/wasm/wasmobj.go:920 +0x1958
cmd/internal/obj.Flushplist(0xc0000f8200, 0xc005ef79a8, 0xc0022264c0, {0x7ff7bfefdd17, 0x7})
	/Users/drchase/work/go-quick/src/cmd/internal/obj/plist.go:151 +0x784
cmd/compile/internal/objw.(*Progs).Flush(...)
	/Users/drchase/work/go-quick/src/cmd/compile/internal/objw/prog.go:124
cmd/compile/internal/ssagen.Compile(0xc000707e00, 0xc001b4d620?)
	/Users/drchase/work/go-quick/src/cmd/compile/internal/ssagen/pgen.go:208 +0x495
cmd/compile/internal/gc.compileFunctions.func4.1(0xc005ef7a01?)
	/Users/drchase/work/go-quick/src/cmd/compile/internal/gc/compile.go:153 +0x3a
cmd/compile/internal/gc.compileFunctions.func2(0x0?)
	/Users/drchase/work/go-quick/src/cmd/compile/internal/gc/compile.go:125 +0x1e
cmd/compile/internal/gc.compileFunctions.func4({0xc004685000, 0x79f, 0xa00?})
	/Users/drchase/work/go-quick/src/cmd/compile/internal/gc/compile.go:152 +0x53
cmd/compile/internal/gc.compileFunctions()
	/Users/drchase/work/go-quick/src/cmd/compile/internal/gc/compile.go:163 +0x162
cmd/compile/internal/gc.Main(0x198d3d8)
	/Users/drchase/work/go-quick/src/cmd/compile/internal/gc/main.go:297 +0x108a
main.main()
	/Users/drchase/work/go-quick/src/cmd/compile/main.go:55 +0xdd

Change-Id: I79f039e2494f78efba60e52ab1110d62656fb7ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/405899
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
David Chase 2022-05-12 17:25:04 -04:00
parent 0653cb4cf7
commit 9a68dcd7de

View file

@ -132,6 +132,7 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (*ExperimentFlags, error) {
}
// regabi is only supported on amd64, arm64, riscv64, ppc64 and ppc64le.
if !regabiSupported {
flags.RegabiWrappers = false
flags.RegabiArgs = false
}
// Check regabi dependencies.