summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-02-28 15:13:16 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-02-28 15:13:16 +0000
commiteadc1843c4fa57f844ff4d7a676de52b1c9de241 (patch)
treefc4c1d5e48b8405527572ac35f9bbf74d5e442f7 /libgo
parent3b19971bd35cef7da2effc364e7b6eae06d7fdf4 (diff)
runtime: fix sigfwd to not allocate memory
The use of &[1]uintptr{fn} was causing sigfwd to allocate memory, even though it is being compiled for the runtime package. That is a bad idea for this function, which is invoked by a signal handler. Rewrite it to use only constructs that do not allocate memory when compiled for the runtime package. The test for this is misc/cgo/testcarchive in the main repo, which we don't yet test. Reviewed-on: https://go-review.googlesource.com/37454 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245777 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/runtime/signal_gccgo.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go
index 570a07668449..b4257c9f9731 100644
--- a/libgo/go/runtime/signal_gccgo.go
+++ b/libgo/go/runtime/signal_gccgo.go
@@ -127,9 +127,10 @@ func raiseproc(sig uint32) {
//go:nosplit
//go:nowritebarrierrec
func sigfwd(fn uintptr, sig uint32, info *_siginfo_t, ctx unsafe.Pointer) {
- f1 := &[1]uintptr{fn}
- f2 := *(*func(uint32, *_siginfo_t, unsafe.Pointer))(unsafe.Pointer(&f1))
- f2(sig, info, ctx)
+ f1 := [1]uintptr{fn}
+ f2 := &f1
+ f3 := *(*func(uint32, *_siginfo_t, unsafe.Pointer))(unsafe.Pointer(&f2))
+ f3(sig, info, ctx)
}
//go:nosplit