diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-02-28 15:13:16 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-02-28 15:13:16 +0000 |
commit | c5c78a527d98118e8ee8a098627a3f3f00307bd2 (patch) | |
tree | fc4c1d5e48b8405527572ac35f9bbf74d5e442f7 | |
parent | 5d805ca6229a56bc74337689d2a7129a14185e16 (diff) | |
download | gcc-c5c78a527d98118e8ee8a098627a3f3f00307bd2.zip gcc-c5c78a527d98118e8ee8a098627a3f3f00307bd2.tar.gz gcc-c5c78a527d98118e8ee8a098627a3f3f00307bd2.tar.bz2 |
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
From-SVN: r245777
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/go/runtime/signal_gccgo.go | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 46b0d1c..3f3ddde 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -0bcc1bc98dca48af40d9f54f4eacbbafaa30beb1 +e1502234b5011a1ab859519f1f217dbf4369ec9b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go index 570a076..b4257c9 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 |