Received: by mail.netbsd.org (Postfix, from userid 605) id 9897584D85; Sat, 13 Apr 2019 23:09:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 1F3F184D7C for ; Sat, 13 Apr 2019 23:09:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id ZuEKMg6eQq3s for ; Sat, 13 Apr 2019 23:09:41 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 35A0284D31 for ; Sat, 13 Apr 2019 23:09:41 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 28B51FB16; Sat, 13 Apr 2019 23:09:41 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1555196981202940" MIME-Version: 1.0 Date: Sat, 13 Apr 2019 23:09:41 +0000 From: "Maya Rashish" Subject: CVS commit: pkgsrc/lang/go14 To: pkgsrc-changes@NetBSD.org Reply-To: maya@netbsd.org X-Mailer: log_accum Message-Id: <20190413230941.28B51FB16@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1555196981202940 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: maya Date: Sat Apr 13 23:09:41 UTC 2019 Modified Files: pkgsrc/lang/go14: Makefile distinfo Added Files: pkgsrc/lang/go14/patches: patch-src_runtime_defs__openbsd__386.h patch-src_runtime_defs__openbsd__amd64.h patch-src_runtime_malloc.h patch-src_runtime_mem__openbsd.c patch-src_runtime_os__openbsd.c patch-src_runtime_stack.c Log Message: go14: fix bootstrap for newer openbsd. openbsd requires mapping the stack with MAP_STACK. binaries not doing this will not run. patch taken from openbsd ports, via sjmulder. I modified it to use GOOS_openbsd, because other OSes are not provided an implementation of sysMarkStack. Bump PKGREVISION. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 pkgsrc/lang/go14/Makefile cvs rdiff -u -r1.10 -r1.11 pkgsrc/lang/go14/distinfo cvs rdiff -u -r0 -r1.1 \ pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__386.h \ pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__amd64.h \ pkgsrc/lang/go14/patches/patch-src_runtime_malloc.h \ pkgsrc/lang/go14/patches/patch-src_runtime_mem__openbsd.c \ pkgsrc/lang/go14/patches/patch-src_runtime_os__openbsd.c \ pkgsrc/lang/go14/patches/patch-src_runtime_stack.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1555196981202940 Content-Disposition: inline Content-Length: 8652 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=utf-8 Modified files: Index: pkgsrc/lang/go14/Makefile diff -u pkgsrc/lang/go14/Makefile:1.17 pkgsrc/lang/go14/Makefile:1.18 --- pkgsrc/lang/go14/Makefile:1.17 Wed Aug 22 09:45:20 2018 +++ pkgsrc/lang/go14/Makefile Sat Apr 13 23:09:40 2019 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.17 2018/08/22 09:45:20 wiz Exp $ +# $NetBSD: Makefile,v 1.18 2019/04/13 23:09:40 maya Exp $ .include "../../lang/go/version.mk" DISTNAME= go${GO14_VERSION}.src PKGNAME= go14-${GO14_VERSION} -PKGREVISION= 7 +PKGREVISION= 9 CATEGORIES= lang MASTER_SITES= https://storage.googleapis.com/golang/ PATCH_SITES= https://codereview.appspot.com/download/ Index: pkgsrc/lang/go14/distinfo diff -u pkgsrc/lang/go14/distinfo:1.10 pkgsrc/lang/go14/distinfo:1.11 --- pkgsrc/lang/go14/distinfo:1.10 Sat Jan 20 20:44:49 2018 +++ pkgsrc/lang/go14/distinfo Sat Apr 13 23:09:40 2019 @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.10 2018/01/20 20:44:49 christos Exp $ +$NetBSD: distinfo,v 1.11 2019/04/13 23:09:40 maya Exp $ SHA1 (go1.4.3.src.tar.gz) = 486db10dc571a55c8d795365070f66d343458c48 RMD160 (go1.4.3.src.tar.gz) = b1fbb2805a777c8107e7c946f36a881303ac5e35 @@ -38,14 +38,20 @@ SHA1 (patch-src_runtime_cgo_setenv.c) = SHA1 (patch-src_runtime_debug__netbsd.go) = 3a54698e749dcd362e5fe4284a4c1f59d654b095 SHA1 (patch-src_runtime_defs__netbsd.go) = 5f433bb92bd50707fcde5f941e9ca084eac4f659 SHA1 (patch-src_runtime_defs__netbsd__arm.h) = 150973e3fdb118e11fadea910f7e9f39a70b6067 +SHA1 (patch-src_runtime_defs__openbsd__386.h) = 314a5bdc4ff0ee5f9fb969cdb134fe6183acebb6 +SHA1 (patch-src_runtime_defs__openbsd__amd64.h) = 72335c404604df53b943f3bb3d1088ae784fef0e +SHA1 (patch-src_runtime_malloc.h) = c41776870b4d95657ad45711b5d921cda4febd29 +SHA1 (patch-src_runtime_mem__openbsd.c) = 2800a500d3bd5bde0bb3a05ac6aec5630b098bca SHA1 (patch-src_runtime_mgc0.c) = 6cd1a52376efbf3f825fc511044af4a82528eccc SHA1 (patch-src_runtime_mheap.c) = 646f4ba1abf407936ec6c3c0783dd59922079fe3 SHA1 (patch-src_runtime_netpoll__solaris.c) = ae399518bb02d6b898734a52dfa7fe18f041e1ec SHA1 (patch-src_runtime_os__netbsd.c) = 8bb3a4612f5693727f66f6d3a16261e9087b01f0 +SHA1 (patch-src_runtime_os__openbsd.c) = a32f610eba883d17140aea8639953f76593266c0 SHA1 (patch-src_runtime_os__solaris.c) = eec5b293fe4a72f58e4cd51cd23ea6e6fce714b6 SHA1 (patch-src_runtime_os__solaris.h) = c0a39aa6ab57eca7056178c87ebb00bb21236499 SHA1 (patch-src_runtime_proc.c) = 0167ab97ea9229f57d21c549201c2d17965e4c69 SHA1 (patch-src_runtime_runtime.h) = ab89a3da0870c346529cfe5b8bda202aba0b59f7 +SHA1 (patch-src_runtime_stack.c) = 6bb75bb7aa725a98d2b39b015e8e5692ed26be24 SHA1 (patch-src_runtime_sys__darwin__386.s) = e352e039bba8435a48b88c76290b245731c299ed SHA1 (patch-src_runtime_sys__darwin__amd64.s) = 3eccddc8228657db1480393f8476ddd68ac942ff SHA1 (patch-src_runtime_sys__solaris__amd64.s) = 88f2e3fc43b0d6e4f17ef06d3f4f27cfed3103c6 Added files: Index: pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__386.h diff -u /dev/null pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__386.h:1.1 --- /dev/null Sat Apr 13 23:09:41 2019 +++ pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__386.h Sat Apr 13 23:09:40 2019 @@ -0,0 +1,16 @@ +$NetBSD: patch-src_runtime_defs__openbsd__386.h,v 1.1 2019/04/13 23:09:40 maya Exp $ +$OpenBSD: patch-src_runtime_defs_openbsd_386_h,v 1.1 2018/04/05 17:47:30 jsing Exp $ + +OpenBSD 6.4 needs stack pages to be mapped with MAP_STACK. + +Index: src/runtime/defs_openbsd_386.h +--- src/runtime/defs_openbsd_386.h.orig ++++ src/runtime/defs_openbsd_386.h +@@ -14,6 +14,7 @@ enum { + MAP_ANON = 0x1000, + MAP_PRIVATE = 0x2, + MAP_FIXED = 0x10, ++ MAP_STACK = 0x4000, + + MADV_FREE = 0x6, + Index: pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__amd64.h diff -u /dev/null pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__amd64.h:1.1 --- /dev/null Sat Apr 13 23:09:41 2019 +++ pkgsrc/lang/go14/patches/patch-src_runtime_defs__openbsd__amd64.h Sat Apr 13 23:09:40 2019 @@ -0,0 +1,16 @@ +$NetBSD: patch-src_runtime_defs__openbsd__amd64.h,v 1.1 2019/04/13 23:09:40 maya Exp $ +$OpenBSD: patch-src_runtime_defs_openbsd_amd64_h,v 1.1 2018/04/05 17:47:30 jsing Exp $ + +OpenBSD 6.4 needs stack pages to be mapped with MAP_STACK. + +Index: src/runtime/defs_openbsd_amd64.h +--- src/runtime/defs_openbsd_amd64.h.orig ++++ src/runtime/defs_openbsd_amd64.h +@@ -14,6 +14,7 @@ enum { + MAP_ANON = 0x1000, + MAP_PRIVATE = 0x2, + MAP_FIXED = 0x10, ++ MAP_STACK = 0x4000, + + MADV_FREE = 0x6, + Index: pkgsrc/lang/go14/patches/patch-src_runtime_malloc.h diff -u /dev/null pkgsrc/lang/go14/patches/patch-src_runtime_malloc.h:1.1 --- /dev/null Sat Apr 13 23:09:41 2019 +++ pkgsrc/lang/go14/patches/patch-src_runtime_malloc.h Sat Apr 13 23:09:40 2019 @@ -0,0 +1,16 @@ +$NetBSD: patch-src_runtime_malloc.h,v 1.1 2019/04/13 23:09:40 maya Exp $ +$OpenBSD: patch-src_runtime_malloc_h,v 1.1 2018/04/05 17:47:30 jsing Exp $ + +OpenBSD 6.4 needs stack pages to be mapped with MAP_STACK. + +Index: src/runtime/malloc.h +--- src/runtime/malloc.h.orig ++++ src/runtime/malloc.h +@@ -197,6 +197,7 @@ struct MLink + // if accessed. Used only for debugging the runtime. + + void* runtime·sysAlloc(uintptr nbytes, uint64 *stat); ++void runtime·sysMarkStack(void *v, uintptr nbytes); + void runtime·SysFree(void *v, uintptr nbytes, uint64 *stat); + void runtime·SysUnused(void *v, uintptr nbytes); + void runtime·SysUsed(void *v, uintptr nbytes); Index: pkgsrc/lang/go14/patches/patch-src_runtime_mem__openbsd.c diff -u /dev/null pkgsrc/lang/go14/patches/patch-src_runtime_mem__openbsd.c:1.1 --- /dev/null Sat Apr 13 23:09:41 2019 +++ pkgsrc/lang/go14/patches/patch-src_runtime_mem__openbsd.c Sat Apr 13 23:09:40 2019 @@ -0,0 +1,26 @@ +$NetBSD: patch-src_runtime_mem__openbsd.c,v 1.1 2019/04/13 23:09:40 maya Exp $ +$OpenBSD: patch-src_runtime_mem_openbsd_c,v 1.1 2018/04/05 17:47:30 jsing Exp $ + +OpenBSD 6.4 needs stack pages to be mapped with MAP_STACK. + +Index: src/runtime/mem_openbsd.c +--- src/runtime/mem_openbsd.c.orig ++++ src/runtime/mem_openbsd.c +@@ -27,6 +27,17 @@ runtime·sysAlloc(uintptr n, uint64 *stat) + return v; + } + ++#pragma textflag NOSPLIT ++void ++runtime·sysMarkStack(void *v, uintptr n) ++{ ++ void *p; ++ ++ p = runtime·mmap(v, n, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_ANON|MAP_PRIVATE|MAP_STACK, -1, 0); ++ if (p == ((void *)-1) || p != v) ++ runtime·throw("runtime: failed to mark stack"); ++} ++ + void + runtime·SysUnused(void *v, uintptr n) + { Index: pkgsrc/lang/go14/patches/patch-src_runtime_os__openbsd.c diff -u /dev/null pkgsrc/lang/go14/patches/patch-src_runtime_os__openbsd.c:1.1 --- /dev/null Sat Apr 13 23:09:41 2019 +++ pkgsrc/lang/go14/patches/patch-src_runtime_os__openbsd.c Sat Apr 13 23:09:40 2019 @@ -0,0 +1,17 @@ +$NetBSD: patch-src_runtime_os__openbsd.c,v 1.1 2019/04/13 23:09:40 maya Exp $ +$OpenBSD: patch-src_runtime_os_openbsd_c,v 1.1 2018/04/05 17:47:30 jsing Exp $ + +OpenBSD 6.4 needs stack pages to be mapped with MAP_STACK. + +Index: src/runtime/os_openbsd.c +--- src/runtime/os_openbsd.c.orig ++++ src/runtime/os_openbsd.c +@@ -167,7 +167,7 @@ runtime·newosproc(M *mp, void *stk) + + param.tf_tcb = (byte*)&mp->tls[0]; + param.tf_tid = (int32*)&mp->procid; +- param.tf_stack = stk; ++ param.tf_stack = (void*)((uintptr)stk - 8); + + oset = runtime·sigprocmask(SIG_SETMASK, sigset_all); + ret = runtime·tfork(¶m, sizeof(param), mp, mp->g0, runtime·mstart); Index: pkgsrc/lang/go14/patches/patch-src_runtime_stack.c diff -u /dev/null pkgsrc/lang/go14/patches/patch-src_runtime_stack.c:1.1 --- /dev/null Sat Apr 13 23:09:41 2019 +++ pkgsrc/lang/go14/patches/patch-src_runtime_stack.c Sat Apr 13 23:09:40 2019 @@ -0,0 +1,26 @@ +$NetBSD: patch-src_runtime_stack.c,v 1.1 2019/04/13 23:09:40 maya Exp $ + +OpenBSD 6.4 needs stack pages to be mapped with MAP_STACK. + +--- src/runtime/stack.c.orig 2015-09-23 04:37:37.000000000 +0000 ++++ src/runtime/stack.c +@@ -67,6 +67,9 @@ poolalloc(uint8 order) + s = runtime·MHeap_AllocStack(&runtime·mheap, StackCacheSize >> PageShift); + if(s == nil) + runtime·throw("out of memory"); ++#ifdef GOOS_openbsd ++ runtime·sysMarkStack((void *)(s->start << PageShift), s->npages << PageShift); ++#endif + if(s->ref != 0) + runtime·throw("bad ref"); + if(s->freelist != nil) +@@ -246,6 +249,9 @@ runtime·stackalloc(uint32 n) + s = runtime·MHeap_AllocStack(&runtime·mheap, ROUND(n, PageSize) >> PageShift); + if(s == nil) + runtime·throw("out of memory"); ++#ifdef GOOS_openbsd ++ runtime·sysMarkStack((void *)(s->start << PageShift), s->npages << PageShift); ++#endif + v = (byte*)(s->start<