I've committed a patch to update libgo to the Go 1.13beta1 release. As is usual with these updates, the patch is too large to include here; I've included the diffs of the various GCC-specific configury and other files. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian gotools: 2019-09-06 Ian Lance Taylor <i...@golang.org> * Makefile.am (check-carchive-test): Just run "go test", not "go test carchive_test.go". * Makefile.in: Regenerate. gcc/testsuite: 2019-09-06 Ian Lance Taylor <i...@golang.org> * go.test/test/fixedbugs/bug369.go: Update to match libgo update to Go 1.13beta1.
Index: libgo/MERGE =================================================================== --- libgo/MERGE (revision 275396) +++ libgo/MERGE (working copy) @@ -1,4 +1,4 @@ -ac02fdec7cd16ea8d3de1fc33def9cfabec5170d +60f14fddfee107dedd76c0be6b422a3d8ccc841a The first line of this file holds the git revision number of the last merge done from the master library sources. Index: libgo/Makefile.am =================================================================== --- libgo/Makefile.am (revision 275396) +++ libgo/Makefile.am (working copy) @@ -187,6 +187,7 @@ toolexeclibgocrypto_DATA = \ crypto/des.gox \ crypto/dsa.gox \ crypto/ecdsa.gox \ + crypto/ed25519.gox \ crypto/elliptic.gox \ crypto/hmac.gox \ crypto/md5.gox \ @@ -399,8 +400,7 @@ toolexeclibgounicode_DATA = \ # internal packages nothing will explicitly depend on them. # Force them to be built. noinst_DATA = \ - internal/x/net/internal/nettest.gox \ - internal/x/net/nettest.gox \ + golang.org/x/net/nettest.gox \ internal/testenv.gox \ internal/trace.gox \ net/internal/socktest.gox \ @@ -482,7 +482,6 @@ s-version: Makefile echo " BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp echo " CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp echo " DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp - echo " HugePageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) hugepagesize`" >> version.go.tmp echo " Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp echo " MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp echo " PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp @@ -516,14 +515,16 @@ s-objabi: Makefile rm -f objabi.go.tmp echo "package objabi" > objabi.go.tmp echo "import \"runtime\"" >> objabi.go.tmp - echo 'func init() { defaultGOROOT = `$(prefix)` }' >> objabi.go.tmp + echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> objabi.go.tmp echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp echo 'const defaultGOARM = `5`' >> objabi.go.tmp echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp echo 'const defaultGOMIPS64 = `hardfloat`' >> objabi.go.tmp + echo 'const defaultGOPPC64 = `power8`' >> objabi.go.tmp echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp + echo 'const defaultGO_LDSO = ``' >> objabi.go.tmp echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp echo 'const goexperiment = ``' >> objabi.go.tmp @@ -591,7 +592,7 @@ s-zstdpkglist: Makefile echo 'package goroot' > zstdpkglist.go.tmp echo "" >> zstdpkglist.go.tmp echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp + echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp echo '}' >> zstdpkglist.go.tmp $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go $(STAMP) $@ @@ -692,13 +693,14 @@ libgo_go_objs = \ syscall/errno.lo \ syscall/signame.lo \ syscall/wait.lo \ - $(internal_x_net_lif_lo) \ - $(internal_x_net_route_lo) \ + $(golangorg_x_net_lif_lo) \ + $(golangorg_x_net_route_lo) \ log/syslog/syslog_c.lo \ $(os_lib_inotify_lo) \ runtime/internal/atomic_c.lo \ sync/atomic_c.lo \ - internal/cpu/cpu_gccgo.lo + internal/cpu/cpu_gccgo.lo \ + golang.org/x/sys/cpu_gccgo.lo libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) @@ -1020,6 +1022,11 @@ internal/cpu/cpu_gccgo.lo: go/internal/c @$(MKDIR_P) internal/cpu $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c +# Similarly, golang.org/x/sys/cpu needs some C code. +golang.org/x/sys/cpu_gccgo.lo: go/golang.org/x/sys/cpu/cpu_gccgo.c runtime.inc + @$(MKDIR_P) golang.org/x/sys + $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo.c + # Solaris 11.4 changed the type of fields in struct stat. # Use a build tag, based on a configure check, to cope. if LIBGO_IS_SOLARIS @@ -1038,10 +1045,10 @@ if LIBGO_IS_BSD $(eval $(call PACKAGE_template,internal/x/net/route)) -internal_x_net_route_lo = \ - internal/x/net/route.lo -internal_x_net_route_check = \ - internal/x/net/route/check +golangorg_x_net_route_lo = \ + golang.org/net/route.lo +golangorg_x_net_route_check = \ + golang.org/x/net/route/check endif @@ -1051,17 +1058,17 @@ if LIBGO_IS_SOLARIS $(eval $(call PACKAGE_template,internal/x/net/lif)) -internal_x_net_lif_lo = \ - internal/x/net/lif.lo -internal_x_net_lif_check = \ - internal/x/net/lif/check +golangorg_x_net_lif_lo = \ + golang.org/x/net/lif.lo +golangorg_x_net_lif_check = \ + golang.org/x/net/lif/check endif TPACKAGES = $(shell cat $(srcdir)/check-packages.txt) TEST_PACKAGES = $(addsuffix /check,$(TPACKAGES)) \ - $(internal_x_net_lif_check) \ - $(internal_x_net_route_check) + $(golangorg_x_net_lif_check) \ + $(golangorg_x_net_route_check) check: check-tail check-recursive: check-head Index: libgo/VERSION =================================================================== --- libgo/VERSION (revision 275396) +++ libgo/VERSION (working copy) @@ -1 +1 @@ -go1.12.2 +go1.13beta1 Index: libgo/check-packages.txt =================================================================== --- libgo/check-packages.txt (revision 275396) +++ libgo/check-packages.txt (working copy) @@ -21,7 +21,6 @@ cmd/go/internal/par cmd/go/internal/search cmd/go/internal/semver cmd/go/internal/txtar -cmd/go/internal/web2 cmd/go/internal/work cmd/internal/buildid cmd/internal/edit @@ -42,6 +41,7 @@ crypto/cipher crypto/des crypto/dsa crypto/ecdsa +crypto/ed25519 crypto/elliptic crypto/hmac crypto/internal/subtle @@ -106,20 +106,11 @@ image/png index/suffixarray internal/cpu internal/fmtsort +internal/oserror internal/poll +internal/reflectlite internal/singleflight internal/trace -internal/x/crypto/chacha20poly1305 -internal/x/crypto/cryptobyte -internal/x/crypto/curve25519 -internal/x/crypto/hkdf -internal/x/crypto/internal/chacha20 -internal/x/crypto/poly1305 -internal/x/net/dns/dnsmessage -internal/x/net/http/httpguts -internal/x/net/http/httpproxy -internal/x/net/http2/hpack -internal/x/net/idna internal/xcoff io io/ioutil Index: libgo/configure.ac =================================================================== --- libgo/configure.ac (revision 275396) +++ libgo/configure.ac (working copy) @@ -10,7 +10,7 @@ AC_INIT(package-unused, version-unused,, AC_CONFIG_SRCDIR(Makefile.am) AC_CONFIG_HEADER(config.h) -libtool_VERSION=14:0:0 +libtool_VERSION=15:0:0 AC_SUBST(libtool_VERSION) AM_ENABLE_MULTILIB(, ..) @@ -154,7 +154,7 @@ AC_SUBST(go_include) # All known GOOS values. This is the union of all operating systems # supported by the gofrontend and all operating systems supported by # the gc toolchain. -ALLGOOS="aix android darwin dragonfly freebsd hurd irix js linux netbsd openbsd plan9 rtems solaris windows" +ALLGOOS="aix android darwin dragonfly freebsd hurd illumos irix js linux netbsd openbsd plan9 rtems solaris windows" is_darwin=no is_freebsd=no Index: libgo/go/reflect/makefunc_ffi.go =================================================================== --- libgo/go/reflect/makefunc_ffi.go (revision 275396) +++ libgo/go/reflect/makefunc_ffi.go (working copy) @@ -44,11 +44,6 @@ func FFICallbackGo(results unsafe.Pointe off := uintptr(0) for i, typ := range ftyp.out { v := out[i] - if v.typ != typ { - panic("reflect: function created by MakeFunc using " + funcName(impl.fn) + - " returned wrong type: have " + - out[i].typ.String() + " for " + typ.String()) - } if v.flag&flagRO != 0 { panic("reflect: function created by MakeFunc using " + funcName(impl.fn) + " returned value obtained from unexported field") @@ -56,6 +51,12 @@ func FFICallbackGo(results unsafe.Pointe off = align(off, uintptr(typ.fieldAlign)) addr := unsafe.Pointer(uintptr(results) + off) + + // Convert v to type typ if v is assignable to a variable + // of type t in the language spec. + // See issue 28761. + v = v.assignTo("reflect.MakeFunc", typ, addr) + if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) { *(*unsafe.Pointer)(addr) = v.ptr } else { Index: libgo/go/runtime/mem_gccgo.go =================================================================== --- libgo/go/runtime/mem_gccgo.go (revision 275396) +++ libgo/go/runtime/mem_gccgo.go (working copy) @@ -7,7 +7,6 @@ package runtime import ( - "runtime/internal/sys" "unsafe" ) @@ -92,37 +91,35 @@ func sysUnused(v unsafe.Pointer, n uintp // gets most of the benefit of huge pages while keeping the // number of VMAs under control. With hugePageSize = 2MB, even // a pessimal heap can reach 128GB before running out of VMAs. - if sys.HugePageSize != 0 && _MADV_NOHUGEPAGE != 0 { - var s uintptr = sys.HugePageSize // division by constant 0 is a compile-time error :( - + if physHugePageSize != 0 && _MADV_NOHUGEPAGE != 0 { // If it's a large allocation, we want to leave huge // pages enabled. Hence, we only adjust the huge page // flag on the huge pages containing v and v+n-1, and // only if those aren't aligned. var head, tail uintptr - if uintptr(v)%s != 0 { + if uintptr(v)%physHugePageSize != 0 { // Compute huge page containing v. - head = uintptr(v) &^ (s - 1) + head = uintptr(v) &^ (physHugePageSize - 1) } - if (uintptr(v)+n)%s != 0 { + if (uintptr(v)+n)%physHugePageSize != 0 { // Compute huge page containing v+n-1. - tail = (uintptr(v) + n - 1) &^ (s - 1) + tail = (uintptr(v) + n - 1) &^ (physHugePageSize - 1) } // Note that madvise will return EINVAL if the flag is // already set, which is quite likely. We ignore // errors. - if head != 0 && head+sys.HugePageSize == tail { + if head != 0 && head+physHugePageSize == tail { // head and tail are different but adjacent, // so do this in one call. - madvise(unsafe.Pointer(head), 2*sys.HugePageSize, _MADV_NOHUGEPAGE) + madvise(unsafe.Pointer(head), 2*physHugePageSize, _MADV_NOHUGEPAGE) } else { // Advise the huge pages containing v and v+n-1. if head != 0 { - madvise(unsafe.Pointer(head), sys.HugePageSize, _MADV_NOHUGEPAGE) + madvise(unsafe.Pointer(head), physHugePageSize, _MADV_NOHUGEPAGE) } if tail != 0 && tail != head { - madvise(unsafe.Pointer(tail), sys.HugePageSize, _MADV_NOHUGEPAGE) + madvise(unsafe.Pointer(tail), physHugePageSize, _MADV_NOHUGEPAGE) } } } @@ -142,21 +139,23 @@ func sysUnused(v unsafe.Pointer, n uintp } func sysUsed(v unsafe.Pointer, n uintptr) { - if sys.HugePageSize != 0 && _MADV_HUGEPAGE != 0 { - // Partially undo the NOHUGEPAGE marks from sysUnused - // for whole huge pages between v and v+n. This may - // leave huge pages off at the end points v and v+n - // even though allocations may cover these entire huge - // pages. We could detect this and undo NOHUGEPAGE on - // the end points as well, but it's probably not worth - // the cost because when neighboring allocations are - // freed sysUnused will just set NOHUGEPAGE again. - var s uintptr = sys.HugePageSize + // Partially undo the NOHUGEPAGE marks from sysUnused + // for whole huge pages between v and v+n. This may + // leave huge pages off at the end points v and v+n + // even though allocations may cover these entire huge + // pages. We could detect this and undo NOHUGEPAGE on + // the end points as well, but it's probably not worth + // the cost because when neighboring allocations are + // freed sysUnused will just set NOHUGEPAGE again. + sysHugePage(v, n) +} +func sysHugePage(v unsafe.Pointer, n uintptr) { + if physHugePageSize != 0 && _MADV_HUGEPAGE != 0 { // Round v up to a huge page boundary. - beg := (uintptr(v) + (s - 1)) &^ (s - 1) + beg := (uintptr(v) + (physHugePageSize - 1)) &^ (physHugePageSize - 1) // Round v+n down to a huge page boundary. - end := (uintptr(v) + n) &^ (s - 1) + end := (uintptr(v) + n) &^ (physHugePageSize - 1) if beg < end { madvise(unsafe.Pointer(beg), end-beg, _MADV_HUGEPAGE) Index: libgo/goarch.sh =================================================================== --- libgo/goarch.sh (revision 275396) +++ libgo/goarch.sh (working copy) @@ -14,9 +14,6 @@ # - defaultphyspagesize: the default physical page size in bytes # (not currently used, but maybe some day) # - family: the processor family, from ALLGOARCHFAMILY in configure.ac -# - hugepagesize: size of a huge page in bytes -# (used only to decide when to use madvise with MADV_[NO]HUGEPAGE) -# (set to 0 if there are no huge pages) # - int64align: alignment of int64 type in bytes # - maxalign: maximum alignment of values of Go types in bytes # - minframesize: size of smallest possible function frame in bytes @@ -37,7 +34,6 @@ bigendian=false cachelinesize=64 defaultphyspagesize=4096 family=unknown -hugepagesize=0 int64align=8 maxalign=8 minframesize=0 @@ -47,7 +43,6 @@ ptrsize=8 case $goarch in 386) family=I386 - hugepagesize="1 << 21" int64align=4 maxalign=4 ptrsize=4 @@ -59,11 +54,9 @@ case $goarch in ;; amd64) family=AMD64 - hugepagesize="1 << 21" ;; amd64p32) family=AMD64 - hugepagesize="1 << 21" ptrsize=4 ;; arm | armbe) @@ -236,9 +229,6 @@ case $keyword in family) echo $family ;; - hugepagesize) - echo $hugepagesize - ;; int64align) echo $int64align ;; Index: libgo/gotool-packages.txt =================================================================== --- libgo/gotool-packages.txt (revision 275396) +++ libgo/gotool-packages.txt (working copy) @@ -1,3 +1,4 @@ +cmd/go/internal/auth cmd/go/internal/base cmd/go/internal/bug cmd/go/internal/cache @@ -27,20 +28,22 @@ cmd/go/internal/modinfo cmd/go/internal/modload cmd/go/internal/module cmd/go/internal/mvs +cmd/go/internal/note cmd/go/internal/par cmd/go/internal/renameio +cmd/go/internal/robustio cmd/go/internal/run cmd/go/internal/search cmd/go/internal/semver cmd/go/internal/str +cmd/go/internal/sumweb cmd/go/internal/test +cmd/go/internal/tlog cmd/go/internal/tool cmd/go/internal/txtar cmd/go/internal/version cmd/go/internal/vet cmd/go/internal/web -cmd/go/internal/web2 -cmd/go/internal/webtest cmd/go/internal/work cmd/internal/browser cmd/internal/buildid @@ -60,6 +63,7 @@ golang.org/x/tools/go/analysis/passes/cg golang.org/x/tools/go/analysis/passes/composite golang.org/x/tools/go/analysis/passes/copylock golang.org/x/tools/go/analysis/passes/ctrlflow +golang.org/x/tools/go/analysis/passes/errorsas golang.org/x/tools/go/analysis/passes/httpresponse golang.org/x/tools/go/analysis/passes/inspect golang.org/x/tools/go/analysis/passes/internal/analysisutil Index: libgo/libgo-packages.txt =================================================================== --- libgo/libgo-packages.txt (revision 275396) +++ libgo/libgo-packages.txt (working copy) @@ -17,6 +17,8 @@ crypto/cipher crypto/des crypto/dsa crypto/ecdsa +crypto/ed25519 +crypto/ed25519/internal/edwards25519 crypto/elliptic crypto/hmac crypto/internal/randutil @@ -70,6 +72,25 @@ go/printer go/scanner go/token go/types +golang.org/x/crypto/chacha20poly1305 +golang.org/x/crypto/cryptobyte +golang.org/x/crypto/cryptobyte/asn1 +golang.org/x/crypto/curve25519 +golang.org/x/crypto/hkdf +golang.org/x/crypto/internal/chacha20 +golang.org/x/crypto/internal/subtle +golang.org/x/crypto/poly1305 +golang.org/x/net/dns/dnsmessage +golang.org/x/net/http/httpguts +golang.org/x/net/http/httpproxy +golang.org/x/net/http2/hpack +golang.org/x/net/idna +golang.org/x/net/nettest +golang.org/x/sys/cpu +golang.org/x/text/secure/bidirule +golang.org/x/text/transform +golang.org/x/text/unicode/bidi +golang.org/x/text/unicode/norm hash hash/adler32 hash/crc32 @@ -90,32 +111,19 @@ internal/bytealg internal/cpu internal/fmtsort internal/goroot +internal/goversion +internal/lazyregexp +internal/lazytemplate internal/nettrace +internal/oserror internal/poll internal/race +internal/reflectlite internal/singleflight internal/syscall/unix internal/testenv internal/testlog internal/trace -internal/x/crypto/chacha20poly1305 -internal/x/crypto/cryptobyte -internal/x/crypto/cryptobyte/asn1 -internal/x/crypto/curve25519 -internal/x/crypto/hkdf -internal/x/crypto/internal/chacha20 -internal/x/crypto/poly1305 -internal/x/net/dns/dnsmessage -internal/x/net/http/httpguts -internal/x/net/http/httpproxy -internal/x/net/http2/hpack -internal/x/net/idna -internal/x/net/internal/nettest -internal/x/net/nettest -internal/x/text/secure/bidirule -internal/x/text/transform -internal/x/text/unicode/bidi -internal/x/text/unicode/norm internal/xcoff io io/ioutil Index: libgo/match.sh =================================================================== --- libgo/match.sh (revision 275396) +++ libgo/match.sh (working copy) @@ -135,7 +135,7 @@ for f in $gofiles; do if test x$tag1 != xnonmatchingtag -a x$tag2 != xnonmatchingtag; then # Pipe through cat so that `set -e` doesn't affect fgrep. - tags=`sed '/^package /q' < $f | grep '^// +build ' | cat` + tags=`sed '/^package /q' < $f | grep '^// \?+build ' | cat` omatch=true first=true match=false @@ -143,7 +143,7 @@ for f in $gofiles; do case $tag in "//") ;; - "+build") + "+build" | "//+build") if test "$first" = "true"; then first=false elif test "$match" = "false"; then Index: libgo/mkrsysinfo.sh =================================================================== --- libgo/mkrsysinfo.sh (revision 275396) +++ libgo/mkrsysinfo.sh (working copy) @@ -86,13 +86,11 @@ echo $timespec | \ -e 's/tv_sec *[a-zA-Z0-9_]*/tv_sec timespec_sec_t/' \ -e 's/tv_nsec *[a-zA-Z0-9_]*/tv_nsec timespec_nsec_t/' >> ${OUT} echo >> ${OUT} -echo "func (ts *timespec) set_sec(x int64) {" >> ${OUT} -echo " ts.tv_sec = timespec_sec_t(x)" >> ${OUT} +echo "func (ts *timespec) setNsec(ns int64) {" >> ${OUT} +echo " ts.tv_sec = timespec_sec_t(ns / 1e9)" >> ${OUT} +echo " ts.tv_nsec = timespec_nsec_t(ns % 1e9)" >> ${OUT} echo "}" >> ${OUT} echo >> ${OUT} -echo "func (ts *timespec) set_nsec(x int32) {" >> ${OUT} -echo " ts.tv_nsec = timespec_nsec_t(x)" >> ${OUT} -echo "}" >> ${OUT} # Define the epollevent struct. This needs special attention because # the C definition uses a union and is sometimes packed. Index: libgo/runtime/go-fieldtrack.c =================================================================== --- libgo/runtime/go-fieldtrack.c (revision 275396) +++ libgo/runtime/go-fieldtrack.c (working copy) @@ -25,21 +25,6 @@ __go_fieldtrack (byte *p __attribute__ ( /* A runtime function to add all the tracked fields to a map[string]bool. */ -extern const char _etext[] __attribute__ ((weak)); -extern const char _edata[] __attribute__ ((weak)); -#ifdef _AIX -// Following symbols do not exist on AIX -const char *__etext = NULL; -const char *__data_start = NULL; -const char *__edata = NULL; -const char *__bss_start = NULL; -#else -extern const char __etext[] __attribute__ ((weak)); -extern const char __data_start[] __attribute__ ((weak)); -extern const char __edata[] __attribute__ ((weak)); -extern const char __bss_start[] __attribute__ ((weak)); -#endif - extern void *mapassign (const struct maptype *, void *hmap, const void *key) __asm__ (GOSYM_PREFIX "runtime.mapassign"); Index: libgo/runtime/panic.c =================================================================== --- libgo/runtime/panic.c (revision 275396) +++ libgo/runtime/panic.c (working copy) @@ -16,23 +16,34 @@ runtime_throw(const char *s) void runtime_panicstring(const char *s) { - M* mp; + G *gp; Eface err; - mp = runtime_m(); - if (mp != nil) { - if(mp->mallocing) { - runtime_printf("panic: %s\n", s); - runtime_throw("panic during malloc"); - } - if(mp->gcing) { - runtime_printf("panic: %s\n", s); - runtime_throw("panic during gc"); - } - if(mp->locks) { - runtime_printf("panic: %s\n", s); - runtime_throw("panic holding locks"); - } + gp = runtime_g(); + if (gp == nil) { + runtime_printf("panic: %s\n", s); + runtime_throw("panic with no g"); + } + if (gp->m == nil) { + runtime_printf("panic: %s\n", s); + runtime_throw("panic with no m"); + } + if (gp->m->curg != gp) { + runtime_printf("panic: %s\n", s); + runtime_throw("panic on system stack"); + } + if (gp->m->mallocing != 0) { + runtime_printf("panic: %s\n", s); + runtime_throw("panic during malloc"); + } + if (gp->m->preemptoff.len != 0) { + runtime_printf("panic: %s\n", s); + runtime_printf("preempt off reason: %S\n", gp->m->preemptoff); + runtime_throw("panic during preemptoff"); + } + if (gp->m->locks != 0) { + runtime_printf("panic: %s\n", s); + runtime_throw("panic holding locks"); } runtime_newErrorCString((uintptr) s, &err); runtime_panic(err); Index: libgo/runtime/runtime.h =================================================================== --- libgo/runtime/runtime.h (revision 275396) +++ libgo/runtime/runtime.h (working copy) @@ -502,3 +502,19 @@ void __go_makecontext(__go_context_t*, v #define __go_makecontext(c, fn, sp, size) \ ((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0)) #endif + +// Symbols defined by the linker. +extern const char _etext[] __attribute__ ((weak)); +extern const char _edata[] __attribute__ ((weak)); +#ifdef _AIX +// Following symbols do not exist on AIX +#define __etext nil +#define __data_start nil +#define __edata nil +#define __bss_start nil +#else +extern const char __etext[] __attribute__ ((weak)); +extern const char __data_start[] __attribute__ ((weak)); +extern const char __edata[] __attribute__ ((weak)); +extern const char __bss_start[] __attribute__ ((weak)); +#endif Index: libgo/runtime/runtime_c.c =================================================================== --- libgo/runtime/runtime_c.c (revision 275396) +++ libgo/runtime/runtime_c.c (working copy) @@ -186,6 +186,38 @@ getEnd() return end; } +// Return an address that is before the read-only data section. +// Unfortunately there is no standard symbol for this so we use a text +// address. + +uintptr getText(void) + __asm__ (GOSYM_PREFIX "runtime.getText"); + +uintptr +getText(void) +{ + return (uintptr)(const void *)(getText); +} + +// Return the end of the text segment, assumed to come after the +// read-only data section. + +uintptr getEtext(void) + __asm__ (GOSYM_PREFIX "runtime.getEtext"); + +uintptr +getEtext(void) +{ + const void *p; + + p = __data_start; + if (p == nil) + p = __etext; + if (p == nil) + p = _etext; + return (uintptr)(p); +} + // CPU-specific initialization. // Fetch CPUID info on x86. Index: libgo/testsuite/gotest =================================================================== --- libgo/testsuite/gotest (revision 275396) +++ libgo/testsuite/gotest (working copy) @@ -326,7 +326,7 @@ x) esac if test x$tag1 != xnonmatchingtag -a x$tag2 != xnonmatchingtag; then - tags=`sed '/^package /q' < $f | grep '^// +build '` + tags=`sed '/^package /q' < $f | grep '^// \?+build '` omatch=true first=true match=false @@ -334,7 +334,7 @@ x) case $tag in "//") ;; - "+build") + "+build" | "//+build") if test "$first" = "true"; then first=false elif test "$match" = "false"; then Index: gotools/Makefile.am =================================================================== --- gotools/Makefile.am (revision 275396) +++ gotools/Makefile.am (working copy) @@ -248,7 +248,7 @@ check-runtime: go$(EXEEXT) $(noinst_PROG $(SHELL) $(libgosrcdir)/../testsuite/gotest --goarch=$${GOARCH} --goos=$${GOOS} --basedir=$(libgosrcdir)/.. --srcdir=$(libgosrcdir)/runtime --pkgpath=runtime --pkgfiles="$${files}" $(GOTESTFLAGS) -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v >> runtime-testlog 2>&1 || echo "--- $${fl}: go test runtime (0.00s)" >> runtime-testlog grep '^--- ' runtime-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 -# check-cgo-test runs `go test misc/cgo/test` in our environment. +# check-cgo-test runs `go test` in misc/cgo/test. check-cgo-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf cgo-test-dir cgo-testlog $(MKDIR_P) cgo-test-dir/misc/cgo @@ -261,18 +261,18 @@ check-cgo-test: go$(EXEEXT) $(noinst_PRO (cd cgo-test-dir/misc/cgo/test && $(abs_builddir)/go$(EXEEXT) test -test.short -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> cgo-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/test (0.00s)" >> cgo-testlog grep '^--- ' cgo-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 -# check-carchive-test runs `go test misc/cgo/testcarchive/carchive_test.go` +# check-carchive-test runs `go test` in misc/cgo/testcarchive. # in our environment. check-carchive-test: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc rm -rf carchive-test-dir carchive-testlog $(MKDIR_P) carchive-test-dir/misc/cgo cp -r $(libgomiscdir)/cgo/testcarchive carchive-test-dir/misc/cgo/ @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \ - echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go" > carchive-testlog + echo "cd carchive-test-dir/misc/cgo/testcarchive && $(ECHO_ENV) LIBRARY_PATH=`echo $${abs_libgodir}/.libs` $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > carchive-testlog $(CHECK_ENV) \ LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ export LIBRARY_PATH; \ - (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v carchive_test.go) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog + (cd carchive-test-dir/misc/cgo/testcarchive && $(abs_builddir)/go$(EXEEXT) test -test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v) >> carchive-testlog 2>&1 || echo "--- $${fl}: go test misc/cgo/testcarchive (0.00s)" >> carchive-testlog grep '^--- ' carchive-testlog | sed -e 's/^--- \(.*\) ([^)]*)$$/\1/' | sort -k 2 # check-vet runs `go test cmd/vet` in our environment. Index: gcc/testsuite/go.test/test/fixedbugs/bug369.go =================================================================== --- gcc/testsuite/go.test/test/fixedbugs/bug369.go (revision 275396) +++ gcc/testsuite/go.test/test/fixedbugs/bug369.go (working copy) @@ -38,6 +38,7 @@ func BenchmarkSlowNonASCII(b *testing.B) } func main() { + testing.Init() os.Args = []string{os.Args[0], "-test.benchtime=100ms"} flag.Parse()