mirror of
https://github.com/golang/go
synced 2024-11-17 16:14:42 -07:00
runtime: set r12 to sigpanic before jumping to it in sighandler
The ppc64le shared library ABI demands that r12 is set to a function's global entrypoint before jumping to the global entrypoint. Not doing so means that handling signals that usually panic actually crashes (and so, e.g. can't be recovered). Fixes several failures of "cd test; go run run.go -linkshared". Change-Id: Ia4d0da4c13efda68340d38c045a52b37c2f90796 Reviewed-on: https://go-review.googlesource.com/17280 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
7305b55e98
commit
f000523018
@ -63,6 +63,7 @@ func (c *sigctxt) sigaddr() uint64 { return c.info.si_addr }
|
||||
func (c *sigctxt) fault() uint64 { return c.regs().dar }
|
||||
|
||||
func (c *sigctxt) set_r0(x uint64) { c.regs().gpr[0] = x }
|
||||
func (c *sigctxt) set_r12(x uint64) { c.regs().gpr[12] = x }
|
||||
func (c *sigctxt) set_r30(x uint64) { c.regs().gpr[30] = x }
|
||||
func (c *sigctxt) set_pc(x uint64) { c.regs().nip = x }
|
||||
func (c *sigctxt) set_sp(x uint64) { c.regs().gpr[1] = x }
|
||||
|
@ -110,6 +110,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
||||
// In case we are panicking from external C code
|
||||
c.set_r0(0)
|
||||
c.set_r30(uint64(uintptr(unsafe.Pointer(gp))))
|
||||
c.set_r12(uint64(funcPC(sigpanic)))
|
||||
c.set_pc(uint64(funcPC(sigpanic)))
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user