pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/go Implement cgo support for illumos. Patches by...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/637892c84863
branches:  trunk
changeset: 648054:637892c84863
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Tue Mar 10 13:11:36 2015 +0000

description:
Implement cgo support for illumos.  Patches by Keith Wesolowski at Joyent.

Bump PKGREVISION.

diffstat:

 lang/go/Makefile                                            |   13 +-
 lang/go/PLIST                                               |    5 +-
 lang/go/distinfo                                            |   28 ++-
 lang/go/patches/patch-doc_progs_run                         |   17 +
 lang/go/patches/patch-misc_cgo_test_cthread__unix.c         |   15 +
 lang/go/patches/patch-misc_cgo_testso_cgoso.go              |   14 +
 lang/go/patches/patch-misc_cgo_testso_cgoso__unix.go        |   15 +
 lang/go/patches/patch-src_cmd_5l_asm.c                      |   36 +++
 lang/go/patches/patch-src_cmd_6l_asm.c                      |   68 +++++
 lang/go/patches/patch-src_cmd_8l_asm.c                      |   36 +++
 lang/go/patches/patch-src_cmd_go_build.go                   |   17 +
 lang/go/patches/patch-src_cmd_ld_data.c                     |  139 ++++++++++++
 lang/go/patches/patch-src_cmd_ld_doc.go                     |   15 +
 lang/go/patches/patch-src_cmd_ld_lib.h                      |   14 +
 lang/go/patches/patch-src_cmd_ld_pobj.c                     |   27 ++
 lang/go/patches/patch-src_go_build_build.go                 |   14 +
 lang/go/patches/patch-src_net_cgo__bsd.go                   |   15 +
 lang/go/patches/patch-src_net_cgo__stub.go                  |   15 +
 lang/go/patches/patch-src_net_cgo__unix.go                  |   15 +
 lang/go/patches/patch-src_os_user_lookup__unix.go           |   14 +
 lang/go/patches/patch-src_runtime_cgo_cgo.go                |   14 +
 lang/go/patches/patch-src_runtime_cgo_gcc__setenv.c         |   15 +
 lang/go/patches/patch-src_runtime_cgo_gcc__solaris__amd64.c |   77 ++++++
 lang/go/patches/patch-src_runtime_cgo_setenv.c              |   15 +
 lang/go/patches/patch-src_runtime_netpoll__solaris.c        |   26 ++
 lang/go/patches/patch-src_runtime_os__solaris.c             |   95 ++++++++
 lang/go/patches/patch-src_runtime_os__solaris.h             |   27 ++
 lang/go/patches/patch-src_runtime_sys__solaris__amd64.s     |   40 +++
 lang/go/patches/patch-src_runtime_thunk__solaris__amd64.s   |  108 +++++++++
 29 files changed, 936 insertions(+), 13 deletions(-)

diffs (truncated from 1110 to 300 lines):

diff -r 2b9088d0a527 -r 637892c84863 lang/go/Makefile
--- a/lang/go/Makefile  Tue Mar 10 12:00:26 2015 +0000
+++ b/lang/go/Makefile  Tue Mar 10 13:11:36 2015 +0000
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.26 2015/02/22 13:28:30 tnn Exp $
+# $NetBSD: Makefile,v 1.27 2015/03/10 13:11:36 jperkin Exp $
 
 .include "version.mk"
 
 DISTNAME=      go${GO_VERSION}.src
 PKGNAME=       go-${GO_VERSION}
+PKGREVISION=   1
 CATEGORIES=    lang
 MASTER_SITES=  https://storage.googleapis.com/golang/
 PATCH_SITES=   https://codereview.appspot.com/download/
@@ -19,14 +20,6 @@
 # uses ulimit -T
 BUILD_DEPENDS+=        bash>=4.2nb3:../../shells/bash
 
-PLIST_VARS+=   cgo zsyscall
-
-.if ${OPSYS} == "SunOS"
-PLIST.zsyscall=        yes
-.else
-PLIST.cgo=     yes
-.endif
-
 # cgo compiles under TMPDIR
 TMPDIR?=       /tmp
 BUILDLINK_PASSTHRU_DIRS+= ${TMPDIR}
@@ -93,7 +86,7 @@
 do-install:
        cd ${WRKSRC} && rm -rf .hgignore .hgtags pkg/obj
        cd ${WRKDIR} && pax -rw go ${DESTDIR}${PREFIX}
-       find ${DESTDIR}${PREFIX}/go/src -name \*.orig -exec rm {} \;
+       find ${DESTDIR}${PREFIX}/go -name \*.orig -exec rm {} \;
 .for cmd in go gofmt
        cd ${DESTDIR}${PREFIX}/bin && ln -sf ../go/bin/${cmd} ${cmd}
 .endfor
diff -r 2b9088d0a527 -r 637892c84863 lang/go/PLIST
--- a/lang/go/PLIST     Tue Mar 10 12:00:26 2015 +0000
+++ b/lang/go/PLIST     Tue Mar 10 13:11:36 2015 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.17 2015/02/22 13:14:09 mspo Exp $
+@comment $NetBSD: PLIST,v 1.18 2015/03/10 13:11:36 jperkin Exp $
 bin/go
 bin/gofmt
 go/AUTHORS
@@ -515,7 +515,7 @@
 go/pkg/${GO_PLATFORM}/regexp/syntax.a
 go/pkg/${GO_PLATFORM}/runtime.a
 go/pkg/${GO_PLATFORM}/runtime.h
-${PLIST.cgo}go/pkg/${GO_PLATFORM}/runtime/cgo.a
+go/pkg/${GO_PLATFORM}/runtime/cgo.a
 go/pkg/${GO_PLATFORM}/runtime/debug.a
 go/pkg/${GO_PLATFORM}/runtime/pprof.a
 go/pkg/${GO_PLATFORM}/runtime/race.a
@@ -2570,6 +2570,7 @@
 go/src/runtime/cgo/gcc_openbsd_386.c
 go/src/runtime/cgo/gcc_openbsd_amd64.c
 go/src/runtime/cgo/gcc_setenv.c
+go/src/runtime/cgo/gcc_solaris_amd64.c
 go/src/runtime/cgo/gcc_util.c
 go/src/runtime/cgo/gcc_windows_386.c
 go/src/runtime/cgo/gcc_windows_amd64.c
diff -r 2b9088d0a527 -r 637892c84863 lang/go/distinfo
--- a/lang/go/distinfo  Tue Mar 10 12:00:26 2015 +0000
+++ b/lang/go/distinfo  Tue Mar 10 13:11:36 2015 +0000
@@ -1,7 +1,33 @@
-$NetBSD: distinfo,v 1.21 2015/02/22 13:29:01 tnn Exp $
+$NetBSD: distinfo,v 1.22 2015/03/10 13:11:36 jperkin Exp $
 
 SHA1 (go1.4.2.src.tar.gz) = 460caac03379f746c473814a65223397e9c9a2f6
 RMD160 (go1.4.2.src.tar.gz) = dea15b3b4c31554a47b40799f4b9a926ea760e70
 Size (go1.4.2.src.tar.gz) = 10921896 bytes
+SHA1 (patch-doc_progs_run) = 5a29fe4f91defb2e20d192850601df7cbabdac7c
+SHA1 (patch-misc_cgo_test_cthread__unix.c) = a63f08f07713bd32e279315cca21235101ce9cd3
+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_6l_asm.c) = 1f244d7c760e738057b1649ed486206a6ec3812b
+SHA1 (patch-src_cmd_8l_asm.c) = e5233a3d9b08f2ef8d809756ef7d6fc4b03303b9
+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_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_net_cgo__bsd.go) = 4678fccd6956300ce55343965334fc3881383bbc
+SHA1 (patch-src_net_cgo__stub.go) = cf373587745d68e556dadf3a61956b489b4f420a
+SHA1 (patch-src_net_cgo__unix.go) = cebe897ab624aaf52bebc50d12a045d6b4ea2bc6
+SHA1 (patch-src_os_user_lookup__unix.go) = 861cf9b2b64bc314b6ee8e11411245e214717515
+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_netpoll__solaris.c) = ae399518bb02d6b898734a52dfa7fe18f041e1ec
+SHA1 (patch-src_runtime_os__solaris.c) = eec5b293fe4a72f58e4cd51cd23ea6e6fce714b6
+SHA1 (patch-src_runtime_os__solaris.h) = c0a39aa6ab57eca7056178c87ebb00bb21236499
+SHA1 (patch-src_runtime_sys__solaris__amd64.s) = 88f2e3fc43b0d6e4f17ef06d3f4f27cfed3103c6
+SHA1 (patch-src_runtime_thunk__solaris__amd64.s) = 2835cdc171ae3209c61ef804fbfbf22cdf68bf43
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-doc_progs_run
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-doc_progs_run       Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,17 @@
+$NetBSD: patch-doc_progs_run,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+
+--- doc/progs/run.orig 2014-12-11 01:18:10.000000000 +0000
++++ doc/progs/run
+@@ -50,6 +50,10 @@ fi
+ if [ "$goos" == "openbsd" ]; then
+       c_go_cgo="cgo1 cgo2"
+ fi
++# cgo3 and cgo4 don't run on illumos, since cgo cannot handle stdout correctly
++if [ "$goos" == "solaris" ]; then
++      c_go_cgo="cgo1 cgo2"
++fi
+ if [ "$CGO_ENABLED" != 1 ]; then
+       c_go_cgo=""
+ fi
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-misc_cgo_test_cthread__unix.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-misc_cgo_test_cthread__unix.c       Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-misc_cgo_test_cthread__unix.c,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+
+--- misc/cgo/test/cthread_unix.c.orig  2014-12-11 01:18:10.000000000 +0000
++++ misc/cgo/test/cthread_unix.c
+@@ -2,7 +2,7 @@
+ // Use of this source code is governed by a BSD-style
+ // license that can be found in the LICENSE file.
+ 
+-// +build darwin dragonfly freebsd linux netbsd openbsd
++// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+ 
+ #include <pthread.h>
+ #include "_cgo_export.h"
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-misc_cgo_testso_cgoso.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-misc_cgo_testso_cgoso.go    Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-misc_cgo_testso_cgoso.go,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+
+--- misc/cgo/testso/cgoso.go.orig      2014-12-11 01:18:10.000000000 +0000
++++ misc/cgo/testso/cgoso.go
+@@ -14,6 +14,7 @@ package cgosotest
+ #cgo netbsd LDFLAGS: -L. libcgosotest.so
+ #cgo darwin LDFLAGS: -L. libcgosotest.dylib
+ #cgo windows LDFLAGS: -L. libcgosotest.dll
++#cgo solaris LDFLAGS: -L. -lcgosotest
+ 
+ void init(void);
+ void sofunc(void);
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-misc_cgo_testso_cgoso__unix.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-misc_cgo_testso_cgoso__unix.go      Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-misc_cgo_testso_cgoso__unix.go,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+
+--- misc/cgo/testso/cgoso_unix.go.orig 2014-12-11 01:18:10.000000000 +0000
++++ misc/cgo/testso/cgoso_unix.go
+@@ -2,7 +2,7 @@
+ // Use of this source code is governed by a BSD-style
+ // license that can be found in the LICENSE file.
+ 
+-// +build dragonfly freebsd linux netbsd
++// +build dragonfly freebsd linux netbsd solaris
+ 
+ package cgosotest
+ 
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-src_cmd_5l_asm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_cmd_5l_asm.c    Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_cmd_5l_asm.c,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+
+--- src/cmd/5l/asm.c.orig      2014-12-11 01:18:10.000000000 +0000
++++ src/cmd/5l/asm.c
+@@ -502,27 +502,8 @@ adddynsym(Link *ctxt, LSym *s)
+               adduint8(ctxt, d, t);
+               adduint8(ctxt, d, 0);
+ 
+-              /* shndx */
+-              if(s->type == SDYNIMPORT)
+-                      adduint16(ctxt, d, SHN_UNDEF);
+-              else {
+-                      switch(s->type) {
+-                      default:
+-                      case STEXT:
+-                              t = 11;
+-                              break;
+-                      case SRODATA:
+-                              t = 12;
+-                              break;
+-                      case SDATA:
+-                              t = 13;
+-                              break;
+-                      case SBSS:
+-                              t = 14;
+-                              break;
+-                      }
+-                      adduint16(ctxt, d, t);
+-              }
++              /* shndx; see dodynsym(). */
++              adduint16(ctxt, d, SHN_UNDEF);
+       } else {
+               diag("adddynsym: unsupported binary format");
+       }
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-src_cmd_6l_asm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_cmd_6l_asm.c    Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,68 @@
+$NetBSD: patch-src_cmd_6l_asm.c,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+
+--- src/cmd/6l/asm.c.orig      2014-12-11 01:18:10.000000000 +0000
++++ src/cmd/6l/asm.c
+@@ -209,12 +209,23 @@ adddynrel(LSym *s, Reloc *r)
+       
+       case R_ADDR:
+               if(s->type == STEXT && iself) {
+-                      // The code is asking for the address of an external
+-                      // function.  We provide it with the address of the
+-                      // correspondent GOT symbol.
+-                      addgotsym(targ);
+-                      r->sym = linklookup(ctxt, ".got", 0);
+-                      r->add += targ->got;
++                      /*
++                       * On SunOS, all external references are dynamic.
++                       * Emit a PLT relocation at this site.
++                       */
++                      if (HEADTYPE == Hsolaris) {
++                              addpltsym(targ);
++                              r->sym = linklookup(ctxt, ".plt", 0);
++                              r->add = targ->plt;
++                      } else {
++                              // The code is asking for the address of an
++                              // external function.  We provide it with the
++                              // address of the correspondent GOT symbol.
++                              addgotsym(targ);
++                              r->sym = linklookup(ctxt, ".got", 0);
++                              r->add += targ->got;
++                      }
++
+                       return;
+               }
+               if(s->type != SDATA)
+@@ -539,28 +550,9 @@ adddynsym(Link *ctxt, LSym *s)
+       
+               /* reserved */
+               adduint8(ctxt, d, 0);
+-      
+-              /* section where symbol is defined */
+-              if(s->type == SDYNIMPORT)
+-                      adduint16(ctxt, d, SHN_UNDEF);
+-              else {
+-                      switch(s->type) {
+-                      default:
+-                      case STEXT:
+-                              t = 11;
+-                              break;
+-                      case SRODATA:
+-                              t = 12;
+-                              break;
+-                      case SDATA:
+-                              t = 13;
+-                              break;
+-                      case SBSS:
+-                              t = 14;
+-                              break;
+-                      }
+-                      adduint16(ctxt, d, t);
+-              }
++
++              /* section where symbol is defined; see dodynsym(). */
++              adduint16(ctxt, d, SHN_UNDEF);
+       
+               /* value */
+               if(s->type == SDYNIMPORT)
diff -r 2b9088d0a527 -r 637892c84863 lang/go/patches/patch-src_cmd_8l_asm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/go/patches/patch-src_cmd_8l_asm.c    Tue Mar 10 13:11:36 2015 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_cmd_8l_asm.c,v 1.1 2015/03/10 13:11:36 jperkin Exp $
+
+Support cgo on illumos.
+



Home | Main Index | Thread Index | Old Index