diff options
| author | Austin Clements <austin@google.com> | 2021-03-29 17:38:20 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2021-04-01 00:51:26 +0000 |
| commit | ec721d92bf35cd47543acf6792acd474fdd39446 (patch) | |
| tree | 9a8c2a9df49cdfb2b9b6e0364c086ebfdfa0e962 /src/cmd/internal/objabi | |
| parent | 1f29e69bad3673aa4f9d1c4d1016170b9ced634a (diff) | |
| download | go-ec721d92bf35cd47543acf6792acd474fdd39446.tar.xz | |
runtime: fix uses of ABIInternal PCs in assembly
The covers three kinds of uses:
1. Calls of closures from assembly. These are always ABIInternal calls
without wrappers. I went through every indirect call in the runtime
and I think mcall is the only case of assembly calling a Go closure in
a way that's affected by ABIInternal. systemstack also calls a
closure, but it takes no arguments.
2. Calls of Go functions that expect raw ABIInternal pointers. I also
only found one of these: callbackasm1 -> cgocallback on Windows. These
are trickier to find, though.
3. Finally, I found one case on NetBSD where new OS threads were
directly calling the Go runtime entry-point from assembly via a PC,
rather than going through a wrapper. This meant new threads may not
have special registers set up. In this case, a change on all other
OSes had already forced new thread entry to go through an ABI wrapper,
so I just caught NetBSD up with that change.
With this change, I'm able to run a "hello world" with
GOEXPERIMENT=regabi,regabiargs.
For #40724.
Change-Id: I2a6d0e530c4fd4edf13484d923891c6160d683aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/305669
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/objabi')
| -rw-r--r-- | src/cmd/internal/objabi/util.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go index e066311cd1..ae03aac31a 100644 --- a/src/cmd/internal/objabi/util.go +++ b/src/cmd/internal/objabi/util.go @@ -166,8 +166,8 @@ func init() { if Experiment.RegabiG && !Experiment.RegabiWrappers { panic("GOEXPERIMENT regabig requires regabiwrappers") } - if Experiment.RegabiArgs && !(Experiment.RegabiWrappers && Experiment.RegabiReflect && Experiment.RegabiDefer) { - panic("GOEXPERIMENT regabiargs requires regabiwrappers,regabireflect,regabidefer") + if Experiment.RegabiArgs && !(Experiment.RegabiWrappers && Experiment.RegabiG && Experiment.RegabiReflect && Experiment.RegabiDefer) { + panic("GOEXPERIMENT regabiargs requires regabiwrappers,regabig,regabireflect,regabidefer") } // Set GOEXPERIMENT to the parsed and canonicalized set of experiments. @@ -242,7 +242,11 @@ type ExpFlags struct { // RegabiArgs enables register arguments/results in all // compiled Go functions. // - // Requires wrappers, reflect, defer. + // Requires wrappers (to do ABI translation), g (because + // runtime assembly that's been ported to ABIInternal uses the + // G register), reflect (so reflection calls use registers), + // and defer (because the runtime doesn't support passing + // register arguments to defer/go). RegabiArgs bool } |
