pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/go Add Yasushi Oshima patches for arm from:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/52cdc073188a
branches:  trunk
changeset: 374308:52cdc073188a
user:      christos <christos%pkgsrc.org@localhost>
date:      Sat Jan 20 16:55:05 2018 +0000

description:
Add Yasushi Oshima patches for arm from:
    https://github.com/oshimaya/pkgsrc/tree/master/lang/go

diffstat:

 lang/go/Makefile                                      |  10 +-
 lang/go/PLIST                                         |   3 +-
 lang/go/distinfo                                      |   6 +-
 lang/go/patches/patch-src_cmd_dist_util.go            |  16 +++
 lang/go/patches/patch-src_cmd_link_internal_ld_elf.go |  85 +++++++++++++++++++
 lang/go/patches/patch-src_runtime_os__netbsd.go       |  21 ++++
 lang/go/patches/patch-src_runtime_rt0__netbsd__arm.s  |  13 ++
 lang/go/version.mk                                    |  11 +-
 8 files changed, 156 insertions(+), 9 deletions(-)

diffs (261 lines):

diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/Makefile
--- a/lang/go/Makefile  Sat Jan 20 12:19:09 2018 +0000
+++ b/lang/go/Makefile  Sat Jan 20 16:55:05 2018 +0000
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.58 2017/11/14 09:53:53 wiz Exp $
+# $NetBSD: Makefile,v 1.59 2018/01/20 16:55:05 christos Exp $
 
 .include "version.mk"
 
 DISTNAME=      go${GO_VERSION}.src
 PKGNAME=       go-${GO_VERSION}
+PKGREVISION=   1
 CATEGORIES=    lang
 MASTER_SITES=  https://storage.googleapis.com/golang/
 EXTRACT_USING= bsdtar
@@ -37,6 +38,7 @@
 REPLACE_BASH+= misc/cgo/testgodefs/test.bash
 REPLACE_BASH+= misc/cgo/testplugin/test.bash
 REPLACE_BASH+= misc/cgo/testsanitizers/test.bash
+REPLACE_BASH+= misc/cgo/testplugin/test.bash
 REPLACE_BASH+= misc/nacl/go_nacl_386_exec
 REPLACE_BASH+= misc/nacl/go_nacl_amd64p32_exec
 REPLACE_BASH+= misc/nacl/go_nacl_arm_exec
@@ -92,9 +94,9 @@
 .endif
 
 do-build:
-       cd ${WRKSRC}/src && env GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:Q} GOROOT_FINAL=${GOROOT_FINAL:Q} ${BASH} ./make.bash
+       cd ${WRKSRC}/src && env GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:Q} GOROOT_FINAL=${GOROOT_FINAL:Q} ${GOOPT} ${BASH} ./make.bash
 # for RELRO build:
-#      cd ${WRKSRC}/src && env GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:Q} GOROOT_FINAL=${GOROOT_FINAL:Q} GO_LDFLAGS="-buildmode=pie" ${BASH} ./make.bash
+#      cd ${WRKSRC}/src && env GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:Q} GOROOT_FINAL=${GOROOT_FINAL:Q} GO_LDFLAGS="-buildmode=pie" ${GOOPT} ${BASH} ./make.bash
 
 do-install:
        cd ${WRKSRC} && rm -rf .hgignore .hgtags pkg/obj
@@ -105,6 +107,6 @@
 .endfor
 
 do-test:
-       cd ${WRKSRC}/src && GOROOT=${WRKSRC} PATH=${WRKSRC}/bin:${PATH} ${BASH} run.bash --no-rebuild --banner ""
+       cd ${WRKSRC}/src && GOROOT=${WRKSRC} PATH=${WRKSRC}/bin:${PATH} ${GOOPT} ${BASH} run.bash --no-rebuild --banner ""
 
 .include "../../mk/bsd.pkg.mk"
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/PLIST
--- a/lang/go/PLIST     Sat Jan 20 12:19:09 2018 +0000
+++ b/lang/go/PLIST     Sat Jan 20 16:55:05 2018 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.34 2017/10/28 18:20:14 bsiegert Exp $
+@comment $NetBSD: PLIST,v 1.35 2018/01/20 16:55:05 christos Exp $
 bin/go
 bin/gofmt
 go/AUTHORS
@@ -4584,6 +4584,7 @@
 go/src/runtime/crash_test.go
 go/src/runtime/crash_unix_test.go
 go/src/runtime/debug.go
+go/src/runtime/debug_netbsd.go
 go/src/runtime/debug/debug.s
 go/src/runtime/debug/garbage.go
 go/src/runtime/debug/garbage_test.go
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/distinfo
--- a/lang/go/distinfo  Sat Jan 20 12:19:09 2018 +0000
+++ b/lang/go/distinfo  Sat Jan 20 16:55:05 2018 +0000
@@ -1,8 +1,12 @@
-$NetBSD: distinfo,v 1.53 2017/10/28 18:20:14 bsiegert Exp $
+$NetBSD: distinfo,v 1.54 2018/01/20 16:55:05 christos Exp $
 
 SHA1 (go1.9.2.src.tar.gz) = 8a51dbdf51d6ee0e058b7de7c7606dbea23dfeec
 RMD160 (go1.9.2.src.tar.gz) = f8ae6b41af3f450b0d9a3d33aa9e0d5df39904d4
 SHA512 (go1.9.2.src.tar.gz) = 1034098575c317eeaf648629690a4dea0c479a69c3b80d9917f6b96c8781ce79c0f29859f667dc4e07d47a44972aa09bd0163a458f897cf45f9d09eb03e4abb5
 Size (go1.9.2.src.tar.gz) = 16383591 bytes
 SHA1 (patch-misc_io_clangwrap.sh) = cd91c47ba0fe7b6eb8009dd261c0c26c7d581c29
+SHA1 (patch-src_cmd_dist_util.go) = 24e6f1b6ded842a8ce322a40e8766f7d344bc47e
+SHA1 (patch-src_cmd_link_internal_ld_elf.go) = 290d0da125d4f1956e05ac98cddf09f465c344df
 SHA1 (patch-src_crypto_x509_root__bsd.go) = 93a2de7c685a0919fe93f5bc99f156e105dace4d
+SHA1 (patch-src_runtime_os__netbsd.go) = 9b80de94667e3f8d8d1ae3648ab1fe43dd55d577
+SHA1 (patch-src_runtime_rt0__netbsd__arm.s) = 45e727f4e89470505664e7c38bdb8ebd314bcaf5
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/patches/patch-src_cmd_dist_util.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_cmd_dist_util.go        Sat Jan 20 16:55:05 2018 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_cmd_dist_util.go,v 1.1 2018/01/20 16:55:05 christos Exp $
+
+--- src/cmd/dist/util.go.orig  2017-02-16 19:12:22.000000000 +0000
++++ src/cmd/dist/util.go
+@@ -531,6 +531,11 @@ func xgetgoarm() string {
+               // sense to auto-detect the setting.
+               return "7"
+       }
++      if goos == "netbsd" {
++              // NetBSD go/arm support only earmv6hf or earmv7hf now.
++              // Any armv5 (or before) devices cannot work.
++              return "6"
++      }
+       if gohostarch != "arm" || goos != gohostos {
+               // Conservative default for cross-compilation.
+               return "5"
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/patches/patch-src_cmd_link_internal_ld_elf.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_cmd_link_internal_ld_elf.go     Sat Jan 20 16:55:05 2018 +0000
@@ -0,0 +1,85 @@
+$NetBSD: patch-src_cmd_link_internal_ld_elf.go,v 1.1 2018/01/20 16:55:05 christos Exp $
+
+--- elf.go.orig        2017-10-25 14:30:21.000000000 -0400
++++ elf.go     2018-01-20 11:49:02.046813855 -0500
+@@ -1263,6 +1263,8 @@
+       ELF_NOTE_NETBSD_DESCSZ  = 4
+       ELF_NOTE_NETBSD_TAG     = 1
+       ELF_NOTE_NETBSD_VERSION = 599000000 /* NetBSD 5.99 */
++      ELF_NOTE_NETBSD_MARCH_NAMESZ = 7
++      ELF_NOTE_NETBSD_MARCH_TAG    = 5
+ )
+ 
+ var ELF_NOTE_NETBSD_NAME = []byte("NetBSD\x00")
+@@ -1272,6 +1274,23 @@
+       return elfnote(sh, startva, resoff, n, true)
+ }
+ 
++func elfnetbsdarmarch() []byte {
++      switch objabi.GOARM {
++      case 6:
++              return []byte("earmv6hf\x00")
++      case 7:
++              return []byte("earmv7hf\x00")
++      default:
++              return []byte("earm\x00")
++      }
++}
++
++func elfnetbsdarmsig(sh *ElfShdr, startva uint64, resoff uint64) int {
++      descsz := len(elfnetbsdarmarch())
++      n := int(Rnd(ELF_NOTE_NETBSD_MARCH_NAMESZ, 4) + Rnd(int64(descsz), 4))
++      return elfnote(sh, startva, resoff, n, true)
++}
++
+ func elfwritenetbsdsig() int {
+       // Write Elf_Note header.
+       sh := elfwritenotehdr(".note.netbsd.ident", ELF_NOTE_NETBSD_NAMESZ, ELF_NOTE_NETBSD_DESCSZ, ELF_NOTE_NETBSD_TAG)
+@@ -1285,7 +1304,20 @@
+       Cput(0)
+ 
+       Thearch.Lput(ELF_NOTE_NETBSD_VERSION)
+-
++      if SysArch.Family == sys.ARM {
++              mArch := elfnetbsdarmarch()
++              descsz := len(mArch)
++              sh2 := elfwritenotehdr(".note.netbsd.march",
++                      ELF_NOTE_NETBSD_MARCH_NAMESZ, uint32(descsz),
++                      ELF_NOTE_NETBSD_MARCH_TAG)
++              if sh2 == nil {
++                      return 0
++              }
++              Cwrite(ELF_NOTE_NETBSD_NAME)
++              Cput(0)
++              Cwrite(mArch)
++              return int(sh.size) + int(sh2.size)
++      }
+       return int(sh.size)
+ }
+ 
+@@ -1902,6 +1934,9 @@
+       }
+       if Headtype == objabi.Hnetbsd {
+               Addstring(shstrtab, ".note.netbsd.ident")
++              if SysArch.Family == sys.ARM {
++                      Addstring(shstrtab, ".note.netbsd.march")
++              }
+       }
+       if Headtype == objabi.Hopenbsd {
+               Addstring(shstrtab, ".note.openbsd.ident")
+@@ -2340,6 +2375,15 @@
+               pnote.flags = PF_R
+               phsh(pnote, sh)
+       }
++      if Headtype == objabi.Hnetbsd && SysArch.Family == sys.ARM {
++              var sh *ElfShdr
++              sh = elfshname(".note.netbsd.march")
++              resoff -= int64(elfnetbsdarmsig(sh, uint64(startva), uint64(resoff)))
++              pnote = newElfPhdr()
++              pnote.type_ = PT_NOTE
++              pnote.flags = PF_R
++              phsh(pnote, sh)
++      }
+ 
+       if len(buildinfo) > 0 {
+               sh := elfshname(".note.gnu.build-id")
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/patches/patch-src_runtime_os__netbsd.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_runtime_os__netbsd.go   Sat Jan 20 16:55:05 2018 +0000
@@ -0,0 +1,21 @@
+$NetBSD: patch-src_runtime_os__netbsd.go,v 1.3 2018/01/20 16:55:05 christos Exp $
+
+--- src/runtime/os_netbsd.go.orig      2017-02-16 19:12:24.000000000 +0000
++++ src/runtime/os_netbsd.go
+@@ -79,13 +79,13 @@ var sigset_all = sigset{[4]uint32{^uint3
+ 
+ // From NetBSD's <sys/sysctl.h>
+ const (
+-      _CTL_HW      = 6
+-      _HW_NCPU     = 3
++      _CTL_HW  = 6
++      _HW_NCPUONLINE = 16
+       _HW_PAGESIZE = 7
+ )
+ 
+ func getncpu() int32 {
+-      mib := [2]uint32{_CTL_HW, _HW_NCPU}
++      mib := [2]uint32{_CTL_HW, _HW_NCPUONLINE}
+       out := uint32(0)
+       nout := unsafe.Sizeof(out)
+       ret := sysctl(&mib[0], 2, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/patches/patch-src_runtime_rt0__netbsd__arm.s
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_runtime_rt0__netbsd__arm.s      Sat Jan 20 16:55:05 2018 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_runtime_rt0__netbsd__arm.s,v 1.1 2018/01/20 16:55:05 christos Exp $
+
+--- src/runtime/rt0_netbsd_arm.s.orig  2017-02-16 19:12:24.000000000 +0000
++++ src/runtime/rt0_netbsd_arm.s
+@@ -9,3 +9,8 @@ TEXT _rt0_arm_netbsd(SB),NOSPLIT,$-4
+       MOVW    $4(R13), R1             // argv
+       MOVM.DB.W [R0-R1], (R13)
+       B runtime·rt0_go(SB)
++
++TEXT main(SB),NOSPLIT,$-4
++      MOVM.DB.W [R0-R1], (R13)
++      MOVW    $runtime·rt0_go(SB), R4
++      B       (R4)
diff -r 8b8dc61ff6db -r 52cdc073188a lang/go/version.mk
--- a/lang/go/version.mk        Sat Jan 20 12:19:09 2018 +0000
+++ b/lang/go/version.mk        Sat Jan 20 16:55:05 2018 +0000
@@ -1,11 +1,11 @@
-# $NetBSD: version.mk,v 1.30 2017/10/28 18:20:14 bsiegert Exp $
+# $NetBSD: version.mk,v 1.31 2018/01/20 16:55:05 christos Exp $
 
 .include "../../mk/bsd.prefs.mk"
 
 GO_VERSION=    1.9.2
 GO14_VERSION=  1.4.3
 
-ONLY_FOR_PLATFORM=     *-*-i386 *-*-x86_64 *-*-*arm*
+ONLY_FOR_PLATFORM=     *-*-i386 *-*-x86_64 *-*-earmv[67]hf
 NOT_FOR_PLATFORM=      SunOS-*-i386
 .if ${MACHINE_ARCH} == "i386"
 GOARCH=                386
@@ -13,9 +13,14 @@
 .elif ${MACHINE_ARCH} == "x86_64"
 GOARCH=                amd64
 GOCHAR=                6
-.elif !empty(MACHINE_ARCH:M*arm*)
+.elif ${MACHINE_ARCH} == "earmv6hf" || ${MACHINE_ARCH} == "earmv7hf"
 GOARCH=                arm
 GOCHAR=                5
 .endif
+.if ${MACHINE_ARCH} == "earmv6hf"
+GOOPT=         GOARM=6
+.elif ${MACHINE_ARCH} == "earmv7hf"
+GOOPT=         GOARM=7
+.endif
 PLIST_SUBST+=  GO_PLATFORM=${LOWER_OPSYS:Q}_${GOARCH:Q} GOARCH=${GOARCH:Q}
 PLIST_SUBST+=  GOCHAR=${GOCHAR:Q}



Home | Main Index | Thread Index | Old Index