The implementation of runtime.abort on arm64 currently branches to
address 0, which results in a signal from PC 0, rather than from
runtime.abort, so the runtime fails to recognize it as an abort.
Fix runtime.abort on arm64 to read from address 0 like what other
architectures do and recognize this in the signal handler.
Should fix the linux/arm64 build.
Change-Id: I960ab630daaeadc9190287604d4d8337b1ea3853
Reviewed-on: https://go-review.googlesource.com/99895
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
RET
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0
- B (ZR)
+ MOVD ZR, R0
+ MOVD (R0), R0
UNDEF
TEXT runtime·return0(SB), NOSPLIT, $0
print("sighandler: note is longer than ERRMAX\n")
goto Throw
}
- if c.pc() == funcPC(abort) || (GOARCH == "arm" && c.pc() == funcPC(abort)+4) {
+ if isAbortPC(c.pc()) {
// Never turn abort into a panic.
goto Throw
}
// will work.
return true
}
+
+// isAbortPC returns true if pc is the program counter at which
+// runtime.abort raises a signal.
+func isAbortPC(pc uintptr) bool {
+ return pc == funcPC(abort) || ((GOARCH == "arm" || GOARCH == "arm64") && pc == funcPC(abort)+sys.PCQuantum)
+}
// stack. Abort in the signal handler instead.
flags = (flags &^ _SigPanic) | _SigThrow
}
- if c.sigpc() == funcPC(abort) || (GOARCH == "arm" && c.sigpc() == funcPC(abort)+4) {
+ if isAbortPC(c.sigpc()) {
// On many architectures, the abort function just
// causes a memory fault. Don't turn that into a panic.
flags = _SigThrow
return false
}
- if r.ip() == funcPC(abort) || (GOARCH == "arm" && r.ip() == funcPC(abort)+4) {
+ if isAbortPC(r.ip()) {
// Never turn abort into a panic.
return false
}