Create lang/go14 as a copy of lang/go but which installs under

$PREFIX/go14.

Go 1.5 is going to be released soon, and it will depend on an existing
installation of Go 1.4 to compile. So let's provide one.
This commit is contained in:
bsiegert 2015-07-31 14:46:25 +00:00
parent 03b97f0697
commit 4f034c2357
33 changed files with 5633 additions and 1 deletions

View file

@ -1,8 +1,9 @@
# $NetBSD: version.mk,v 1.5 2015/02/22 13:14:09 mspo Exp $
# $NetBSD: version.mk,v 1.6 2015/07/31 14:46:25 bsiegert Exp $
.include "../../mk/bsd.prefs.mk"
GO_VERSION= 1.4.2
GO14_VERSION= 1.4.2
ONLY_FOR_PLATFORM= *-*-i386 *-*-x86_64 *-*-evbarm
NOT_FOR_PLATFORM= SunOS-*-i386

12
lang/go14/DESCR Normal file
View file

@ -0,0 +1,12 @@
The Go programming language is an open source project to make
programmers more productive.
Go is expressive, concise, clean, and efficient. Its concurrency
mechanisms make it easy to write programs that get the most out of
multicore and networked machines, while its novel type system enables
flexible and modular program construction. Go compiles quickly to
machine code yet has the convenience of garbage collection and the power
of run-time reflection. It's a fast, statically typed, compiled language
that feels like a dynamically typed, interpreted language.
This package contains the (legacy) 1.4 release of Go.

86
lang/go14/Makefile Normal file
View file

@ -0,0 +1,86 @@
# $NetBSD: Makefile,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
.include "../../lang/go/version.mk"
DISTNAME= go${GO14_VERSION}.src
PKGNAME= go14-${GO14_VERSION}
PKGREVISION= 2
CATEGORIES= lang
MASTER_SITES= https://storage.googleapis.com/golang/
PATCH_SITES= https://codereview.appspot.com/download/
MAINTAINER= bsiegert@NetBSD.org
HOMEPAGE= http://golang.org/
COMMENT= The Go programming language
LICENSE= modified-bsd
WRKSRC= ${WRKDIR}/go
USE_TOOLS+= bash:run perl:run pax
# uses ulimit -T
BUILD_DEPENDS+= bash>=4.2nb3:../../shells/bash
# cgo compiles under TMPDIR
TMPDIR?= /tmp
BUILDLINK_PASSTHRU_DIRS+= ${TMPDIR}
# bash script may use unportable bash constructs
CHECK_PORTABILITY_SKIP= lib/time/update.bash
GOROOT_FINAL= ${PREFIX}/go14
INSTALLATION_DIRS= bin
REPLACE_BASH+= doc/articles/wiki/test.bash
REPLACE_BASH+= doc/codewalk/run
REPLACE_BASH+= doc/progs/run
REPLACE_BASH+= doc/progs/update.bash
REPLACE_BASH+= lib/time/update.bash
REPLACE_BASH+= misc/arm/a
REPLACE_BASH+= misc/benchcmp
REPLACE_BASH+= misc/cgo/errors/test.bash
REPLACE_BASH+= misc/cgo/testcdefs/test.bash
REPLACE_BASH+= misc/cgo/testgodefs/test.bash
REPLACE_BASH+= misc/cgo/testso/test.bash
REPLACE_BASH+= misc/makerelease/darwin/scripts/postinstall
REPLACE_BASH+= misc/makerelease/darwin/scripts/preinstall
REPLACE_BASH+= misc/nacl/go_nacl_386_exec
REPLACE_BASH+= misc/nacl/go_nacl_amd64p32_exec
REPLACE_BASH+= misc/nacl/go_nacl_arm_exec
REPLACE_BASH+= src/all.bash
REPLACE_BASH+= src/androidtest.bash
REPLACE_BASH+= src/clean.bash
REPLACE_BASH+= src/cmd/go/mkdoc.sh
REPLACE_BASH+= src/cmd/go/test.bash
REPLACE_BASH+= src/make.bash
REPLACE_BASH+= src/nacltest.bash
REPLACE_BASH+= src/race.bash
REPLACE_BASH+= src/run.bash
REPLACE_BASH+= src/runtime/mknacl.sh
REPLACE_BASH+= src/sudo.bash
REPLACE_BASH+= src/syscall/mkall.sh
REPLACE_BASH+= src/syscall/mkerrors.sh
REPLACE_BASH+= src/syscall/mksysnum_plan9.sh
REPLACE_BASH+= test/bench/shootout/timing.sh
REPLACE_BASH+= test/run
REPLACE_PERL+= src/net/http/cgi/testdata/test.cgi
REPLACE_PERL+= src/regexp/syntax/make_perl_groups.pl
REPLACE_PERL+= src/syscall/*.pl
REPLACE_PERL+= test/errchk
# uses /bin/rc (for Plan 9)
CHECK_INTERPRETER_SKIP+= go/include/plan9/mklibc.rc
CHECK_INTERPRETER_SKIP+= go/src/all.rc
CHECK_INTERPRETER_SKIP+= go/src/clean.rc
CHECK_INTERPRETER_SKIP+= go/src/make.rc
CHECK_INTERPRETER_SKIP+= go/src/run.rc
do-build:
cd ${WRKSRC}/src && env GOROOT_FINAL=${GOROOT_FINAL:Q} ${BASH} ./make.bash
do-install:
cd ${WRKSRC} && rm -rf .hgignore .hgtags pkg/obj
cd ${WRKDIR}/go && pax -rw * ${DESTDIR}${GOROOT_FINAL}
find ${DESTDIR}${GOROOT_FINAL} -name \*.orig -exec rm {} \;
.include "../../mk/bsd.pkg.mk"

4565
lang/go14/PLIST Normal file

File diff suppressed because it is too large Load diff

33
lang/go14/distinfo Normal file
View file

@ -0,0 +1,33 @@
$NetBSD: distinfo,v 1.1 2015/07/31 14:46:25 bsiegert 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

View file

@ -0,0 +1,17 @@
$NetBSD: patch-doc_progs_run,v 1.1 2015/07/31 14:46:25 bsiegert 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

View file

@ -0,0 +1,15 @@
$NetBSD: patch-misc_cgo_test_cthread__unix.c,v 1.1 2015/07/31 14:46:25 bsiegert 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"

View file

@ -0,0 +1,14 @@
$NetBSD: patch-misc_cgo_testso_cgoso.go,v 1.1 2015/07/31 14:46:25 bsiegert 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);

View file

@ -0,0 +1,15 @@
$NetBSD: patch-misc_cgo_testso_cgoso__unix.go,v 1.1 2015/07/31 14:46:25 bsiegert 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

View file

@ -0,0 +1,36 @@
$NetBSD: patch-src_cmd_5l_asm.c,v 1.1 2015/07/31 14:46:25 bsiegert 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");
}

View file

@ -0,0 +1,68 @@
$NetBSD: patch-src_cmd_6l_asm.c,v 1.1 2015/07/31 14:46:25 bsiegert 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)

View file

@ -0,0 +1,36 @@
$NetBSD: patch-src_cmd_8l_asm.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/cmd/8l/asm.c.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/cmd/8l/asm.c
@@ -508,27 +508,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 if(HEADTYPE == Hdarwin) {
diag("adddynsym: missed symbol %s (%s)", s->name, s->extname);
} else if(HEADTYPE == Hwindows) {

View file

@ -0,0 +1,17 @@
$NetBSD: patch-src_cmd_go_build.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/cmd/go/build.go.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/cmd/go/build.go
@@ -2330,6 +2330,10 @@ func (b *builder) cgo(p *Package, cgoExe
if pie { // we need to use -pie for Linux/ARM to get accurate imported sym
cgoLDFLAGS = append(cgoLDFLAGS, "-pie")
}
+ lgcc_s := goos == "solaris"
+ if lgcc_s {
+ cgoLDFLAGS = append(cgoLDFLAGS, "-lgcc_s");
+ }
if err := b.gccld(p, dynobj, cgoLDFLAGS, linkobj); err != nil {
return nil, nil, err
}

View file

@ -0,0 +1,17 @@
$NetBSD: patch-src_cmd_go_pkg.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Do not try to install go-tools into GOROOT. This is done in the
go-tools package instead.
--- src/cmd/go/pkg.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/cmd/go/pkg.go
@@ -401,9 +401,6 @@ var goTools = map[string]targetDir{
"cmd/pack": toTool,
"cmd/pprof": toTool,
"cmd/yacc": toTool,
- "golang.org/x/tools/cmd/cover": toTool,
- "golang.org/x/tools/cmd/godoc": toBin,
- "golang.org/x/tools/cmd/vet": toTool,
"code.google.com/p/go.tools/cmd/cover": stalePath,
"code.google.com/p/go.tools/cmd/godoc": stalePath,
"code.google.com/p/go.tools/cmd/vet": stalePath,

View file

@ -0,0 +1,139 @@
$NetBSD: patch-src_cmd_ld_data.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/cmd/ld/data.c.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/cmd/ld/data.c
@@ -965,6 +965,46 @@ dodata(void)
datap = listsort(datap, datcmp, offsetof(LSym, next));
/*
+ * The SunOS rtld expects the .rel/.rela and .rel.plt/.rela.plt
+ * sections to be contiguous. More properly, it expects that the
+ * region starting from the lower of DT_RELA and DT_PLTREL and
+ * continuing for DT_RELASZ bytes contains at least the set of non-PLT
+ * relocation entries. To ensure this, we put .rel[a].plt after .rel[a].
+ * This is actually required by the ELF gABI on all ELF platforms.
+ */
+ if (ctxt->headtype == Hsolaris) {
+ for (l = &datap; (s = *l) != nil; ) {
+ if (strcmp(s->name, ".rel.plt") == 0 ||
+ strcmp(s->name, ".rela.plt") == 0) {
+ *l = s->next;
+ s->next = nil;
+ last = s;
+ break;
+ }
+ l = &s->next;
+ }
+
+ if (s != nil) {
+ for (s = datap; s != nil; s = s->next) {
+ if (strcmp(s->name, ".rel") == 0 ||
+ strcmp(s->name, ".rela") == 0) {
+ last->next = s->next;
+ s->next = last;
+ break;
+ }
+ }
+ /*
+ * .rel[a].plt without .rel[a]. Should never occur
+ * but just in case, put it back where we found it.
+ */
+ if (s == nil) {
+ last->next = (*l)->next;
+ (*l)->next = last;
+ }
+ }
+ }
+
+ /*
* allocate sections. list is sorted by type,
* so we can just walk it for each piece we want to emit.
* segdata is processed before segtext, because we need
@@ -1239,6 +1279,85 @@ dodata(void)
sect->extnum = n++;
}
+/*
+ * Fix up the section numbers in .dynsym if present. We could not write these
+ * shndx entries until we know all present sections and have sorted them.
+ *
+ * Each dynsym entry is actually an ElfXX_Sym, and we're going to replace the
+ * st_shndx field. For 32-bit targets, that's at offset 0xe; for 64-bit, it's
+ * at offset 0x6. Anything we don't expect, we ignore and leave unchanged.
+ */
+void
+dodynsym(void)
+{
+ LSym *ds;
+ LSym *ss;
+ LSym *s;
+ vlong off;
+ size_t entsz;
+ uint16 ent;
+ char *sectname = nil;
+
+ if (!iself)
+ return;
+
+ ds = linklookup(ctxt, ".dynsym", 0);
+
+ if (ds == nil)
+ return;
+
+ if (thechar == '6')
+ entsz = ELF64SYMSIZE;
+ else
+ entsz = ELF32SYMSIZE;
+
+ for(s = ctxt->allsym; s != nil; s = s->allsym) {
+ if (s->dynid <= 0 || s->type == SDYNIMPORT)
+ continue;
+
+ if (s->sect != nil) {
+ ent = s->sect->extnum;
+ } else {
+ switch (s->type) {
+ case STEXT:
+ default:
+ sectname = ".text";
+ break;
+ case SRODATA:
+ sectname = ".rodata";
+ break;
+ case SDATA:
+ sectname = ".data";
+ break;
+ case SBSS:
+ sectname = ".bss";
+ break;
+ }
+
+ ss = linklookup(ctxt, sectname, 0);
+ if (ss == nil || ss->sect == nil) {
+ diag("dodynsym: symbol %s in nonexistent %s",
+ s->extname != nil ? s->extname : "<none>",
+ sectname);
+ continue;
+ }
+
+ ent = ss->sect->extnum;
+ }
+
+ if (ent == 0) {
+ diag("dodynsym: symbol %s in section 0; ignored");
+ continue;
+ }
+
+ off = s->dynid * entsz +
+ ((thechar == '6') ? offsetof(Elf64_Sym, shndx) :
+ offsetof(Elf32_Sym, shndx));
+
+ (void) setuint16(ctxt, ds, off, ent);
+ }
+}
+
// assign addresses to text
void
textaddress(void)

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_cmd_ld_doc.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/cmd/ld/doc.go.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/cmd/ld/doc.go
@@ -30,7 +30,7 @@ Options new in this version:
Elide the dynamic linking header. With this option, the binary
is statically linked and does not refer to a dynamic linker. Without this option
(the default), the binary's contents are identical but it is loaded with a dynamic
- linker. This flag cannot be used when $GOOS is windows.
+ linker. This flag cannot be used when $GOOS is windows or solaris
-H darwin (only in 6l/8l)
Write Apple Mach-O binaries (default when $GOOS is darwin)
-H dragonfly (only in 6l/8l)

View file

@ -0,0 +1,14 @@
$NetBSD: patch-src_cmd_ld_lib.h,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/cmd/ld/lib.h.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/cmd/ld/lib.h
@@ -216,6 +216,7 @@ char* decodetype_structfieldname(LSym *s
vlong decodetype_structfieldoffs(LSym *s, int i);
LSym* decodetype_structfieldtype(LSym *s, int i);
void dodata(void);
+void dodynsym(void);
void dostkcheck(void);
void dostkoff(void);
void dosymtype(void);

View file

@ -0,0 +1,27 @@
$NetBSD: patch-src_cmd_ld_pobj.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/cmd/ld/pobj.c.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/cmd/ld/pobj.c
@@ -151,6 +151,12 @@ main(int argc, char *argv[])
if(headstring == nil)
headstring = headstr(HEADTYPE);
+ if (HEADTYPE == Hsolaris && debug['d'] != 0) {
+ fprint(2, "%cl: -d is not supported with this target\n",
+ thechar);
+ exits("usage");
+ }
+
archinit();
ctxt->debugfloat = debug['F'];
@@ -188,6 +194,7 @@ main(int argc, char *argv[])
pclntab();
symtab();
dodata();
+ dodynsym();
address();
doweak();
reloc();

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_crypto_x509_root__unix.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Also look for the right path for the SSL certificate repository on NetBSD.
https://github.com/golang/go/issues/9285
--- src/crypto/x509/root_unix.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/crypto/x509/root_unix.go
@@ -13,6 +13,7 @@ var certFiles = []string{
"/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc.
"/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL
"/etc/ssl/ca-bundle.pem", // OpenSUSE
+ "/etc/openssl/certs/ca-certificates.crt", // NetBSD
"/etc/ssl/cert.pem", // OpenBSD
"/usr/local/share/certs/ca-root-nss.crt", // FreeBSD/DragonFly
"/etc/pki/tls/cacert.pem", // OpenELEC

View file

@ -0,0 +1,14 @@
$NetBSD: patch-src_go_build_build.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/go/build/build.go.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/go/build/build.go
@@ -277,6 +277,7 @@ var cgoEnabled = map[string]bool{
"openbsd/amd64": true,
"windows/386": true,
"windows/amd64": true,
+ "solaris/amd64": true,
}
func defaultContext() Context {

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_net_cgo__bsd.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/net/cgo_bsd.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/net/cgo_bsd.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build !netgo
-// +build darwin dragonfly freebsd solaris
+// +build darwin dragonfly freebsd
package net

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_net_cgo__stub.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/net/cgo_stub.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/net/cgo_stub.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 !cgo netgo
+// +build !cgo netgo solaris
// Stub cgo routines for systems that do not use cgo to do network lookups.

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_net_cgo__unix.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/net/cgo_unix.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/net/cgo_unix.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build !netgo
-// +build darwin dragonfly freebsd linux netbsd openbsd
+// +build darwin dragonfly freebsd linux netbsd openbsd !solaris
package net

View file

@ -0,0 +1,14 @@
$NetBSD: patch-src_os_user_lookup__unix.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/os/user/lookup_unix.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/os/user/lookup_unix.go
@@ -17,6 +17,7 @@ import (
)
/*
+#cgo solaris CFLAGS: -D_POSIX_PTHREAD_SEMANTICS
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>

View file

@ -0,0 +1,14 @@
$NetBSD: patch-src_runtime_cgo_cgo.go,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/cgo/cgo.go.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/runtime/cgo/cgo.go
@@ -21,6 +21,7 @@ package cgo
#cgo windows LDFLAGS: -lm -mthreads
#cgo CFLAGS: -Wall -Werror
+#cgo solaris CFLAGS: -D_POSIX_PTHREAD_SEMANTICS
*/
import "C"

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_runtime_cgo_gcc__setenv.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/cgo/gcc_setenv.c.orig 2014-12-11 01:18:10.000000000 +0000
+++ src/runtime/cgo/gcc_setenv.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 "libcgo.h"

View file

@ -0,0 +1,77 @@
$NetBSD: patch-src_runtime_cgo_gcc__solaris__amd64.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- /dev/null
+++ src/runtime/cgo/gcc_solaris_amd64.c
@@ -0,0 +1,70 @@
+// 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.
+
+#include <pthread.h>
+#include <string.h>
+#include <signal.h>
+#include "libcgo.h"
+
+static void* threadentry(void*);
+static void (*setg_gcc)(void*);
+
+void
+x_cgo_init(G *g, void (*setg)(void*))
+{
+ pthread_attr_t attr;
+ size_t size;
+
+ setg_gcc = setg;
+ pthread_attr_init(&attr);
+ if (pthread_attr_getstack(&attr, (void **)&g->stacklo, &size) != 0)
+ perror("runtime/cgo: pthread_attr_getstack failed");
+ g->stackhi = (uintptr_t)g->stacklo + 8192;
+ pthread_attr_destroy(&attr);
+}
+
+void
+_cgo_sys_thread_start(ThreadStart *ts)
+{
+ pthread_attr_t attr;
+ sigset_t ign, oset;
+ pthread_t p;
+ size_t size;
+ int err;
+
+ sigfillset(&ign);
+ pthread_sigmask(SIG_SETMASK, &ign, &oset);
+
+ pthread_attr_init(&attr);
+
+ if (pthread_attr_getstack(&attr, (void **)&ts->g->stacklo, &size) != 0)
+ perror("runtime/cgo: pthread_attr_getstack failed");
+ ts->g->stackhi = (uintptr_t)ts->g->stacklo + 8192;
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ err = pthread_create(&p, &attr, threadentry, ts);
+
+ pthread_sigmask(SIG_SETMASK, &oset, nil);
+
+ if (err != 0) {
+ fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
+ abort();
+ }
+}
+
+static void*
+threadentry(void *v)
+{
+ ThreadStart ts;
+
+ ts = *(ThreadStart*)v;
+ free(v);
+
+ /*
+ * Set specific keys.
+ */
+ setg_gcc((void*)ts.g);
+
+ crosscall_amd64(ts.fn);
+ return nil;
+}

View file

@ -0,0 +1,15 @@
$NetBSD: patch-src_runtime_cgo_setenv.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/cgo/setenv.c.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/runtime/cgo/setenv.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
#pragma cgo_import_static x_cgo_setenv
#pragma cgo_import_static x_cgo_unsetenv

View file

@ -0,0 +1,26 @@
$NetBSD: patch-src_runtime_netpoll__solaris.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/netpoll_solaris.c.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/runtime/netpoll_solaris.c
@@ -73,11 +73,14 @@
#pragma dynimport libc·port_associate port_associate "libc.so"
#pragma dynimport libc·port_dissociate port_dissociate "libc.so"
#pragma dynimport libc·port_getn port_getn "libc.so"
-extern uintptr libc·fcntl;
-extern uintptr libc·port_create;
-extern uintptr libc·port_associate;
-extern uintptr libc·port_dissociate;
-extern uintptr libc·port_getn;
+
+typedef uintptr (extf)();
+
+extern extf libc·fcntl;
+extern extf libc·port_create;
+extern extf libc·port_associate;
+extern extf libc·port_dissociate;
+extern extf libc·port_getn;
#define errno (*g->m->perrno)

View file

@ -0,0 +1,95 @@
$NetBSD: patch-src_runtime_os__solaris.c,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/os_solaris.c.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/runtime/os_solaris.c
@@ -46,38 +46,40 @@
#pragma dynimport libc·usleep usleep "libc.so"
#pragma dynimport libc·write write "libc.so"
-extern uintptr libc·___errno;
-extern uintptr libc·clock_gettime;
-extern uintptr libc·close;
-extern uintptr libc·exit;
-extern uintptr libc·fstat;
-extern uintptr libc·getcontext;
-extern uintptr libc·getrlimit;
-extern uintptr libc·malloc;
-extern uintptr libc·mmap;
-extern uintptr libc·munmap;
-extern uintptr libc·open;
-extern uintptr libc·pthread_attr_destroy;
-extern uintptr libc·pthread_attr_getstack;
-extern uintptr libc·pthread_attr_init;
-extern uintptr libc·pthread_attr_setdetachstate;
-extern uintptr libc·pthread_attr_setstack;
-extern uintptr libc·pthread_create;
-extern uintptr libc·raise;
-extern uintptr libc·read;
-extern uintptr libc·sched_yield;
-extern uintptr libc·select;
-extern uintptr libc·sem_init;
-extern uintptr libc·sem_post;
-extern uintptr libc·sem_reltimedwait_np;
-extern uintptr libc·sem_wait;
-extern uintptr libc·setitimer;
-extern uintptr libc·sigaction;
-extern uintptr libc·sigaltstack;
-extern uintptr libc·sigprocmask;
-extern uintptr libc·sysconf;
-extern uintptr libc·usleep;
-extern uintptr libc·write;
+typedef uintptr (extf)();
+
+extern extf libc·___errno;
+extern extf libc·clock_gettime;
+extern extf libc·close;
+extern extf libc·exit;
+extern extf libc·fstat;
+extern extf libc·getcontext;
+extern extf libc·getrlimit;
+extern extf libc·malloc;
+extern extf libc·mmap;
+extern extf libc·munmap;
+extern extf libc·open;
+extern extf libc·pthread_attr_destroy;
+extern extf libc·pthread_attr_getstack;
+extern extf libc·pthread_attr_init;
+extern extf libc·pthread_attr_setdetachstate;
+extern extf libc·pthread_attr_setstack;
+extern extf libc·pthread_create;
+extern extf libc·raise;
+extern extf libc·read;
+extern extf libc·sched_yield;
+extern extf libc·select;
+extern extf libc·sem_init;
+extern extf libc·sem_post;
+extern extf libc·sem_reltimedwait_np;
+extern extf libc·sem_wait;
+extern extf libc·setitimer;
+extern extf libc·sigaction;
+extern extf libc·sigaltstack;
+extern extf libc·sigprocmask;
+extern extf libc·sysconf;
+extern extf libc·usleep;
+extern extf libc·write;
void runtime·getcontext(Ucontext *context);
int32 runtime·pthread_attr_destroy(PthreadAttr* attr);
@@ -396,12 +398,13 @@ runtime·munmap(byte* addr, uintptr len)
runtime·sysvicall2(libc·munmap, (uintptr)addr, (uintptr)len);
}
-extern int64 runtime·nanotime1(void);
+extern uintptr runtime·nanotime1(void);
+
#pragma textflag NOSPLIT
int64
runtime·nanotime(void)
{
- return runtime·sysvicall0((uintptr)runtime·nanotime1);
+ return runtime·sysvicall0(runtime·nanotime1);
}
#pragma textflag NOSPLIT

View file

@ -0,0 +1,27 @@
$NetBSD: patch-src_runtime_os__solaris.h,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/os_solaris.h.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/runtime/os_solaris.h
@@ -43,13 +43,13 @@ int32 runtime·getrlimit(int32, Rlimit
// Call an external library function described by {fn, a0, ..., an}, with
// SysV conventions, switching to os stack during the call, if necessary.
-uintptr runtime·sysvicall0(uintptr fn);
-uintptr runtime·sysvicall1(uintptr fn, uintptr a1);
-uintptr runtime·sysvicall2(uintptr fn, uintptr a1, uintptr a2);
-uintptr runtime·sysvicall3(uintptr fn, uintptr a1, uintptr a2, uintptr a3);
-uintptr runtime·sysvicall4(uintptr fn, uintptr a1, uintptr a2, uintptr a3, uintptr a4);
-uintptr runtime·sysvicall5(uintptr fn, uintptr a1, uintptr a2, uintptr a3, uintptr a4, uintptr a5);
-uintptr runtime·sysvicall6(uintptr fn, uintptr a1, uintptr a2, uintptr a3, uintptr a4, uintptr a5, uintptr a6);
+uintptr runtime·sysvicall0(uintptr (*fn)());
+uintptr runtime·sysvicall1(uintptr (*fn)(), uintptr a1);
+uintptr runtime·sysvicall2(uintptr (*fn)(), uintptr a1, uintptr a2);
+uintptr runtime·sysvicall3(uintptr (*fn)(), uintptr a1, uintptr a2, uintptr a3);
+uintptr runtime·sysvicall4(uintptr (*fn)(), uintptr a1, uintptr a2, uintptr a3, uintptr a4);
+uintptr runtime·sysvicall5(uintptr (*fn)(), uintptr a1, uintptr a2, uintptr a3, uintptr a4, uintptr a5);
+uintptr runtime·sysvicall6(uintptr (*fn)(), uintptr a1, uintptr a2, uintptr a3, uintptr a4, uintptr a5, uintptr a6);
void runtime·asmsysvicall6(void *c);
void runtime·miniterrno(void *fn);

View file

@ -0,0 +1,40 @@
$NetBSD: patch-src_runtime_sys__solaris__amd64.s,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/sys_solaris_amd64.s.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/runtime/sys_solaris_amd64.s
@@ -40,7 +40,7 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$0
SUBQ $64, SP // 16 bytes will do, but who knows in the future?
MOVQ $3, DI // CLOCK_REALTIME from <sys/time_impl.h>
MOVQ SP, SI
- MOVQ libc·clock_gettime(SB), AX
+ LEAQ libc·clock_gettime(SB), AX
CALL AX
MOVQ (SP), AX // tv_sec from struct timespec
IMULQ $1000000000, AX // multiply into nanoseconds
@@ -53,7 +53,7 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$0
TEXT runtime·pipe1(SB),NOSPLIT,$0
SUBQ $16, SP // 8 bytes will do, but stack has to be 16-byte alligned
MOVQ SP, DI
- MOVQ libc·pipe(SB), AX
+ LEAQ libc·pipe(SB), AX
CALL AX
MOVL 0(SP), AX
MOVL 4(SP), DX
@@ -320,13 +320,13 @@ usleep1_noswitch:
// Runs on OS stack. duration (in µs units) is in DI.
TEXT runtime·usleep2(SB),NOSPLIT,$0
- MOVQ libc·usleep(SB), AX
+ LEAQ libc·usleep(SB), AX
CALL AX
RET
// Runs on OS stack, called from runtime·osyield.
TEXT runtime·osyield1(SB),NOSPLIT,$0
- MOVQ libc·sched_yield(SB), AX
+ LEAQ libc·sched_yield(SB), AX
CALL AX
RET

View file

@ -0,0 +1,108 @@
$NetBSD: patch-src_runtime_thunk__solaris__amd64.s,v 1.1 2015/07/31 14:46:25 bsiegert Exp $
Support cgo on illumos.
--- src/runtime/thunk_solaris_amd64.s.orig 2014-12-11 01:18:12.000000000 +0000
+++ src/runtime/thunk_solaris_amd64.s
@@ -8,81 +8,81 @@
#include "textflag.h"
TEXT runtime·libc_chdir(SB),NOSPLIT,$0
- MOVQ libc·chdir(SB), AX
+ LEAQ libc·chdir(SB), AX
JMP AX
TEXT runtime·libc_chroot(SB),NOSPLIT,$0
- MOVQ libc·chroot(SB), AX
+ LEAQ libc·chroot(SB), AX
JMP AX
TEXT runtime·libc_close(SB),NOSPLIT,$0
- MOVQ libc·close(SB), AX
+ LEAQ libc·close(SB), AX
JMP AX
TEXT runtime·libc_dlopen(SB),NOSPLIT,$0
- MOVQ libc·dlopen(SB), AX
+ LEAQ libc·dlopen(SB), AX
JMP AX
TEXT runtime·libc_dlclose(SB),NOSPLIT,$0
- MOVQ libc·dlclose(SB), AX
+ LEAQ libc·dlclose(SB), AX
JMP AX
TEXT runtime·libc_dlsym(SB),NOSPLIT,$0
- MOVQ libc·dlsym(SB), AX
+ LEAQ libc·dlsym(SB), AX
JMP AX
TEXT runtime·libc_execve(SB),NOSPLIT,$0
- MOVQ libc·execve(SB), AX
+ LEAQ libc·execve(SB), AX
JMP AX
TEXT runtime·libc_exit(SB),NOSPLIT,$0
- MOVQ libc·exit(SB), AX
+ LEAQ libc·exit(SB), AX
JMP AX
TEXT runtime·libc_fcntl(SB),NOSPLIT,$0
- MOVQ libc·fcntl(SB), AX
+ LEAQ libc·fcntl(SB), AX
JMP AX
TEXT runtime·libc_forkx(SB),NOSPLIT,$0
- MOVQ libc·forkx(SB), AX
+ LEAQ libc·forkx(SB), AX
JMP AX
TEXT runtime·libc_gethostname(SB),NOSPLIT,$0
- MOVQ libc·gethostname(SB), AX
+ LEAQ libc·gethostname(SB), AX
JMP AX
TEXT runtime·libc_ioctl(SB),NOSPLIT,$0
- MOVQ libc·ioctl(SB), AX
+ LEAQ libc·ioctl(SB), AX
JMP AX
TEXT runtime·libc_setgid(SB),NOSPLIT,$0
- MOVQ libc·setgid(SB), AX
+ LEAQ libc·setgid(SB), AX
JMP AX
TEXT runtime·libc_setgroups(SB),NOSPLIT,$0
- MOVQ libc·setgroups(SB), AX
+ LEAQ libc·setgroups(SB), AX
JMP AX
TEXT runtime·libc_setsid(SB),NOSPLIT,$0
- MOVQ libc·setsid(SB), AX
+ LEAQ libc·setsid(SB), AX
JMP AX
TEXT runtime·libc_setuid(SB),NOSPLIT,$0
- MOVQ libc·setuid(SB), AX
+ LEAQ libc·setuid(SB), AX
JMP AX
TEXT runtime·libc_setpgid(SB),NOSPLIT,$0
- MOVQ libc·setpgid(SB), AX
+ LEAQ libc·setpgid(SB), AX
JMP AX
TEXT runtime·libc_syscall(SB),NOSPLIT,$0
- MOVQ libc·syscall(SB), AX
+ LEAQ libc·syscall(SB), AX
JMP AX
TEXT runtime·libc_wait4(SB),NOSPLIT,$0
- MOVQ libc·wait4(SB), AX
+ LEAQ libc·wait4(SB), AX
JMP AX
TEXT runtime·libc_write(SB),NOSPLIT,$0
- MOVQ libc·write(SB), AX
+ LEAQ libc·write(SB), AX
JMP AX