go114: work around aarch64 signal handler issue

This commit is contained in:
tnn 2020-04-27 03:21:35 +00:00
parent 41a767c9a1
commit 3a170f816a
2 changed files with 22 additions and 1 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.3 2020/04/09 13:28:38 bsiegert Exp $
$NetBSD: distinfo,v 1.4 2020/04/27 03:21:35 tnn Exp $
SHA1 (go1.14.2.src.tar.gz) = bdc78d3a84b9d95766574b4bf33fc179542c2adf
RMD160 (go1.14.2.src.tar.gz) = 8b6d9bdb7e8d1eb9fba36d110cfcf59c6d9adc1e
@ -9,4 +9,5 @@ SHA1 (patch-src_cmd_dist_util.go) = 24e6f1b6ded842a8ce322a40e8766f7d344bc47e
SHA1 (patch-src_cmd_link_internal_ld_elf.go) = 990a54e3baf239916e4c7f0c1d54240e2898601a
SHA1 (patch-src_crypto_x509_root__bsd.go) = 93a2de7c685a0919fe93f5bc99f156e105dace4d
SHA1 (patch-src_runtime_os__netbsd.go) = 9b80de94667e3f8d8d1ae3648ab1fe43dd55d577
SHA1 (patch-src_runtime_sys__netbsd__arm64.s) = b37973c0841e24991c227a7f5cc4b46c2d89f372
SHA1 (patch-src_syscall_zsysnum__solaris__amd64.go) = ec28a0fa37ba9599ec1651c8e9337a2efc48a26b

View file

@ -0,0 +1,20 @@
$NetBSD: patch-src_runtime_sys__netbsd__arm64.s,v 1.1 2020/04/27 03:21:35 tnn Exp $
Work around kernel clobbering of r28 on aarch64 by reloading from ucontext.
https://nxr.netbsd.org/xref/src/sys/arch/aarch64/aarch64/sig_machdep.c#104
--- src/runtime/sys_netbsd_arm64.s.orig 2020-04-08 19:15:51.000000000 +0000
+++ src/runtime/sys_netbsd_arm64.s
@@ -319,6 +319,12 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$192
MOVD R26, 8*11(RSP)
MOVD R27, 8*12(RSP)
MOVD g, 8*13(RSP)
+ // Unclobber g for now (kernel uses it as ucontext ptr)
+ // See https://github.com/golang/go/issues/30824#issuecomment-492772426
+ // This is only correct in the non-cgo case.
+ // XXX should use lwp_getprivate as suggested.
+ // 8*36 is ucontext.uc_mcontext.__gregs[_REG_X28]
+ MOVD 8*36(g), g
MOVD R29, 8*14(RSP)
FMOVD F8, 8*15(RSP)
FMOVD F9, 8*16(RSP)