summaryrefslogtreecommitdiff
path: root/lang/go14
diff options
context:
space:
mode:
authorchristos <christos@pkgsrc.org>2018-01-20 16:55:25 +0000
committerchristos <christos@pkgsrc.org>2018-01-20 16:55:25 +0000
commit059d13acfbe2d3dd2d8207765e53a338a3d143c5 (patch)
treef58cd32979a21f5bc9082a0415ca8f9dac015949 /lang/go14
parent30293057975fed7784b6fce22f87fd0af1574d69 (diff)
downloadpkgsrc-059d13acfbe2d3dd2d8207765e53a338a3d143c5.tar.gz
Add Yasushi Oshima patches for arm from:
https://github.com/oshimaya/pkgsrc/tree/master/lang/go14
Diffstat (limited to 'lang/go14')
-rw-r--r--lang/go14/Makefile6
-rw-r--r--lang/go14/distinfo19
-rw-r--r--lang/go14/patches/patch-src_cmd_5l_obj.c32
-rw-r--r--lang/go14/patches/patch-src_cmd_6l_obj.c31
-rw-r--r--lang/go14/patches/patch-src_cmd_ld_elf.c17
-rw-r--r--lang/go14/patches/patch-src_make.bash28
-rw-r--r--lang/go14/patches/patch-src_runtime_debug__netbsd.go17
-rw-r--r--lang/go14/patches/patch-src_runtime_defs__netbsd.go12
-rw-r--r--lang/go14/patches/patch-src_runtime_defs__netbsd__arm.h51
-rw-r--r--lang/go14/patches/patch-src_runtime_mgc0.c30
-rw-r--r--lang/go14/patches/patch-src_runtime_mheap.c18
-rw-r--r--lang/go14/patches/patch-src_runtime_os__netbsd.c67
-rw-r--r--lang/go14/patches/patch-src_runtime_proc.c16
-rw-r--r--lang/go14/patches/patch-src_runtime_runtime.h16
-rw-r--r--lang/go14/patches/patch-src_syscall_sockcmsg__unix.go14
-rw-r--r--lang/go14/patches/patch-src_syscall_syscall__netbsd__386.go17
-rw-r--r--lang/go14/patches/patch-src_syscall_syscall__netbsd__amd64.go17
-rw-r--r--lang/go14/patches/patch-src_syscall_syscall__netbsd__arm.go17
-rw-r--r--lang/go14/patches/patch-src_syscall_syscall__unix.go12
19 files changed, 433 insertions, 4 deletions
diff --git a/lang/go14/Makefile b/lang/go14/Makefile
index 5d499e3deaa..2e440d2776c 100644
--- a/lang/go14/Makefile
+++ b/lang/go14/Makefile
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.14 2017/10/04 10:03:53 jperkin Exp $
+# $NetBSD: Makefile,v 1.15 2018/01/20 16:55:25 christos Exp $
.include "../../lang/go/version.mk"
DISTNAME= go${GO14_VERSION}.src
PKGNAME= go14-${GO14_VERSION}
-PKGREVISION= 5
+PKGREVISION= 6
CATEGORIES= lang
MASTER_SITES= https://storage.googleapis.com/golang/
PATCH_SITES= https://codereview.appspot.com/download/
@@ -81,7 +81,7 @@ CHECK_INTERPRETER_SKIP+= go14/src/make.rc
CHECK_INTERPRETER_SKIP+= go14/src/run.rc
do-build:
- cd ${WRKSRC}/src && ${PKGSRC_SETENV} ${MAKE_ENV} ${BASH} ./make.bash
+ cd ${WRKSRC}/src && ${PKGSRC_SETENV} ${MAKE_ENV} ${GOOPT} ${BASH} ./make.bash
do-install:
cd ${WRKSRC} && rm -rf .hgignore .hgtags pkg/obj
diff --git a/lang/go14/distinfo b/lang/go14/distinfo
index 328e8fd0ba6..23ea808fabb 100644
--- a/lang/go14/distinfo
+++ b/lang/go14/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.8 2017/10/19 14:29:01 jperkin Exp $
+$NetBSD: distinfo,v 1.9 2018/01/20 16:55:25 christos Exp $
SHA1 (go1.4.3.src.tar.gz) = 486db10dc571a55c8d795365070f66d343458c48
RMD160 (go1.4.3.src.tar.gz) = b1fbb2805a777c8107e7c946f36a881303ac5e35
@@ -10,19 +10,23 @@ SHA1 (patch-misc_cgo_test_cthread__unix.c) = a63f08f07713bd32e279315cca21235101c
SHA1 (patch-misc_cgo_testso_cgoso.go) = ef782a6f173c814656eac0df640aedaa1a923bbc
SHA1 (patch-misc_cgo_testso_cgoso__unix.go) = 58e221e1ce123428a3fe6ecededf0590cbfb81ca
SHA1 (patch-src_cmd_5l_asm.c) = fd78203b7c92b9bbd057077671d649bac2d121ee
+SHA1 (patch-src_cmd_5l_obj.c) = 784a6c1e61ea54449772e35f257aa080c632273d
SHA1 (patch-src_cmd_6c_txt.c) = 7ccddadedceb13b6a7c2f29cdfca501a85888488
SHA1 (patch-src_cmd_6l_asm.c) = e15ece4886c459c500b91b3b0c6a4ccbe111bfc0
+SHA1 (patch-src_cmd_6l_obj.c) = 93599668f635b73c92fbf1f05bbd84d8170b4f7a
SHA1 (patch-src_cmd_8l_asm.c) = a402a0db31d875cc04e8e15b2e4567ff2f77fee3
SHA1 (patch-src_cmd_go_build.go) = f7705aa955241d3add353a144a676a58a0a1617e
SHA1 (patch-src_cmd_go_pkg.go) = e70441f3fdf312eb389e4dd5408c207a4d4b8350
SHA1 (patch-src_cmd_ld_data.c) = 96181bac03333f7bc5293ab9ddbd68bb9174ed47
SHA1 (patch-src_cmd_ld_doc.go) = 000447f5a5862358a85a7510dc92195494972e26
+SHA1 (patch-src_cmd_ld_elf.c) = 32a2fb67fb70bcfb762e6bca7d0f52a4c3548a8a
SHA1 (patch-src_cmd_ld_elf.h) = 067272ae88ec8631917e260c260ecbc84ce33dd5
SHA1 (patch-src_cmd_ld_ldelf.c) = fce969ab60486b892b1bb81cd84237b77bf6e65f
SHA1 (patch-src_cmd_ld_lib.h) = e6aa8b9520e1b75f435e179e5ea4f0ef738621f4
SHA1 (patch-src_cmd_ld_pobj.c) = eaf67d6bc4f9ba835893f9d8c2d36941ff84933d
SHA1 (patch-src_crypto_x509_root__unix.go) = c933f334da1c8de48a06d23abd12da01f73776e6
SHA1 (patch-src_go_build_build.go) = b68bc557e7b48877889c63070e9cb9d8360f40f5
+SHA1 (patch-src_make.bash) = 337a0f384d71b6cad84f00da7749b9f70d641dec
SHA1 (patch-src_net_cgo__bsd.go) = 4678fccd6956300ce55343965334fc3881383bbc
SHA1 (patch-src_net_cgo__stub.go) = cf373587745d68e556dadf3a61956b489b4f420a
SHA1 (patch-src_net_cgo__unix.go) = cebe897ab624aaf52bebc50d12a045d6b4ea2bc6
@@ -31,12 +35,25 @@ SHA1 (patch-src_runtime_cgo_cgo.go) = 9cc88b35d12e0d52e76495e04f7fce2b78af08d5
SHA1 (patch-src_runtime_cgo_gcc__setenv.c) = c9614b76d71e84ad46b2ce785580fdc54b261455
SHA1 (patch-src_runtime_cgo_gcc__solaris__amd64.c) = 633d8dcc8a843e343ee2ab9edb7cfaf6f6c3865b
SHA1 (patch-src_runtime_cgo_setenv.c) = f3b56885fa54cabf78944fad75c21f04bea5cd88
+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_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__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_sys__darwin__386.s) = e352e039bba8435a48b88c76290b245731c299ed
SHA1 (patch-src_runtime_sys__darwin__amd64.s) = 3eccddc8228657db1480393f8476ddd68ac942ff
SHA1 (patch-src_runtime_sys__solaris__amd64.s) = 88f2e3fc43b0d6e4f17ef06d3f4f27cfed3103c6
SHA1 (patch-src_runtime_thunk__solaris__amd64.s) = 2835cdc171ae3209c61ef804fbfbf22cdf68bf43
+SHA1 (patch-src_syscall_sockcmsg__unix.go) = f8189d04c5f33a0a22be30100d1f1aedb24e1365
SHA1 (patch-src_syscall_syscall__darwin__386.go) = 2f0986bdb199feaa73e933a1a75df87e5c7a8bff
SHA1 (patch-src_syscall_syscall__darwin__amd64.go) = 1bfba4b0f1e2fe6dee55b24f7f8d7cd89d05dea0
+SHA1 (patch-src_syscall_syscall__netbsd__386.go) = 1d742efd113ed9d94affac03677df8e20e394895
+SHA1 (patch-src_syscall_syscall__netbsd__amd64.go) = 1ccfece5a676eb90142762d5349b492c2dab901e
+SHA1 (patch-src_syscall_syscall__netbsd__arm.go) = 085735db967594350481d3e810ba649a7fb1ce60
+SHA1 (patch-src_syscall_syscall__unix.go) = e168ea3d4d463e2d9be22ae5345f6067693a9bc3
diff --git a/lang/go14/patches/patch-src_cmd_5l_obj.c b/lang/go14/patches/patch-src_cmd_5l_obj.c
new file mode 100644
index 00000000000..8b9d4bba87e
--- /dev/null
+++ b/lang/go14/patches/patch-src_cmd_5l_obj.c
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_cmd_5l_obj.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Change Load Align in ELF Program Headers to the same as the system standard
+
+--- src/cmd/5l/obj.c.orig 2015-09-23 04:37:36.000000000 +0000
++++ src/cmd/5l/obj.c
+@@ -82,7 +82,6 @@ archinit(void)
+ break;
+ case Hlinux: /* arm elf */
+ case Hfreebsd:
+- case Hnetbsd:
+ debug['d'] = 0; // with dynamic linking
+ elfinit();
+ HEADR = ELFRESERVE;
+@@ -93,6 +92,17 @@ archinit(void)
+ if(INITRND == -1)
+ INITRND = 4096;
+ break;
++ case Hnetbsd:
++ debug['d'] = 0; // with dynamic linking
++ elfinit();
++ HEADR = ELFRESERVE;
++ if(INITTEXT == -1)
++ INITTEXT = 0x10000 + HEADR;
++ if(INITDAT == -1)
++ INITDAT = 0;
++ if(INITRND == -1)
++ INITRND = 0x10000;
++ break;
+ case Hnacl:
+ elfinit();
+ HEADR = 0x10000;
diff --git a/lang/go14/patches/patch-src_cmd_6l_obj.c b/lang/go14/patches/patch-src_cmd_6l_obj.c
new file mode 100644
index 00000000000..608d2fd726f
--- /dev/null
+++ b/lang/go14/patches/patch-src_cmd_6l_obj.c
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_cmd_6l_obj.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Change Load Align in ELF Program Headers to the same as the system standard.
+
+--- src/cmd/6l/obj.c.orig 2015-09-23 04:37:36.000000000 +0000
++++ src/cmd/6l/obj.c
+@@ -114,7 +114,6 @@ archinit(void)
+ break;
+ case Hlinux: /* elf64 executable */
+ case Hfreebsd: /* freebsd */
+- case Hnetbsd: /* netbsd */
+ case Hopenbsd: /* openbsd */
+ case Hdragonfly: /* dragonfly */
+ case Hsolaris: /* solaris */
+@@ -127,6 +126,16 @@ archinit(void)
+ if(INITRND == -1)
+ INITRND = 4096;
+ break;
++ case Hnetbsd: /* netbsd */
++ elfinit();
++ HEADR = ELFRESERVE;
++ if(INITTEXT == -1)
++ INITTEXT = (1<<22)+HEADR;
++ if(INITDAT == -1)
++ INITDAT = 0;
++ if(INITRND == -1)
++ INITRND = 0x200000;
++ break;
+ case Hnacl:
+ elfinit();
+ debug['w']++; // disable dwarf, which gets confused and is useless anyway
diff --git a/lang/go14/patches/patch-src_cmd_ld_elf.c b/lang/go14/patches/patch-src_cmd_ld_elf.c
new file mode 100644
index 00000000000..0ae486dd891
--- /dev/null
+++ b/lang/go14/patches/patch-src_cmd_ld_elf.c
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_cmd_ld_elf.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Change to EABI when NetBSD/arm (earm)
+
+--- src/cmd/ld/elf.c.orig 2015-09-23 04:37:36.000000000 +0000
++++ src/cmd/ld/elf.c
+@@ -55,8 +55,8 @@ elfinit(void)
+
+ // 32-bit architectures
+ case '5':
+- // we use EABI on both linux/arm and freebsd/arm.
+- if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd)
++ // we use EABI on linux/arm, freebsd/arm and netbsd/arm
++ if(HEADTYPE == Hlinux || HEADTYPE == Hfreebsd || Hnetbsd)
+ hdr.flags = 0x5000002; // has entry point, Version5 EABI
+ // fallthrough
+ default:
diff --git a/lang/go14/patches/patch-src_make.bash b/lang/go14/patches/patch-src_make.bash
new file mode 100644
index 00000000000..fb3680f2c6c
--- /dev/null
+++ b/lang/go14/patches/patch-src_make.bash
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_make.bash,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Workaround for Warninig armv5 instruction in GCC4.8 generic arm compiler
+
+--- src/make.bash.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/make.bash
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env bash
++#!/usr/pkg/bin/bash
+ # Copyright 2009 The Go Authors. All rights reserved.
+ # Use of this source code is governed by a BSD-style
+ # license that can be found in the LICENSE file.
+@@ -121,6 +121,15 @@ case "$GOHOSTARCH" in
+ 386) mflag=-m32;;
+ amd64) mflag=-m64;;
+ esac
++
++# In gcc 4.8 on NetBSD 7.0, need -march=armv5 flag for arm target.
++# Default target of gcc is generic-arm. however some assemble-sources
++# in golang use operator for armv5 or lator.
++
++if [ "$GOARCH" == "arm" -o -z '$GOARCH' -a "$(uname -sp)" == "NetBSD earm" ]; then
++ mflag="-march=armv5"
++fi
++
+ if [ "$(uname)" == "Darwin" ]; then
+ # golang.org/issue/5261
+ mflag="$mflag -mmacosx-version-min=10.6"
diff --git a/lang/go14/patches/patch-src_runtime_debug__netbsd.go b/lang/go14/patches/patch-src_runtime_debug__netbsd.go
new file mode 100644
index 00000000000..03f1d482de8
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_debug__netbsd.go
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_runtime_debug__netbsd.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * add function return 'Real' pagesize from runtime package
+
+--- src/runtime/debug_netbsd.go.orig 2016-08-27 17:50:31.000000000 +0000
++++ src/runtime/debug_netbsd.go
+@@ -0,0 +1,10 @@
++// Copyright 2009 The Go Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style
++// license that can be found in the LICENSE file.
++// +build netbsd
++
++package runtime
++
++func Physpagesize() int {
++ return int(physpagesz)
++}
diff --git a/lang/go14/patches/patch-src_runtime_defs__netbsd.go b/lang/go14/patches/patch-src_runtime_defs__netbsd.go
new file mode 100644
index 00000000000..a4df9ac5d82
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_defs__netbsd.go
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_runtime_defs__netbsd.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Fix Struct name Kevent to KeventT.This file is the base of defs_netbsd_XXX
+
+--- src/runtime/defs_netbsd.go.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/defs_netbsd.go
+@@ -122,4 +122,4 @@ type Itimerval C.struct_itimerval
+ type McontextT C.mcontext_t
+ type UcontextT C.ucontext_t
+
+-type Kevent C.struct_kevent
++type KeventT C.struct_kevent
diff --git a/lang/go14/patches/patch-src_runtime_defs__netbsd__arm.h b/lang/go14/patches/patch-src_runtime_defs__netbsd__arm.h
new file mode 100644
index 00000000000..043462f3078
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_defs__netbsd__arm.h
@@ -0,0 +1,51 @@
+$NetBSD: patch-src_runtime_defs__netbsd__arm.h,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Change to EABI in netbsd/arm the aliment is changed when 64bit value.
+
+--- src/runtime/defs_netbsd_arm.h.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/defs_netbsd_arm.h
+@@ -119,10 +119,12 @@ struct StackT {
+ struct Timespec {
+ int64 tv_sec;
+ int32 tv_nsec;
++ byte Pad_cgo_0[4];
+ };
+ struct Timeval {
+ int64 tv_sec;
+ int32 tv_usec;
++ byte Pad_cgo_0[4];
+ };
+ struct Itimerval {
+ Timeval it_interval;
+@@ -131,18 +133,18 @@ struct Itimerval {
+
+ struct McontextT {
+ uint32 __gregs[17];
+-#ifdef __ARM_EABI__
+- byte __fpu[4+8*32+4];
+-#else
+- byte __fpu[4+4*33+4];
+-#endif
++ byte Pad_cgo_0[4];
++ // For EABI, fpscr[4]+pad[4]+fstmx[8*32]+fpsid[4]+pad[4]
++ byte __fpu[272];
+ uint32 _mc_tlsbase;
++ byte Pad_cgo_1[4];
+ };
+ struct UcontextT {
+ uint32 uc_flags;
+ UcontextT *uc_link;
+ Sigset uc_sigmask;
+ StackT uc_stack;
++ byte Pad_cgo_0[4];
+ McontextT uc_mcontext;
+ int32 __uc_pad[2];
+ };
+@@ -154,6 +156,7 @@ struct KeventT {
+ uint32 fflags;
+ int64 data;
+ byte *udata;
++ byte Pad_cgo_0[4];
+ };
+
+
diff --git a/lang/go14/patches/patch-src_runtime_mgc0.c b/lang/go14/patches/patch-src_runtime_mgc0.c
new file mode 100644
index 00000000000..aa65d11d745
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_mgc0.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_runtime_mgc0.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Change PhysPageSize to variable
+
+--- src/runtime/mgc0.c.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/mgc0.c
+@@ -330,7 +330,11 @@ scanblock(byte *b, uintptr n, byte *ptrm
+ if(obj == nil)
+ continue;
+ if(obj < arena_start || obj >= arena_used) {
++#ifndef GOOS_netbsd
+ if((uintptr)obj < PhysPageSize && runtime·invalidptr) {
++#else
++ if((uintptr)obj < runtime·physpagesz && runtime·invalidptr) {
++#endif
+ s = nil;
+ goto badobj;
+ }
+@@ -1893,7 +1897,11 @@ runtime·MHeap_MapBits(MHeap *h)
+
+ n = (h->arena_used - h->arena_start) / (PtrSize*wordsPerBitmapByte);
+ n = ROUND(n, bitmapChunk);
++#ifndef GOOS_netbsd
+ n = ROUND(n, PhysPageSize);
++#else
++ n = ROUND(n, runtime·physpagesz);
++#endif
+ if(h->bitmap_mapped >= n)
+ return;
+
diff --git a/lang/go14/patches/patch-src_runtime_mheap.c b/lang/go14/patches/patch-src_runtime_mheap.c
new file mode 100644
index 00000000000..d5c5c4e32b8
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_mheap.c
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_runtime_mheap.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Change PhysPageSize to variable.
+
+--- src/runtime/mheap.c.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/mheap.c
+@@ -82,7 +82,11 @@ runtime·MHeap_MapSpans(MHeap *h)
+ n = (uintptr)h->arena_used;
+ n -= (uintptr)h->arena_start;
+ n = n / PageSize * sizeof(h->spans[0]);
++#ifndef GOOS_netbsd
+ n = ROUND(n, PhysPageSize);
++#else
++ n = ROUND(n, runtime·physpagesz);
++#endif
+ if(h->spans_mapped >= n)
+ return;
+ runtime·SysMap((byte*)h->spans + h->spans_mapped, n - h->spans_mapped, h->arena_reserved, &mstats.other_sys);
diff --git a/lang/go14/patches/patch-src_runtime_os__netbsd.c b/lang/go14/patches/patch-src_runtime_os__netbsd.c
new file mode 100644
index 00000000000..143fd39aa81
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_os__netbsd.c
@@ -0,0 +1,67 @@
+$NetBSD: patch-src_runtime_os__netbsd.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Use 'Real' pagesize from sysctl mib HW_PAGESIZE
+
+ * Change HW_NCPU to NCPUONLINE for 'Real' number of available CPU
+
+--- src/runtime/os_netbsd.c.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/os_netbsd.c
+@@ -5,6 +5,7 @@
+ #include "runtime.h"
+ #include "defs_GOOS_GOARCH.h"
+ #include "os_GOOS.h"
++#include "arch_GOARCH.h"
+ #include "signal_unix.h"
+ #include "stack.h"
+ #include "textflag.h"
+@@ -35,7 +36,8 @@ extern int32 runtime·lwp_self(void);
+
+ // From NetBSD's <sys/sysctl.h>
+ #define CTL_HW 6
+-#define HW_NCPU 3
++#define HW_NCPUONLINE 16
++#define HW_PAGESIZE 7
+
+ static int32
+ getncpu(void)
+@@ -47,7 +49,7 @@ getncpu(void)
+
+ // Fetch hw.ncpu via sysctl.
+ mib[0] = CTL_HW;
+- mib[1] = HW_NCPU;
++ mib[1] = HW_NCPUONLINE;
+ nout = sizeof out;
+ out = 0;
+ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
+@@ -57,6 +59,23 @@ getncpu(void)
+ return 1;
+ }
+
++static uintptr
++getphyspagesize(void)
++{
++ uint32 mib[2];
++ uintptr out, nout;
++ int32 ret;
++ mib[0] = CTL_HW;
++ mib[1] = HW_PAGESIZE;
++ nout = sizeof out;
++ out = 0;
++ ret = runtime·sysctl(mib, 2, (byte*)&out, &nout, nil, 0);
++ if(ret >= 0)
++ return out;
++ else
++ return PhysPageSize;
++}
++
+ #pragma textflag NOSPLIT
+ uintptr
+ runtime·semacreate(void)
+@@ -239,6 +258,7 @@ void
+ runtime·osinit(void)
+ {
+ runtime·ncpu = getncpu();
++ runtime·physpagesz = getphyspagesize();
+ }
+
+ #pragma textflag NOSPLIT
diff --git a/lang/go14/patches/patch-src_runtime_proc.c b/lang/go14/patches/patch-src_runtime_proc.c
new file mode 100644
index 00000000000..b90ed9f592e
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_proc.c
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_runtime_proc.c,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * add physpagesz variable when netbsd
+
+--- src/runtime/proc.c.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/proc.c
+@@ -44,6 +44,9 @@ P* runtime·allp[MaxGomaxprocs+1];
+ int8* runtime·goos;
+ int32 runtime·ncpu;
+ int32 runtime·newprocs;
++#ifdef GOOS_netbsd
++uintptr runtime·physpagesz;
++#endif
+
+ Mutex runtime·allglock; // the following vars are protected by this lock or by stoptheworld
+ G** runtime·allg;
diff --git a/lang/go14/patches/patch-src_runtime_runtime.h b/lang/go14/patches/patch-src_runtime_runtime.h
new file mode 100644
index 00000000000..671024a25b2
--- /dev/null
+++ b/lang/go14/patches/patch-src_runtime_runtime.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_runtime_runtime.h,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Add extern for physpagesz
+
+--- src/runtime/runtime.h.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/runtime/runtime.h
+@@ -765,6 +765,9 @@ extern Note runtime·signote;
+ extern ForceGCState runtime·forcegc;
+ extern SchedT runtime·sched;
+ extern int32 runtime·newprocs;
++#ifdef GOOS_netbsd
++extern uintptr runtime·physpagesz;
++#endif
+
+ /*
+ * common functions and data
diff --git a/lang/go14/patches/patch-src_syscall_sockcmsg__unix.go b/lang/go14/patches/patch-src_syscall_sockcmsg__unix.go
new file mode 100644
index 00000000000..05e646835be
--- /dev/null
+++ b/lang/go14/patches/patch-src_syscall_sockcmsg__unix.go
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_syscall_sockcmsg__unix.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+--- src/syscall/sockcmsg_unix.go.orig 2017-07-23 05:37:09.000000000 +0000
++++ src/syscall/sockcmsg_unix.go
+@@ -18,6 +18,9 @@ func cmsgAlignOf(salen int) int {
+ if darwin64Bit || dragonfly64Bit {
+ salign = 4
+ }
++ if netbsd32BitArm {
++ salign = 8
++ }
+ return (salen + salign - 1) & ^(salign - 1)
+ }
+
diff --git a/lang/go14/patches/patch-src_syscall_syscall__netbsd__386.go b/lang/go14/patches/patch-src_syscall_syscall__netbsd__386.go
new file mode 100644
index 00000000000..eaf4b1f93dc
--- /dev/null
+++ b/lang/go14/patches/patch-src_syscall_syscall__netbsd__386.go
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_syscall_syscall__netbsd__386.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Add Getpagesize function which return 'Real' pagesize
+
+--- src/syscall/syscall_netbsd_386.go.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/syscall/syscall_netbsd_386.go
+@@ -4,7 +4,9 @@
+
+ package syscall
+
+-func Getpagesize() int { return 4096 }
++import "runtime"
++
++func Getpagesize() int { return runtime.Physpagesize() }
+
+ func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
+
diff --git a/lang/go14/patches/patch-src_syscall_syscall__netbsd__amd64.go b/lang/go14/patches/patch-src_syscall_syscall__netbsd__amd64.go
new file mode 100644
index 00000000000..42a4e0e7fae
--- /dev/null
+++ b/lang/go14/patches/patch-src_syscall_syscall__netbsd__amd64.go
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_syscall_syscall__netbsd__amd64.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ * Add function Getpagesize(), which return 'Real' pagesize in runtime
+
+--- src/syscall/syscall_netbsd_amd64.go.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/syscall/syscall_netbsd_amd64.go
+@@ -4,7 +4,9 @@
+
+ package syscall
+
+-func Getpagesize() int { return 4096 }
++import "runtime"
++
++func Getpagesize() int { return runtime.Physpagesize() }
+
+ func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
+
diff --git a/lang/go14/patches/patch-src_syscall_syscall__netbsd__arm.go b/lang/go14/patches/patch-src_syscall_syscall__netbsd__arm.go
new file mode 100644
index 00000000000..9e410b8a4c3
--- /dev/null
+++ b/lang/go14/patches/patch-src_syscall_syscall__netbsd__arm.go
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_syscall_syscall__netbsd__arm.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+ *
+
+--- src/syscall/syscall_netbsd_arm.go.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/syscall/syscall_netbsd_arm.go
+@@ -4,7 +4,9 @@
+
+ package syscall
+
+-func Getpagesize() int { return 4096 }
++import "runtime"
++
++func Getpagesize() int { return runtime.Physpagesize() }
+
+ func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
+
diff --git a/lang/go14/patches/patch-src_syscall_syscall__unix.go b/lang/go14/patches/patch-src_syscall_syscall__unix.go
new file mode 100644
index 00000000000..fb9511324de
--- /dev/null
+++ b/lang/go14/patches/patch-src_syscall_syscall__unix.go
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_syscall_syscall__unix.go,v 1.1 2018/01/20 16:55:25 christos Exp $
+
+--- src/syscall/syscall_unix.go.orig 2015-09-23 04:37:37.000000000 +0000
++++ src/syscall/syscall_unix.go
+@@ -22,6 +22,7 @@ const (
+ darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
+ dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
+ netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
++ netbsd32BitArm = runtime.GOOS == "netbsd" && runtime.GOOS == "arm"
+ )
+
+ func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)