libgo: Update to Go 1.13beta1 release

Message ID CAOyqgcUedUm1bF5exo-tpV53=_v1WFyz3GFR4ONP9GMuEn0+3g@mail.gmail.com
State New
Headers show
Series
  • libgo: Update to Go 1.13beta1 release
Related show

Commit Message

Ian Lance Taylor Sept. 6, 2019, 6:28 p.m.
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  <iant@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  <iant@golang.org>

* go.test/test/fixedbugs/bug369.go: Update to match libgo update
to Go 1.13beta1.

Comments

Andreas Schwab Sept. 7, 2019, 12:03 p.m. | #1
This has dropped support for riscv64:

diff --git a/libgo/misc/cgo/testcshared/src/libgo2/dup2.go b/libgo/misc/cgo/testcshared/src/libgo2/dup2.go
deleted file mode 100644
index d343aa54d9a..00000000000
--- a/libgo/misc/cgo/testcshared/src/libgo2/dup2.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 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 darwin dragonfly freebsd linux,!arm64,!riscv64 netbsd openbsd
-
-package main
-
-import "syscall"
-
-func dup2(oldfd, newfd int) error {
-       return syscall.Dup2(oldfd, newfd)
-}
diff --git a/libgo/misc/cgo/testcshared/src/libgo2/dup3.go b/libgo/misc/cgo/testcshared/src/libgo2/dup3.go
deleted file mode 100644
index 459f0dc1968..00000000000
--- a/libgo/misc/cgo/testcshared/src/libgo2/dup3.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 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 linux,arm64 linux,riscv64
-
-package main
-
-import "syscall"
-
-func dup2(oldfd, newfd int) error {
-       return syscall.Dup3(oldfd, newfd, 0)
-}
diff --git a/libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go b/libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go
new file mode 100644
index 00000000000..d18f0b130d3
--- /dev/null
+++ b/libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go
@@ -0,0 +1,13 @@
+// Copyright 2015 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 darwin dragonfly freebsd linux,!arm64 netbsd openbsd
+
+package main
+
+import "syscall"
+
+func dup2(oldfd, newfd int) error {
+       return syscall.Dup2(oldfd, newfd)
+}
diff --git a/libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go b/libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go
new file mode 100644
index 00000000000..c9c65a6e3c1
--- /dev/null
+++ b/libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go
@@ -0,0 +1,13 @@
+// Copyright 2015 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 linux,arm64
+
+package main
+
+import "syscall"
+
+func dup2(oldfd, newfd int) error {
+       return syscall.Dup3(oldfd, newfd, 0)
+}

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Rainer Orth Sept. 9, 2019, 8:26 a.m. | #2
Hi Ian,

> 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.


this patch caused quite some fallout on Solaris, both SPARC and x86:

* The golang.org/x/net/lif package won't build:

make[4]: *** No rule to make target 'golang.org/x/net/lif.gox', needed by 'net.lo'.  Stop.

  It moved from go/internal/x/net/lif/lif.go to
  go/golang.org/x/net/lif/lif.go, but neither was Makefile.am adapted to
  reflect this nor the Solaris fixes in the old version carried over to
  the new location.

* go/runtime/os_solaris.go doesn't compile:

/vol/gcc/src/hg/trunk/local/libgo/go/runtime/os_solaris.go:34:7: error: reference to undefined field or method ‘mos’
   34 |  if mp.mos.waitsema != 0 {
      |       ^

  and several more instances.  Caused by losing the explict mos member
  of m in go/runtime/runtime2.go, fixed by dropping it here, to.

* As Bernd mentioned, go/golang.org/x/sys/cpu/cpu_gccgo.{c, go} don't
  compile on non-x86 systems due to lack of <cpuid.h>.  Fixed by
  restricting to 386 or amd64 and wrapping the C code in __i386__ ||
  __x86_64__.

* The go/golang.org/x/sys/cpu package doesn't compile on SPARC:

/vol/gcc/src/hg/trunk/local/libgo/go/golang.org/x/sys/cpu/cpu.go:17:30: error: reference to undefined name 'cacheLineSize'
   17 | type CacheLinePad struct{ _ [cacheLineSize]byte }
      |                              ^
make[8]: *** [Makefile:2826: golang.org/x/sys/cpu.lo] Error 1

  For the moment, I've worked around this by introducing cpu_sparcx.go
  with appropriate build tags.  However, I'm uncertain what do do about
  the actual value of cacheLineSize: the L1 D$ size is 16 on
  UltraSPARC-T2, but 32 on SPARC-S7.

With the attached patch, I can now bootstrap mainline on both
i386-pc-solaris2.11 and sparc-sun-solaris2.11.  Test results are similar
to pre-1.13, but I'll have to check further.  One thing that's new on
both sparc and x86 is an ICE compiling internal/poll:

go1: internal compiler error: in bind_field_or_method, at go/gofrontend/types.cc:11878
0x56d3df Type::bind_field_or_method(Gogo*, Type const*, Expression*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Location)
        /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/types.cc:11878
0x4d2dcf Selector_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int)
        /vol/gcc/src/hg/trunk/local/gcc/go/gofrontend/expressions.cc:14403
[...]

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
# HG changeset patch
# Parent  cc2b98a3fc293d157b70a090c69a78d264801762
Fix libgo 1.13beta1 compilation on Solaris

diff --git a/libgo/Makefile.am b/libgo/Makefile.am
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1055,9 +1055,9 @@ endif
 
 if LIBGO_IS_SOLARIS
 
-# Build internal/x/net/lif only on Solaris systems.
+# Build golang.org/x/net/lif only on Solaris systems.
 
-$(eval $(call PACKAGE_template,internal/x/net/lif))
+$(eval $(call PACKAGE_template,golang.org/x/net/lif))
 
 golangorg_x_net_lif_lo = \
 	golang.org/x/net/lif.lo
diff --git a/libgo/go/golang.org/x/net/lif/address_test.go b/libgo/go/golang.org/x/net/lif/address_test.go
new file mode 100644
--- /dev/null
+++ b/libgo/go/golang.org/x/net/lif/address_test.go
@@ -0,0 +1,123 @@
+// Copyright 2016 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 solaris
+
+package lif
+
+import (
+	"fmt"
+	"testing"
+)
+
+type addrFamily int
+
+func (af addrFamily) String() string {
+	switch af {
+	case sysAF_UNSPEC:
+		return "unspec"
+	case sysAF_INET:
+		return "inet4"
+	case sysAF_INET6:
+		return "inet6"
+	default:
+		return fmt.Sprintf("%d", af)
+	}
+}
+
+const hexDigit = "0123456789abcdef"
+
+type llAddr []byte
+
+func (a llAddr) String() string {
+	if len(a) == 0 {
+		return ""
+	}
+	buf := make([]byte, 0, len(a)*3-1)
+	for i, b := range a {
+		if i > 0 {
+			buf = append(buf, ':')
+		}
+		buf = append(buf, hexDigit[b>>4])
+		buf = append(buf, hexDigit[b&0xF])
+	}
+	return string(buf)
+}
+
+type ipAddr []byte
+
+func (a ipAddr) String() string {
+	if len(a) == 0 {
+		return "<nil>"
+	}
+	if len(a) == 4 {
+		return fmt.Sprintf("%d.%d.%d.%d", a[0], a[1], a[2], a[3])
+	}
+	if len(a) == 16 {
+		return fmt.Sprintf("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15])
+	}
+	s := make([]byte, len(a)*2)
+	for i, tn := range a {
+		s[i*2], s[i*2+1] = hexDigit[tn>>4], hexDigit[tn&0xf]
+	}
+	return string(s)
+}
+
+func (a *Inet4Addr) String() string {
+	return fmt.Sprintf("(%s %s %d)", addrFamily(a.Family()), ipAddr(a.IP[:]), a.PrefixLen)
+}
+
+func (a *Inet6Addr) String() string {
+	return fmt.Sprintf("(%s %s %d %d)", addrFamily(a.Family()), ipAddr(a.IP[:]), a.PrefixLen, a.ZoneID)
+}
+
+type addrPack struct {
+	af int
+	as []Addr
+}
+
+func addrPacks() ([]addrPack, error) {
+	var lastErr error
+	var aps []addrPack
+	for _, af := range [...]int{sysAF_UNSPEC, sysAF_INET, sysAF_INET6} {
+		as, err := Addrs(af, "")
+		if err != nil {
+			lastErr = err
+			continue
+		}
+		aps = append(aps, addrPack{af: af, as: as})
+	}
+	return aps, lastErr
+}
+
+func TestAddrs(t *testing.T) {
+	aps, err := addrPacks()
+	if len(aps) == 0 && err != nil {
+		t.Fatal(err)
+	}
+	lps, err := linkPacks()
+	if len(lps) == 0 && err != nil {
+		t.Fatal(err)
+	}
+	for _, lp := range lps {
+		n := 0
+		for _, ll := range lp.lls {
+			as, err := Addrs(lp.af, ll.Name)
+			if err != nil {
+				t.Fatal(lp.af, ll.Name, err)
+			}
+			t.Logf("af=%s name=%s %v", addrFamily(lp.af), ll.Name, as)
+			n += len(as)
+		}
+		for _, ap := range aps {
+			if ap.af != lp.af {
+				continue
+			}
+			if n != len(ap.as) {
+				t.Errorf("af=%s got %d; want %d", addrFamily(lp.af), n, len(ap.as))
+				continue
+			}
+		}
+	}
+}
diff --git a/libgo/go/golang.org/x/net/lif/link_test.go b/libgo/go/golang.org/x/net/lif/link_test.go
new file mode 100644
--- /dev/null
+++ b/libgo/go/golang.org/x/net/lif/link_test.go
@@ -0,0 +1,63 @@
+// Copyright 2016 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 solaris
+
+package lif
+
+import (
+	"fmt"
+	"testing"
+)
+
+func (ll *Link) String() string {
+	return fmt.Sprintf("name=%s index=%d type=%d flags=%#x mtu=%d addr=%v", ll.Name, ll.Index, ll.Type, ll.Flags, ll.MTU, llAddr(ll.Addr))
+}
+
+type linkPack struct {
+	af  int
+	lls []Link
+}
+
+func linkPacks() ([]linkPack, error) {
+	var lastErr error
+	var lps []linkPack
+	for _, af := range [...]int{sysAF_UNSPEC, sysAF_INET, sysAF_INET6} {
+		lls, err := Links(af, "")
+		if err != nil {
+			lastErr = err
+			continue
+		}
+		lps = append(lps, linkPack{af: af, lls: lls})
+	}
+	return lps, lastErr
+}
+
+func TestLinks(t *testing.T) {
+	lps, err := linkPacks()
+	if len(lps) == 0 && err != nil {
+		t.Fatal(err)
+	}
+	for _, lp := range lps {
+		n := 0
+		for _, sll := range lp.lls {
+			lls, err := Links(lp.af, sll.Name)
+			if err != nil {
+				t.Fatal(lp.af, sll.Name, err)
+			}
+			for _, ll := range lls {
+				if ll.Name != sll.Name || ll.Index != sll.Index {
+					t.Errorf("af=%s got %v; want %v", addrFamily(lp.af), &ll, &sll)
+					continue
+				}
+				t.Logf("af=%s name=%s %v", addrFamily(lp.af), sll.Name, &ll)
+				n++
+			}
+		}
+		if n != len(lp.lls) {
+			t.Errorf("af=%s got %d; want %d", addrFamily(lp.af), n, len(lp.lls))
+			continue
+		}
+	}
+}
diff --git a/libgo/go/golang.org/x/net/lif/syscall.go b/libgo/go/golang.org/x/net/lif/syscall.go
--- a/libgo/go/golang.org/x/net/lif/syscall.go
+++ b/libgo/go/golang.org/x/net/lif/syscall.go
@@ -11,18 +11,12 @@ import (
 	"unsafe"
 )
 
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
-//go:linkname procIoctl libc_ioctl
-
-var procIoctl uintptr
-
-func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno)
+//extern __go_ioctl_ptr
+func libc_ioctl(int32, int32, unsafe.Pointer) int32
 
 func ioctl(s, ioc uintptr, arg unsafe.Pointer) error {
-	_, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procIoctl)), 3, s, ioc, uintptr(arg), 0, 0, 0)
-	if errno != 0 {
-		return error(errno)
+	if libc_ioctl(int32(s), int32(ioc), arg) < 0 {
+		return syscall.GetErrno()
 	}
 	return nil
 }
diff --git a/libgo/go/golang.org/x/net/lif/zsys_solaris.go b/libgo/go/golang.org/x/net/lif/zsys_solaris.go
new file mode 100644
--- /dev/null
+++ b/libgo/go/golang.org/x/net/lif/zsys_solaris.go
@@ -0,0 +1,101 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs defs_solaris.go
+
+package lif
+
+import "unsafe"
+
+const (
+	sysAF_UNSPEC = 0x0
+	sysAF_INET   = 0x2
+	sysAF_INET6  = 0x1a
+
+	sysSOCK_DGRAM = 0x1
+)
+
+type sockaddrStorage struct {
+	Family     uint16
+	X_ss_pad1  [6]int8
+	X_ss_align float64
+	X_ss_pad2  [240]int8
+}
+
+const (
+	sysLIFC_NOXMIT          = 0x1
+	sysLIFC_EXTERNAL_SOURCE = 0x2
+	sysLIFC_TEMPORARY       = 0x4
+	sysLIFC_ALLZONES        = 0x8
+	sysLIFC_UNDER_IPMP      = 0x10
+	sysLIFC_ENABLED         = 0x20
+
+	sysSIOCGLIFADDR    = -0x3f87968f
+	sysSIOCGLIFDSTADDR = -0x3f87968d
+	sysSIOCGLIFFLAGS   = -0x3f87968b
+	sysSIOCGLIFMTU     = -0x3f879686
+	sysSIOCGLIFNETMASK = -0x3f879683
+	sysSIOCGLIFMETRIC  = -0x3f879681
+	sysSIOCGLIFNUM     = -0x3ff3967e
+	sysSIOCGLIFINDEX   = -0x3f87967b
+	sysSIOCGLIFSUBNET  = -0x3f879676
+	sysSIOCGLIFLNKINFO = -0x3f879674
+	sysSIOCGLIFCONF    = -0x3fef965b
+	sysSIOCGLIFHWADDR  = -0x3f879640
+)
+
+const (
+	sysIFF_UP          = 0x1
+	sysIFF_BROADCAST   = 0x2
+	sysIFF_DEBUG       = 0x4
+	sysIFF_LOOPBACK    = 0x8
+	sysIFF_POINTOPOINT = 0x10
+	sysIFF_NOTRAILERS  = 0x20
+	sysIFF_RUNNING     = 0x40
+	sysIFF_NOARP       = 0x80
+	sysIFF_PROMISC     = 0x100
+	sysIFF_ALLMULTI    = 0x200
+	sysIFF_INTELLIGENT = 0x400
+	sysIFF_MULTICAST   = 0x800
+	sysIFF_MULTI_BCAST = 0x1000
+	sysIFF_UNNUMBERED  = 0x2000
+	sysIFF_PRIVATE     = 0x8000
+)
+
+const (
+	sizeofLifnum       = 0xc
+	sizeofLifreq       = 0x178
+	sizeofLifconf      = 0x18
+	sizeofLifIfinfoReq = 0x10
+)
+
+type lifnum struct {
+	Family    uint16
+	Flags     int32
+	Count     int32
+}
+
+type lifreq struct {
+	Name   [32]int8
+	Lifru1 [4]byte
+	Type   uint32
+	Lifru  [336]byte
+}
+
+type lifconf struct {
+	Family    uint16
+	Flags     int32
+	Len       int32
+	Lifcu     [unsafe.Sizeof(unsafe.Pointer(nil))]byte
+}
+
+type lifIfinfoReq struct {
+	Maxhops      uint8
+	Reachtime    uint32
+	Reachretrans uint32
+	Maxmtu       uint32
+}
+
+const (
+	sysIFT_IPV4 = 0xc8
+	sysIFT_IPV6 = 0xc9
+	sysIFT_6TO4 = 0xca
+)
diff --git a/libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go b/libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go
deleted file mode 100644
--- a/libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs defs_solaris.go
-
-package lif
-
-const (
-	sysAF_UNSPEC = 0x0
-	sysAF_INET   = 0x2
-	sysAF_INET6  = 0x1a
-
-	sysSOCK_DGRAM = 0x1
-)
-
-type sockaddrStorage struct {
-	Family     uint16
-	X_ss_pad1  [6]int8
-	X_ss_align float64
-	X_ss_pad2  [240]int8
-}
-
-const (
-	sysLIFC_NOXMIT          = 0x1
-	sysLIFC_EXTERNAL_SOURCE = 0x2
-	sysLIFC_TEMPORARY       = 0x4
-	sysLIFC_ALLZONES        = 0x8
-	sysLIFC_UNDER_IPMP      = 0x10
-	sysLIFC_ENABLED         = 0x20
-
-	sysSIOCGLIFADDR    = -0x3f87968f
-	sysSIOCGLIFDSTADDR = -0x3f87968d
-	sysSIOCGLIFFLAGS   = -0x3f87968b
-	sysSIOCGLIFMTU     = -0x3f879686
-	sysSIOCGLIFNETMASK = -0x3f879683
-	sysSIOCGLIFMETRIC  = -0x3f879681
-	sysSIOCGLIFNUM     = -0x3ff3967e
-	sysSIOCGLIFINDEX   = -0x3f87967b
-	sysSIOCGLIFSUBNET  = -0x3f879676
-	sysSIOCGLIFLNKINFO = -0x3f879674
-	sysSIOCGLIFCONF    = -0x3fef965b
-	sysSIOCGLIFHWADDR  = -0x3f879640
-)
-
-const (
-	sysIFF_UP          = 0x1
-	sysIFF_BROADCAST   = 0x2
-	sysIFF_DEBUG       = 0x4
-	sysIFF_LOOPBACK    = 0x8
-	sysIFF_POINTOPOINT = 0x10
-	sysIFF_NOTRAILERS  = 0x20
-	sysIFF_RUNNING     = 0x40
-	sysIFF_NOARP       = 0x80
-	sysIFF_PROMISC     = 0x100
-	sysIFF_ALLMULTI    = 0x200
-	sysIFF_INTELLIGENT = 0x400
-	sysIFF_MULTICAST   = 0x800
-	sysIFF_MULTI_BCAST = 0x1000
-	sysIFF_UNNUMBERED  = 0x2000
-	sysIFF_PRIVATE     = 0x8000
-)
-
-const (
-	sizeofLifnum       = 0xc
-	sizeofLifreq       = 0x178
-	sizeofLifconf      = 0x18
-	sizeofLifIfinfoReq = 0x10
-)
-
-type lifnum struct {
-	Family    uint16
-	Pad_cgo_0 [2]byte
-	Flags     int32
-	Count     int32
-}
-
-type lifreq struct {
-	Name   [32]int8
-	Lifru1 [4]byte
-	Type   uint32
-	Lifru  [336]byte
-}
-
-type lifconf struct {
-	Family    uint16
-	Pad_cgo_0 [2]byte
-	Flags     int32
-	Len       int32
-	Pad_cgo_1 [4]byte
-	Lifcu     [8]byte
-}
-
-type lifIfinfoReq struct {
-	Maxhops      uint8
-	Pad_cgo_0    [3]byte
-	Reachtime    uint32
-	Reachretrans uint32
-	Maxmtu       uint32
-}
-
-const (
-	sysIFT_IPV4 = 0xc8
-	sysIFT_IPV6 = 0xc9
-	sysIFT_6TO4 = 0xca
-)
diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.c b/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.c
--- a/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.c
+++ b/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.c
@@ -3,7 +3,9 @@
 // license that can be found in the LICENSE file.
 
 // +build 386 amd64 amd64p32
-// +build gccgo
+// +build gccgo,386 gccgo,amd64
+
+#if defined(__i386__) || defined(__x86_64__)
 
 #include <cpuid.h>
 #include <stdint.h>
@@ -41,3 +43,5 @@ gccgoXgetbv(uint32_t *eax, uint32_t *edx
 	      "  xgetbv"
 	    : "=a"(*eax), "=d"(*edx));
 }
+
+#endif /* defined(__i386__) || defined(__x86_64__)  */
diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.go b/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.go
--- a/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.go
+++ b/libgo/go/golang.org/x/sys/cpu/cpu_gccgo.go
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 // +build 386 amd64 amd64p32
-// +build gccgo
+// +build gccgo,386 gccgo,amd64
 
 package cpu
 
diff --git a/libgo/go/golang.org/x/sys/cpu/cpu_sparcx.go b/libgo/go/golang.org/x/sys/cpu/cpu_sparcx.go
new file mode 100644
--- /dev/null
+++ b/libgo/go/golang.org/x/sys/cpu/cpu_sparcx.go
@@ -0,0 +1,12 @@
+// Copyright 2019 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 sparc sparc64
+
+package cpu
+
+// FIXME: Check.
+const cacheLineSize = 32
+
+func doinit() {}
diff --git a/libgo/go/runtime/os_solaris.go b/libgo/go/runtime/os_solaris.go
--- a/libgo/go/runtime/os_solaris.go
+++ b/libgo/go/runtime/os_solaris.go
@@ -31,7 +31,7 @@ func sem_reltimedwait_np(sem *semt, time
 
 //go:nosplit
 func semacreate(mp *m) {
-	if mp.mos.waitsema != 0 {
+	if mp.waitsema != 0 {
 		return
 	}
 
@@ -44,7 +44,7 @@ func semacreate(mp *m) {
 	if sem_init(sem, 0, 0) != 0 {
 		throw("sem_init")
 	}
-	mp.mos.waitsema = uintptr(unsafe.Pointer(sem))
+	mp.waitsema = uintptr(unsafe.Pointer(sem))
 }
 
 //go:nosplit
@@ -54,7 +54,7 @@ func semasleep(ns int64) int32 {
 		var ts timespec
 		ts.setNsec(ns)
 
-		if sem_reltimedwait_np((*semt)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 {
+		if sem_reltimedwait_np((*semt)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 {
 			err := errno()
 			if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR {
 				return -1
@@ -64,7 +64,7 @@ func semasleep(ns int64) int32 {
 		return 0
 	}
 	for {
-		r1 := sem_wait((*semt)(unsafe.Pointer(_m_.mos.waitsema)))
+		r1 := sem_wait((*semt)(unsafe.Pointer(_m_.waitsema)))
 		if r1 == 0 {
 			break
 		}
@@ -78,7 +78,7 @@ func semasleep(ns int64) int32 {
 
 //go:nosplit
 func semawakeup(mp *m) {
-	if sem_post((*semt)(unsafe.Pointer(mp.mos.waitsema))) != 0 {
+	if sem_post((*semt)(unsafe.Pointer(mp.waitsema))) != 0 {
 		throw("sem_post")
 	}
 }
Ian Lance Taylor Sept. 9, 2019, 11:13 p.m. | #3
On Sat, Sep 7, 2019 at 5:03 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>

> This has dropped support for riscv64:


Thanks, and sorry.  The gccgo-local changes were lost when the files
moved.  I restored them as follows.  Bootstrapped and ran Go testsuite
on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 275544)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-03fa49394bb4b37453795bef3119e5b40c929aee
+c6097f269d2b3dbfd5204cf7e3d0b9f8d7ec2b5e
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go
===================================================================
--- libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go	(revision 275473)
+++ libgo/misc/cgo/testcshared/testdata/libgo2/dup2.go	(working copy)
@@ -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,!arm64 netbsd openbsd
+// +build darwin dragonfly freebsd linux,!arm64,!riscv64 netbsd openbsd
 
 package main
 
Index: libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go
===================================================================
--- libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go	(revision 275473)
+++ libgo/misc/cgo/testcshared/testdata/libgo2/dup3.go	(working copy)
@@ -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 linux,arm64
+// +build linux,arm64 linux,riscv64
 
 package main
Ian Lance Taylor Sept. 10, 2019, 8:41 p.m. | #4
On Mon, Sep 9, 2019 at 1:26 AM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>

> > 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.

>

> this patch caused quite some fallout on Solaris, both SPARC and x86:

>

> * The golang.org/x/net/lif package won't build:

>

> make[4]: *** No rule to make target 'golang.org/x/net/lif.gox', needed by 'net.lo'.  Stop.

>

>   It moved from go/internal/x/net/lif/lif.go to

>   go/golang.org/x/net/lif/lif.go, but neither was Makefile.am adapted to

>   reflect this nor the Solaris fixes in the old version carried over to

>   the new location.

>

> * go/runtime/os_solaris.go doesn't compile:

>

> /vol/gcc/src/hg/trunk/local/libgo/go/runtime/os_solaris.go:34:7: error: reference to undefined field or method ‘mos’

>    34 |  if mp.mos.waitsema != 0 {

>       |       ^

>

>   and several more instances.  Caused by losing the explict mos member

>   of m in go/runtime/runtime2.go, fixed by dropping it here, to.

>

> * As Bernd mentioned, go/golang.org/x/sys/cpu/cpu_gccgo.{c, go} don't

>   compile on non-x86 systems due to lack of <cpuid.h>.  Fixed by

>   restricting to 386 or amd64 and wrapping the C code in __i386__ ||

>   __x86_64__.

>

> * The go/golang.org/x/sys/cpu package doesn't compile on SPARC:

>

> /vol/gcc/src/hg/trunk/local/libgo/go/golang.org/x/sys/cpu/cpu.go:17:30: error: reference to undefined name 'cacheLineSize'

>    17 | type CacheLinePad struct{ _ [cacheLineSize]byte }

>       |                              ^

> make[8]: *** [Makefile:2826: golang.org/x/sys/cpu.lo] Error 1

>

>   For the moment, I've worked around this by introducing cpu_sparcx.go

>   with appropriate build tags.  However, I'm uncertain what do do about

>   the actual value of cacheLineSize: the L1 D$ size is 16 on

>   UltraSPARC-T2, but 32 on SPARC-S7.

>

> With the attached patch, I can now bootstrap mainline on both

> i386-pc-solaris2.11 and sparc-sun-solaris2.11.  Test results are similar

> to pre-1.13, but I'll have to check further.


Thanks.  I've committed this patch, based on yours but somewhat different.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 275608)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-2f6dd921a21351e94f55a5365a3176af563b5945
+bf4832d604e7522dee78fca76de220b62a131d54
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/Makefile.am
===================================================================
--- libgo/Makefile.am	(revision 275594)
+++ libgo/Makefile.am	(working copy)
@@ -510,6 +510,14 @@ s-cpu: Makefile
 	$(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
 	$(STAMP) $@
 
+gcpugen.go: s-gcpu; @true
+s-gcpu: Makefile
+	rm -f gcpugen.go.tmp
+	echo "package cpu" > gcpugen.go.tmp
+	echo "const cacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> gcpugen.go.tmp
+	$(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
+	$(STAMP) $@
+
 objabi.go: s-objabi; @true
 s-objabi: Makefile
 	rm -f objabi.go.tmp
@@ -773,7 +781,7 @@ GOLINK = $(LIBTOOL) --tag GO --mode-link
 BUILDDEPS = \
 	$(MKDIR_P) $(@D); \
 	dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
-	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst /,_,$(subst .lo.dep,,$@)))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
+	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(subst .lo.dep,,$@))))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
 	$(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
 	if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
 	  rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
@@ -804,7 +812,7 @@ GOBENCH =
 CHECK = \
 	GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
 	export GC; \
-	GOLIBS="$(extra_check_libs_$(subst /,_,$(@D))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
+	GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D)))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
 	export GOLIBS; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
@@ -818,7 +826,7 @@ CHECK = \
 	export LD_LIBRARY_PATH; \
 	$(MKDIR_P) $(@D); \
 	rm -f $@-testsum $@-testlog; \
-	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
+	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(@D))))" $(matchargs_$(subst /,_,$(@D)))`; \
 	if test "$(USE_DEJAGNU)" = "yes"; then \
 	  $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
 	elif test "$(GOBENCH)" != ""; then \
@@ -951,6 +959,9 @@ runtime/internal/sys.lo.dep: $(extra_go_
 extra_go_files_internal_cpu = cpugen.go
 internal/cpu.lo.dep: $(extra_go_files_internal_cpu)
 
+extra_go_files_golang_org_x_sys_cpu = gcpugen.go
+golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu)
+
 extra_go_files_internal_goroot = zstdpkglist.go
 internal/goroot.lo.dep: $(extra_go_files_internal_goroot)
 
@@ -1047,34 +1058,27 @@ endif
 
 if LIBGO_IS_BSD
 
-# Build internal/x/net/route only on BSD systems.
+# Build golang.org/x/net/route only on BSD systems.
 
-$(eval $(call PACKAGE_template,internal/x/net/route))
+$(eval $(call PACKAGE_template,golang.org/x/net/route))
 
 golangorg_x_net_route_lo = \
 	golang.org/net/route.lo
-golangorg_x_net_route_check = \
-	golang.org/x/net/route/check
 
 endif
 
 if LIBGO_IS_SOLARIS
 
-# Build internal/x/net/lif only on Solaris systems.
+# Build golang.org/x/net/lif only on Solaris systems.
 
-$(eval $(call PACKAGE_template,internal/x/net/lif))
+$(eval $(call PACKAGE_template,golang.org/x/net/lif))
 
 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)) \
-	$(golangorg_x_net_lif_check) \
-	$(golangorg_x_net_route_check)
+TEST_PACKAGES = $(addsuffix /check,$(shell cat $(srcdir)/check-packages.txt))
 
 check: check-tail
 check-recursive: check-head
Index: libgo/Makefile.in
===================================================================
--- libgo/Makefile.in	(revision 275594)
+++ libgo/Makefile.in	(working copy)
@@ -973,7 +973,7 @@ GOLINK = $(LIBTOOL) --tag GO --mode-link
 BUILDDEPS = \
 	$(MKDIR_P) $(@D); \
 	dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
-	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst /,_,$(subst .lo.dep,,$@)))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
+	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(subst .lo.dep,,$@))))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
 	$(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
 	if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
 	  rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
@@ -1006,7 +1006,7 @@ GOBENCH =
 CHECK = \
 	GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
 	export GC; \
-	GOLIBS="$(extra_check_libs_$(subst /,_,$(@D))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
+	GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D)))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
 	export GOLIBS; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
@@ -1020,7 +1020,7 @@ CHECK = \
 	export LD_LIBRARY_PATH; \
 	$(MKDIR_P) $(@D); \
 	rm -f $@-testsum $@-testlog; \
-	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
+	files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(@D))))" $(matchargs_$(subst /,_,$(@D)))`; \
 	if test "$(USE_DEJAGNU)" = "yes"; then \
 	  $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
 	elif test "$(GOBENCH)" != ""; then \
@@ -1091,6 +1091,7 @@ runtime_internal_sys_lo_check_GOCFLAGS =
 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
 extra_go_files_runtime_internal_sys = version.go
 extra_go_files_internal_cpu = cpugen.go
+extra_go_files_golang_org_x_sys_cpu = gcpugen.go
 extra_go_files_internal_goroot = zstdpkglist.go
 extra_go_files_go_types = gccgosizes.go
 extra_go_files_cmd_internal_objabi = objabi.go
@@ -1121,20 +1122,10 @@ extra_check_libs_cmd_vet_internal_cfg =
 @LIBGO_IS_BSD_TRUE@golangorg_x_net_route_lo = \
 @LIBGO_IS_BSD_TRUE@	golang.org/net/route.lo
 
-@LIBGO_IS_BSD_TRUE@golangorg_x_net_route_check = \
-@LIBGO_IS_BSD_TRUE@	golang.org/x/net/route/check
-
 @LIBGO_IS_SOLARIS_TRUE@golangorg_x_net_lif_lo = \
 @LIBGO_IS_SOLARIS_TRUE@	golang.org/x/net/lif.lo
 
-@LIBGO_IS_SOLARIS_TRUE@golangorg_x_net_lif_check = \
-@LIBGO_IS_SOLARIS_TRUE@	golang.org/x/net/lif/check
-
-TPACKAGES = $(shell cat $(srcdir)/check-packages.txt)
-TEST_PACKAGES = $(addsuffix /check,$(TPACKAGES)) \
-	$(golangorg_x_net_lif_check) \
-	$(golangorg_x_net_route_check)
-
+TEST_PACKAGES = $(addsuffix /check,$(shell cat $(srcdir)/check-packages.txt))
 MOSTLYCLEANFILES = \
 	s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
 	s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
@@ -2629,6 +2620,14 @@ s-cpu: Makefile
 	$(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
 	$(STAMP) $@
 
+gcpugen.go: s-gcpu; @true
+s-gcpu: Makefile
+	rm -f gcpugen.go.tmp
+	echo "package cpu" > gcpugen.go.tmp
+	echo "const cacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> gcpugen.go.tmp
+	$(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
+	$(STAMP) $@
+
 objabi.go: s-objabi; @true
 s-objabi: Makefile
 	rm -f objabi.go.tmp
@@ -2830,6 +2829,7 @@ runtime.lo.dep: $(extra_go_files_runtime
 syscall.lo.dep: $(extra_go_files_syscall)
 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
 internal/cpu.lo.dep: $(extra_go_files_internal_cpu)
+golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu)
 internal/goroot.lo.dep: $(extra_go_files_internal_goroot)
 go/types.lo.dep: $(extra_go_files_go_types)
 cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi)
@@ -2886,13 +2886,13 @@ golang.org/x/sys/cpu_gccgo.lo: go/golang
 	@$(MKDIR_P) golang.org/x/sys
 	$(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo.c
 
-# Build internal/x/net/route only on BSD systems.
+# Build golang.org/x/net/route only on BSD systems.
 
-@LIBGO_IS_BSD_TRUE@$(eval $(call PACKAGE_template,internal/x/net/route))
+@LIBGO_IS_BSD_TRUE@$(eval $(call PACKAGE_template,golang.org/x/net/route))
 
-# Build internal/x/net/lif only on Solaris systems.
+# Build golang.org/x/net/lif only on Solaris systems.
 
-@LIBGO_IS_SOLARIS_TRUE@$(eval $(call PACKAGE_template,internal/x/net/lif))
+@LIBGO_IS_SOLARIS_TRUE@$(eval $(call PACKAGE_template,golang.org/x/net/lif))
 
 check: check-tail
 check-recursive: check-head
Index: libgo/go/golang.org/x/net/lif/syscall.go
===================================================================
--- libgo/go/golang.org/x/net/lif/syscall.go	(revision 275594)
+++ libgo/go/golang.org/x/net/lif/syscall.go	(working copy)
@@ -11,18 +11,12 @@ import (
 	"unsafe"
 )
 
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
-//go:linkname procIoctl libc_ioctl
-
-var procIoctl uintptr
-
-func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno)
+//extern __go_ioctl_ptr
+func libc_ioctl(int32, int32, unsafe.Pointer) int32
 
 func ioctl(s, ioc uintptr, arg unsafe.Pointer) error {
-	_, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procIoctl)), 3, s, ioc, uintptr(arg), 0, 0, 0)
-	if errno != 0 {
-		return error(errno)
+	if libc_ioctl(int32(s), int32(ioc), arg) < 0 {
+		return syscall.GetErrno()
 	}
 	return nil
 }
Index: libgo/go/golang.org/x/net/lif/zsys_solaris.go
===================================================================
--- libgo/go/golang.org/x/net/lif/zsys_solaris.go	(nonexistent)
+++ libgo/go/golang.org/x/net/lif/zsys_solaris.go	(working copy)
@@ -0,0 +1,101 @@
+// Created by cgo -godefs - DO NOT EDIT
+// cgo -godefs defs_solaris.go
+
+package lif
+
+import "unsafe"
+
+const (
+	sysAF_UNSPEC = 0x0
+	sysAF_INET   = 0x2
+	sysAF_INET6  = 0x1a
+
+	sysSOCK_DGRAM = 0x1
+)
+
+type sockaddrStorage struct {
+	Family     uint16
+	X_ss_pad1  [6]int8
+	X_ss_align float64
+	X_ss_pad2  [240]int8
+}
+
+const (
+	sysLIFC_NOXMIT          = 0x1
+	sysLIFC_EXTERNAL_SOURCE = 0x2
+	sysLIFC_TEMPORARY       = 0x4
+	sysLIFC_ALLZONES        = 0x8
+	sysLIFC_UNDER_IPMP      = 0x10
+	sysLIFC_ENABLED         = 0x20
+
+	sysSIOCGLIFADDR    = -0x3f87968f
+	sysSIOCGLIFDSTADDR = -0x3f87968d
+	sysSIOCGLIFFLAGS   = -0x3f87968b
+	sysSIOCGLIFMTU     = -0x3f879686
+	sysSIOCGLIFNETMASK = -0x3f879683
+	sysSIOCGLIFMETRIC  = -0x3f879681
+	sysSIOCGLIFNUM     = -0x3ff3967e
+	sysSIOCGLIFINDEX   = -0x3f87967b
+	sysSIOCGLIFSUBNET  = -0x3f879676
+	sysSIOCGLIFLNKINFO = -0x3f879674
+	sysSIOCGLIFCONF    = -0x3fef965b
+	sysSIOCGLIFHWADDR  = -0x3f879640
+)
+
+const (
+	sysIFF_UP          = 0x1
+	sysIFF_BROADCAST   = 0x2
+	sysIFF_DEBUG       = 0x4
+	sysIFF_LOOPBACK    = 0x8
+	sysIFF_POINTOPOINT = 0x10
+	sysIFF_NOTRAILERS  = 0x20
+	sysIFF_RUNNING     = 0x40
+	sysIFF_NOARP       = 0x80
+	sysIFF_PROMISC     = 0x100
+	sysIFF_ALLMULTI    = 0x200
+	sysIFF_INTELLIGENT = 0x400
+	sysIFF_MULTICAST   = 0x800
+	sysIFF_MULTI_BCAST = 0x1000
+	sysIFF_UNNUMBERED  = 0x2000
+	sysIFF_PRIVATE     = 0x8000
+)
+
+const (
+	sizeofLifnum       = 0xc
+	sizeofLifreq       = 0x178
+	sizeofLifconf      = 0x18
+	sizeofLifIfinfoReq = 0x10
+)
+
+type lifnum struct {
+	Family    uint16
+	Flags     int32
+	Count     int32
+}
+
+type lifreq struct {
+	Name   [32]int8
+	Lifru1 [4]byte
+	Type   uint32
+	Lifru  [336]byte
+}
+
+type lifconf struct {
+	Family    uint16
+	Flags     int32
+	Len       int32
+	Lifcu     [unsafe.Sizeof(unsafe.Pointer(nil))]byte
+}
+
+type lifIfinfoReq struct {
+	Maxhops      uint8
+	Reachtime    uint32
+	Reachretrans uint32
+	Maxmtu       uint32
+}
+
+const (
+	sysIFT_IPV4 = 0xc8
+	sysIFT_IPV6 = 0xc9
+	sysIFT_6TO4 = 0xca
+)
Index: libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go
===================================================================
--- libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go	(revision 275594)
+++ libgo/go/golang.org/x/net/lif/zsys_solaris_amd64.go	(nonexistent)
@@ -1,103 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs defs_solaris.go
-
-package lif
-
-const (
-	sysAF_UNSPEC = 0x0
-	sysAF_INET   = 0x2
-	sysAF_INET6  = 0x1a
-
-	sysSOCK_DGRAM = 0x1
-)
-
-type sockaddrStorage struct {
-	Family     uint16
-	X_ss_pad1  [6]int8
-	X_ss_align float64
-	X_ss_pad2  [240]int8
-}
-
-const (
-	sysLIFC_NOXMIT          = 0x1
-	sysLIFC_EXTERNAL_SOURCE = 0x2
-	sysLIFC_TEMPORARY       = 0x4
-	sysLIFC_ALLZONES        = 0x8
-	sysLIFC_UNDER_IPMP      = 0x10
-	sysLIFC_ENABLED         = 0x20
-
-	sysSIOCGLIFADDR    = -0x3f87968f
-	sysSIOCGLIFDSTADDR = -0x3f87968d
-	sysSIOCGLIFFLAGS   = -0x3f87968b
-	sysSIOCGLIFMTU     = -0x3f879686
-	sysSIOCGLIFNETMASK = -0x3f879683
-	sysSIOCGLIFMETRIC  = -0x3f879681
-	sysSIOCGLIFNUM     = -0x3ff3967e
-	sysSIOCGLIFINDEX   = -0x3f87967b
-	sysSIOCGLIFSUBNET  = -0x3f879676
-	sysSIOCGLIFLNKINFO = -0x3f879674
-	sysSIOCGLIFCONF    = -0x3fef965b
-	sysSIOCGLIFHWADDR  = -0x3f879640
-)
-
-const (
-	sysIFF_UP          = 0x1
-	sysIFF_BROADCAST   = 0x2
-	sysIFF_DEBUG       = 0x4
-	sysIFF_LOOPBACK    = 0x8
-	sysIFF_POINTOPOINT = 0x10
-	sysIFF_NOTRAILERS  = 0x20
-	sysIFF_RUNNING     = 0x40
-	sysIFF_NOARP       = 0x80
-	sysIFF_PROMISC     = 0x100
-	sysIFF_ALLMULTI    = 0x200
-	sysIFF_INTELLIGENT = 0x400
-	sysIFF_MULTICAST   = 0x800
-	sysIFF_MULTI_BCAST = 0x1000
-	sysIFF_UNNUMBERED  = 0x2000
-	sysIFF_PRIVATE     = 0x8000
-)
-
-const (
-	sizeofLifnum       = 0xc
-	sizeofLifreq       = 0x178
-	sizeofLifconf      = 0x18
-	sizeofLifIfinfoReq = 0x10
-)
-
-type lifnum struct {
-	Family    uint16
-	Pad_cgo_0 [2]byte
-	Flags     int32
-	Count     int32
-}
-
-type lifreq struct {
-	Name   [32]int8
-	Lifru1 [4]byte
-	Type   uint32
-	Lifru  [336]byte
-}
-
-type lifconf struct {
-	Family    uint16
-	Pad_cgo_0 [2]byte
-	Flags     int32
-	Len       int32
-	Pad_cgo_1 [4]byte
-	Lifcu     [8]byte
-}
-
-type lifIfinfoReq struct {
-	Maxhops      uint8
-	Pad_cgo_0    [3]byte
-	Reachtime    uint32
-	Reachretrans uint32
-	Maxmtu       uint32
-}
-
-const (
-	sysIFT_IPV4 = 0xc8
-	sysIFT_IPV6 = 0xc9
-	sysIFT_6TO4 = 0xca
-)
Index: libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_aix_ppc64.go	(working copy)
@@ -6,8 +6,6 @@
 
 package cpu
 
-const cacheLineSize = 128
-
 const (
 	// getsystemcfg constants
 	_SC_IMPL     = 2
Index: libgo/go/golang.org/x/sys/cpu/cpu_arm.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_arm.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_arm.go	(nonexistent)
@@ -1,9 +0,0 @@
-// Copyright 2018 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.
-
-package cpu
-
-const cacheLineSize = 32
-
-func doinit() {}
Index: libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_linux_arm64.go	(working copy)
@@ -4,8 +4,6 @@
 
 package cpu
 
-const cacheLineSize = 64
-
 // HWCAP/HWCAP2 bits. These are exposed by Linux.
 const (
 	hwcap_FP       = 1 << 0
Index: libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_linux_ppc64x.go	(working copy)
@@ -7,8 +7,6 @@
 
 package cpu
 
-const cacheLineSize = 128
-
 // HWCAP/HWCAP2 bits. These are exposed by the kernel.
 const (
 	// ISA Level
Index: libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_linux_s390x.go	(working copy)
@@ -4,8 +4,6 @@
 
 package cpu
 
-const cacheLineSize = 256
-
 const (
 	// bit mask values from /usr/include/bits/hwcap.h
 	hwcap_ZARCH  = 2
Index: libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_mips64x.go	(nonexistent)
@@ -1,11 +0,0 @@
-// Copyright 2018 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 mips64 mips64le
-
-package cpu
-
-const cacheLineSize = 32
-
-func doinit() {}
Index: libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_mipsx.go	(nonexistent)
@@ -1,11 +0,0 @@
-// Copyright 2018 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 mips mipsle
-
-package cpu
-
-const cacheLineSize = 32
-
-func doinit() {}
Index: libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_other_arm64.go	(nonexistent)
@@ -1,11 +0,0 @@
-// Copyright 2019 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 !linux,arm64
-
-package cpu
-
-const cacheLineSize = 64
-
-func doinit() {}
Index: libgo/go/golang.org/x/sys/cpu/cpu_wasm.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_wasm.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_wasm.go	(nonexistent)
@@ -1,15 +0,0 @@
-// Copyright 2019 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 wasm
-
-package cpu
-
-// We're compiling the cpu package for an unknown (software-abstracted) CPU.
-// Make CacheLinePad an empty struct and hope that the usual struct alignment
-// rules are good enough.
-
-const cacheLineSize = 0
-
-func doinit() {}
Index: libgo/go/golang.org/x/sys/cpu/cpu_x86.go
===================================================================
--- libgo/go/golang.org/x/sys/cpu/cpu_x86.go	(revision 275594)
+++ libgo/go/golang.org/x/sys/cpu/cpu_x86.go	(working copy)
@@ -6,8 +6,6 @@
 
 package cpu
 
-const cacheLineSize = 64
-
 func init() {
 	Initialized = true
 
Index: libgo/go/runtime/os_solaris.go
===================================================================
--- libgo/go/runtime/os_solaris.go	(revision 275594)
+++ libgo/go/runtime/os_solaris.go	(working copy)
@@ -31,7 +31,7 @@ func sem_reltimedwait_np(sem *semt, time
 
 //go:nosplit
 func semacreate(mp *m) {
-	if mp.mos.waitsema != 0 {
+	if mp.waitsema != 0 {
 		return
 	}
 
@@ -44,7 +44,7 @@ func semacreate(mp *m) {
 	if sem_init(sem, 0, 0) != 0 {
 		throw("sem_init")
 	}
-	mp.mos.waitsema = uintptr(unsafe.Pointer(sem))
+	mp.waitsema = uintptr(unsafe.Pointer(sem))
 }
 
 //go:nosplit
@@ -54,7 +54,7 @@ func semasleep(ns int64) int32 {
 		var ts timespec
 		ts.setNsec(ns)
 
-		if sem_reltimedwait_np((*semt)(unsafe.Pointer(_m_.mos.waitsema)), &ts) != 0 {
+		if sem_reltimedwait_np((*semt)(unsafe.Pointer(_m_.waitsema)), &ts) != 0 {
 			err := errno()
 			if err == _ETIMEDOUT || err == _EAGAIN || err == _EINTR {
 				return -1
@@ -64,7 +64,7 @@ func semasleep(ns int64) int32 {
 		return 0
 	}
 	for {
-		r1 := sem_wait((*semt)(unsafe.Pointer(_m_.mos.waitsema)))
+		r1 := sem_wait((*semt)(unsafe.Pointer(_m_.waitsema)))
 		if r1 == 0 {
 			break
 		}
@@ -78,7 +78,7 @@ func semasleep(ns int64) int32 {
 
 //go:nosplit
 func semawakeup(mp *m) {
-	if sem_post((*semt)(unsafe.Pointer(mp.mos.waitsema))) != 0 {
+	if sem_post((*semt)(unsafe.Pointer(mp.waitsema))) != 0 {
 		throw("sem_post")
 	}
 }

Patch

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()