diff options
author | bsiegert <bsiegert@pkgsrc.org> | 2020-04-20 14:25:52 +0000 |
---|---|---|
committer | bsiegert <bsiegert@pkgsrc.org> | 2020-04-20 14:25:52 +0000 |
commit | 6c035d73752714ff709639a302ef7eef86a284ca (patch) | |
tree | b6e9ffd88f3058d2ede1ddbec56fb601d09a52d0 /lang | |
parent | b483daa55a22857896e1f66cc12fedb0e5977255 (diff) | |
download | pkgsrc-6c035d73752714ff709639a302ef7eef86a284ca.tar.gz |
gcc9: start fixing gccgo build under NetBSD.
This fixes the build of the "runtime" package, now the compilation is
stuck in the "syscall" package instead.
Submitted upstream as https://go-review.googlesource.com/c/gofrontend/+/228918/.
Upstream bug report at https://github.com/golang/go/issues/38538.
Diffstat (limited to 'lang')
-rw-r--r-- | lang/gcc9/Makefile | 3 | ||||
-rw-r--r-- | lang/gcc9/distinfo | 6 | ||||
-rw-r--r-- | lang/gcc9/patches/patch-libgo_go_runtime_os__netbsd.go | 55 | ||||
-rw-r--r-- | lang/gcc9/patches/patch-libgo_go_runtime_signal__gccgo.go | 15 | ||||
-rw-r--r-- | lang/gcc9/patches/patch-libgo_go_runtime_stubs.go | 17 | ||||
-rw-r--r-- | lang/gcc9/patches/patch-libgo_runtime_go-signal.c | 25 |
6 files changed, 119 insertions, 2 deletions
diff --git a/lang/gcc9/Makefile b/lang/gcc9/Makefile index 9cc5c8e0aaf..965c6263f5f 100644 --- a/lang/gcc9/Makefile +++ b/lang/gcc9/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.17 2020/04/08 16:35:59 wiz Exp $ +# $NetBSD: Makefile,v 1.18 2020/04/20 14:25:52 bsiegert Exp $ GCC9_VERSION= 9.3.0 +PKGREVISION= 1 DISTNAME= gcc-${GCC9_VERSION} PKGNAME= gcc9-${GCC9_VERSION} diff --git a/lang/gcc9/distinfo b/lang/gcc9/distinfo index 2486e766b79..71ef00c5334 100644 --- a/lang/gcc9/distinfo +++ b/lang/gcc9/distinfo @@ -1,9 +1,13 @@ -$NetBSD: distinfo,v 1.3 2020/04/08 16:35:59 wiz Exp $ +$NetBSD: distinfo,v 1.4 2020/04/20 14:25:52 bsiegert Exp $ SHA1 (gcc-9.3.0.tar.xz) = b746688bf045a316fc92c3528138ad10d0822b6b RMD160 (gcc-9.3.0.tar.xz) = e0ade31726b8fbb1eb308e2b1383a79633aef996 SHA512 (gcc-9.3.0.tar.xz) = 4b9e3639eef6e623747a22c37a904b4750c93b6da77cf3958d5047e9b5ebddb7eebe091cc16ca0a227c0ecbd2bf3b984b221130f269a97ee4cc18f9cf6c444de Size (gcc-9.3.0.tar.xz) = 70533868 bytes SHA1 (patch-gcc_gimplify.c) = f933a033d4a6c11fa82c8c9c6785842ba7993862 +SHA1 (patch-libgo_go_runtime_os__netbsd.go) = 357c62afe017a5ca3d7138abb2c19dc10bc5cd3d +SHA1 (patch-libgo_go_runtime_signal__gccgo.go) = 51b632c1c827f6d99fc2d7803294a0b7a64514a1 +SHA1 (patch-libgo_go_runtime_stubs.go) = f4753765eb7ee9a933f2bb3a05f27c487a1d51ef +SHA1 (patch-libgo_runtime_go-signal.c) = 6121b041cdd850adeea943f385d52b65d6bfe249 SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__base.h) = f12f6a97f94d13efa73a2500411bc77b27887edd SHA1 (patch-libstdc++-v3_config_os_bsd_netbsd_ctype__configure__char.cc) = 007bce70f75deace18f60924b5a3f94bf7a0af2f diff --git a/lang/gcc9/patches/patch-libgo_go_runtime_os__netbsd.go b/lang/gcc9/patches/patch-libgo_go_runtime_os__netbsd.go new file mode 100644 index 00000000000..4ec3d70cba7 --- /dev/null +++ b/lang/gcc9/patches/patch-libgo_go_runtime_os__netbsd.go @@ -0,0 +1,55 @@ +$NetBSD: patch-libgo_go_runtime_os__netbsd.go,v 1.1 2020/04/20 14:25:52 bsiegert Exp $ + +Fix compilation errors under NetBSD. Taken from upstream Go 1.14 sources. + +--- libgo/go/runtime/os_netbsd.go.orig 2020-03-12 11:07:24.000000000 +0000 ++++ libgo/go/runtime/os_netbsd.go +@@ -52,11 +52,11 @@ func semasleep(ns int64) int32 { + return -1 + } + var nsec int32 +- ts.set_sec(timediv(wait, 1000000000, &nsec)) ++ ts.set_sec(int64(timediv(wait, 1000000000, &nsec))) + ts.set_nsec(nsec) + tsp = &ts + } +- ret := lwp_park(_CLOCK_MONOTONIC, _TIMER_RELTIME, tsp, 0, unsafe.Pointer(&_g_.m.waitsemacount), nil) ++ ret := lwp_park(_CLOCK_MONOTONIC, _TIMER_RELTIME, tsp, 0, unsafe.Pointer(&_g_.m.mos.waitsemacount), nil) + if ret == _ETIMEDOUT { + return -1 + } +@@ -77,3 +77,34 @@ func semawakeup(mp *m) { + }) + } + } ++ ++func sysargs(argc int32, argv **byte) { ++ n := argc + 1 ++ ++ // skip over argv, envp to get to auxv ++ for argv_index(argv, n) != nil { ++ n++ ++ } ++ ++ // skip NULL separator ++ n++ ++ ++ // now argv+n is auxv ++ auxv := (*[1 << 28]uintptr)(add(unsafe.Pointer(argv), uintptr(n)*sys.PtrSize)) ++ sysauxv(auxv[:]) ++} ++ ++const ( ++ _AT_NULL = 0 // Terminates the vector ++ _AT_PAGESZ = 6 // Page size in bytes ++) ++ ++func sysauxv(auxv []uintptr) { ++ for i := 0; auxv[i] != _AT_NULL; i += 2 { ++ tag, val := auxv[i], auxv[i+1] ++ switch tag { ++ case _AT_PAGESZ: ++ physPageSize = val ++ } ++ } ++} diff --git a/lang/gcc9/patches/patch-libgo_go_runtime_signal__gccgo.go b/lang/gcc9/patches/patch-libgo_go_runtime_signal__gccgo.go new file mode 100644 index 00000000000..ccbf9312bdb --- /dev/null +++ b/lang/gcc9/patches/patch-libgo_go_runtime_signal__gccgo.go @@ -0,0 +1,15 @@ +$NetBSD: patch-libgo_go_runtime_signal__gccgo.go,v 1.1 2020/04/20 14:25:52 bsiegert Exp $ + +si_code is a macro on NetBSD, add a C trampoline function. + +--- libgo/go/runtime/signal_gccgo.go.orig 2020-04-18 16:53:50.092569597 +0000 ++++ libgo/go/runtime/signal_gccgo.go +@@ -65,7 +65,7 @@ func (c *sigctxt) sigcode() uint64 { + // code, just avoid a misleading value. + return _SI_USER + 1 + } +- return uint64(c.info.si_code) ++ return uint64(getSiginfoCode(c.info)) + } + + //go:nosplit diff --git a/lang/gcc9/patches/patch-libgo_go_runtime_stubs.go b/lang/gcc9/patches/patch-libgo_go_runtime_stubs.go new file mode 100644 index 00000000000..f45f08fddd0 --- /dev/null +++ b/lang/gcc9/patches/patch-libgo_go_runtime_stubs.go @@ -0,0 +1,17 @@ +$NetBSD: patch-libgo_go_runtime_stubs.go,v 1.1 2020/04/20 14:25:52 bsiegert Exp $ + +si_code is a macro on NetBSD, add a C trampoline function. + +--- libgo/go/runtime/stubs.go.orig 2020-03-12 11:07:24.000000000 +0000 ++++ libgo/go/runtime/stubs.go +@@ -326,6 +326,10 @@ func getSigactionHandler(*_sigaction) ui + //go:noescape + func setSigactionHandler(*_sigaction, uintptr) + ++// Get signal code, written in C. ++//go:noescape ++func getSiginfoCode(*_siginfo_t) uintptr ++ + // Retrieve fields from the siginfo_t and ucontext_t pointers passed + // to a signal handler using C, as they are often hidden in a union. + // Returns and, if available, PC where signal occurred. diff --git a/lang/gcc9/patches/patch-libgo_runtime_go-signal.c b/lang/gcc9/patches/patch-libgo_runtime_go-signal.c new file mode 100644 index 00000000000..7ff1389877a --- /dev/null +++ b/lang/gcc9/patches/patch-libgo_runtime_go-signal.c @@ -0,0 +1,25 @@ +$NetBSD: patch-libgo_runtime_go-signal.c,v 1.1 2020/04/20 14:25:52 bsiegert Exp $ + +si_code is a macro on NetBSD, add a C trampoline function. + +--- libgo/runtime/go-signal.c.orig 2020-03-12 11:07:24.000000000 +0000 ++++ libgo/runtime/go-signal.c +@@ -179,6 +179,18 @@ setSigactionHandler(struct sigaction* sa + // C code to fetch values from the siginfo_t and ucontext_t pointers + // passed to a signal handler. + ++uintptr getSiginfoCode(siginfo_t *) ++ __attribute__ ((no_split_stack)); ++ ++uintptr getSiginfoCode(siginfo_t *) ++ __asm__ (GOSYM_PREFIX "runtime.getSiginfoCode"); ++ ++uintptr ++getSiginfoCode(siginfo_t *info) ++{ ++ return (uintptr)(info->si_code); ++} ++ + struct getSiginfoRet { + uintptr sigaddr; + uintptr sigpc; |