I have committed a patch to update libgo to the Go 1.12beta2 release.

As usual this sort of update is too large to include all changes in
this e-mail.  I've included changes to gccgo-specific files below.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

gotools/

2019-01-18  Ian Lance Taylor  <i...@golang.org>

* Makefile.am (go_cmd_vet_files): Update for Go1.12beta2 release.
(GOTOOLS_TEST_TIMEOUT): Increase to 600.
(check-runtime): Export LD_LIBRARY_PATH before computing GOARCH
and GOOS.
(check-vet): Copy golang.org/x/tools into check-vet-dir.
* Makefile.in: Regenerate.

gcc/testsuite/

2019-01-18  Ian Lance Taylor  <i...@golang.org>

* go.go-torture/execute/names-1.go: Stop using debug/xcoff, which
is no longer externally visible.
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 268078)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-d16e9181a760796802c067730bb030b92b63fb2c
+c76ba3014e42cc6adc3d43709bba28c5ad7a6ba2
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gotools/Makefile.am
===================================================================
--- gotools/Makefile.am (revision 268078)
+++ gotools/Makefile.am (working copy)
@@ -70,31 +70,8 @@ go_cmd_cgo_files = \
        $(cmdsrcdir)/cgo/util.go
 
 go_cmd_vet_files = \
-       $(cmdsrcdir)/vet/asmdecl.go \
-       $(cmdsrcdir)/vet/assign.go \
-       $(cmdsrcdir)/vet/atomic.go \
-       $(cmdsrcdir)/vet/bool.go \
-       $(cmdsrcdir)/vet/buildtag.go \
-       $(cmdsrcdir)/vet/cgo.go \
-       $(cmdsrcdir)/vet/composite.go \
-       $(cmdsrcdir)/vet/copylock.go \
-       $(cmdsrcdir)/vet/deadcode.go \
-       $(cmdsrcdir)/vet/dead.go \
        $(cmdsrcdir)/vet/doc.go \
-       $(cmdsrcdir)/vet/httpresponse.go \
-       $(cmdsrcdir)/vet/lostcancel.go \
-       $(cmdsrcdir)/vet/main.go \
-       $(cmdsrcdir)/vet/method.go \
-       $(cmdsrcdir)/vet/nilfunc.go \
-       $(cmdsrcdir)/vet/print.go \
-       $(cmdsrcdir)/vet/rangeloop.go \
-       $(cmdsrcdir)/vet/shadow.go \
-       $(cmdsrcdir)/vet/shift.go \
-       $(cmdsrcdir)/vet/structtag.go \
-       $(cmdsrcdir)/vet/tests.go \
-       $(cmdsrcdir)/vet/types.go \
-       $(cmdsrcdir)/vet/unsafeptr.go \
-       $(cmdsrcdir)/vet/unused.go
+       $(cmdsrcdir)/vet/main.go
 
 go_cmd_buildid_files = \
        $(cmdsrcdir)/buildid/buildid.go \
@@ -163,7 +140,7 @@ uninstall-local:
 GOTESTFLAGS =
 
 # Number of seconds before tests time out.
-GOTOOLS_TEST_TIMEOUT = 480
+GOTOOLS_TEST_TIMEOUT = 600
 
 # Run tests using the go tool, and frob the output to look like that
 # generated by DejaGNU.  The main output of this is two files:
@@ -256,6 +233,7 @@ check-runtime: go$(EXEEXT) $(noinst_PROG
        $(MKDIR_P) check-runtime-dir
        @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
        LD_LIBRARY_PATH=`echo $${abs_libgodir}/.libs:$${LD_LIBRARY_PATH} | sed 
's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+       export LD_LIBRARY_PATH; \
        GOARCH=`$(abs_builddir)/go$(EXEEXT) env GOARCH`; \
        GOOS=`$(abs_builddir)/go$(EXEEXT) env GOOS`; \
        files=`$(SHELL) $(libgosrcdir)/../match.sh --goarch=$${GOARCH} 
--goos=$${GOOS} --srcdir=$(libgosrcdir)/runtime 
--extrafiles="$(libgodir)/runtime_sysinfo.go $(libgodir)/sigtab.go" 
--tag=libffi`; \
@@ -299,10 +277,11 @@ check-carchive-test: go$(EXEEXT) $(noins
 # check-vet runs `go test cmd/vet` in our environment.
 check-vet: go$(EXEEXT) $(noinst_PROGRAMS) check-head check-gccgo check-gcc
        rm -rf check-vet-dir cmd_vet-testlog
-       $(MKDIR_P) check-vet-dir/src/cmd/internal
+       $(MKDIR_P) check-vet-dir/src/cmd/internal 
check-vet-dir/src/cmd/vendor/golang.org/x
        cp -r $(cmdsrcdir)/vet check-vet-dir/src/cmd/
        cp -r $(cmdsrcdir)/internal/objabi check-vet-dir/src/cmd/internal
        cp $(libgodir)/objabi.go check-vet-dir/src/cmd/internal/objabi/
+       cp -r $(libgosrcdir)/golang.org/x/tools 
check-vet-dir/src/cmd/vendor/golang.org/x/
        @abs_libgodir=`cd $(libgodir) && $(PWD_COMMAND)`; \
        abs_checkdir=`cd check-vet-dir && $(PWD_COMMAND)`; \
        echo "cd check-vet-dir/src/cmd/vet && $(ECHO_ENV) 
GOPATH=$${abs_checkdir} $(abs_builddir)/go$(EXEEXT) test -test.short 
-test.timeout=$(GOTOOLS_TEST_TIMEOUT)s -test.v" > cmd_vet-testlog
Index: gcc/testsuite/go.go-torture/execute/names-1.go
===================================================================
--- gcc/testsuite/go.go-torture/execute/names-1.go      (revision 268078)
+++ gcc/testsuite/go.go-torture/execute/names-1.go      (working copy)
@@ -7,9 +7,9 @@ import (
        "debug/elf"
        "debug/macho"
        "debug/pe"
-       "debug/xcoff"
        "fmt"
        "os"
+       "runtime"
        "strings"
 )
 
@@ -61,6 +61,12 @@ func Function3(out *bytes.Buffer) {
 }
 
 func main() {
+       if runtime.GOOS == "aix" {
+               // Not supported on AIX until there is an externally
+               // visible version of internal/xcoff.
+               return
+       }
+
        var b bytes.Buffer
        Function1(&b)
        Function2(&b)
@@ -95,10 +101,6 @@ func checkFile(f *os.File) {
                for _, psym := range pf.Symbols {
                        syms = append(syms, psym.Name)
                }
-       } else if xf, err := xcoff.NewFile(f); err == nil {
-               for _, xsym := range xf.Symbols {
-                       syms = append(syms, xsym.Name)
-               }
        } else {
                fmt.Println("checksyms: could not parse executable")
                fmt.Println("UNSUPPORTED: checksyms")
Index: libgo/MERGE
===================================================================
--- libgo/MERGE (revision 268078)
+++ libgo/MERGE (working copy)
@@ -1,4 +1,4 @@
-26957168c4c0cdcc7ca4f0b19d0eb19474d224ac
+4b3f04c63b5b1a1bbc4dfd71c34341ea4e935115
 
 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 268078)
+++ libgo/Makefile.am   (working copy)
@@ -217,8 +217,7 @@ toolexeclibgodebug_DATA = \
        debug/gosym.gox \
        debug/macho.gox \
        debug/pe.gox \
-       debug/plan9obj.gox \
-       debug/xcoff.gox
+       debug/plan9obj.gox
 
 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
 
@@ -394,8 +393,8 @@ toolexeclibgounicode_DATA = \
 # internal packages nothing will explicitly depend on them.
 # Force them to be built.
 noinst_DATA = \
-       golang_org/x/net/internal/nettest.gox \
-       golang_org/x/net/nettest.gox \
+       internal/x/net/internal/nettest.gox \
+       internal/x/net/nettest.gox \
        internal/testenv.gox \
        internal/trace.gox \
        net/internal/socktest.gox \
@@ -536,7 +535,7 @@ cpugen.go: s-cpu; @true
 s-cpu: Makefile
        rm -f cpugen.go.tmp
        echo "package cpu" > cpugen.go.tmp
-       echo "const CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) 
cachelinesize`" >> cpugen.go.tmp
+       echo "const CacheLinePadSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) 
cachelinesize`" >> cpugen.go.tmp
        $(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
        $(STAMP) $@
 
@@ -554,7 +553,7 @@ s-objabi: Makefile
        echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp
        echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp
        echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) 
--version | sed 1q`'`' >> objabi.go.tmp
-       echo 'const stackGuardMultiplier = 1' >> objabi.go.tmp
+       echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp
        echo 'const goexperiment = ``' >> objabi.go.tmp
        $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go
        $(STAMP) $@
@@ -715,16 +714,14 @@ PACKAGES = $(shell cat $(srcdir)/libgo-p
 
 libgo_go_objs = \
        $(addsuffix .lo,$(PACKAGES)) \
-       bytes/index.lo \
        internal/bytealg/bytealg.lo \
        reflect/makefunc_ffi_c.lo \
-       strings/index.lo \
        $(syscall_lib_clone_lo) \
        syscall/errno.lo \
        syscall/signame.lo \
        syscall/wait.lo \
-       $(golang_org_x_net_lif_lo) \
-       $(golang_org_x_net_route_lo) \
+       $(internal_x_net_lif_lo) \
+       $(internal_x_net_route_lo) \
        log/syslog/syslog_c.lo \
        $(os_lib_inotify_lo) \
        runtime/internal/atomic_c.lo \
@@ -807,7 +804,7 @@ BUILDDEPS = \
 BUILDPACKAGE = \
        $(MKDIR_P) $(@D); \
        files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
-       $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 
's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst 
/,_,$@)))_GOCFLAGS) -o $@ $$files
+       $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` 
$($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
 
 # How to build a .gox file from a .lo file.
 # Matching .o file can either be in the same directory as the .lo (non-PIC
@@ -990,6 +987,7 @@ extra_check_libs_cmd_go_internal_cache =
 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_lockedfile = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_imports = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_modconv = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_modfetch = $(abs_builddir)/libgotool.a
@@ -1007,13 +1005,7 @@ extra_check_libs_cmd_vet_internal_cfg =
 # FIXME: The following C files may as well move to the runtime
 # directory and be treated like other C files.
 
-# Use C code to speed up {bytes,strings}.IndexByte and friends.
-bytes/index.lo: go/bytes/indexbyte.c runtime.inc
-       @$(MKDIR_P) bytes
-       $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
-strings/index.lo: go/strings/indexbyte.c runtime.inc
-       @$(MKDIR_P) strings
-       $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
+# Use C code to speed up internal/bytealg.IndexByte and friends.
 internal/bytealg/bytealg.lo: go/internal/bytealg/bytealg.c runtime.inc
        @$(MKDIR_P) internal/bytealg
        $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/bytealg/bytealg.c
@@ -1070,34 +1062,34 @@ endif
 
 if LIBGO_IS_BSD
 
-# Build golang_org/x/net/route only on BSD systems.
+# Build internal/x/net/route only on BSD systems.
 
-$(eval $(call PACKAGE_template,golang_org/x/net/route))
+$(eval $(call PACKAGE_template,internal/x/net/route))
 
-golang_org_x_net_route_lo = \
-       golang_org/x/net/route.lo
-golang_org_x_net_route_check = \
-       golang_org/x/net/route/check
+internal_x_net_route_lo = \
+       internal/x/net/route.lo
+internal_x_net_route_check = \
+       internal/x/net/route/check
 
 endif
 
 if LIBGO_IS_SOLARIS
 
-# Build golang_org/x/net/lif only on Solaris systems.
+# Build internal/x/net/lif only on Solaris systems.
 
-$(eval $(call PACKAGE_template,golang_org/x/net/lif))
+$(eval $(call PACKAGE_template,internal/x/net/lif))
 
-golang_org_x_net_lif_lo = \
-       golang_org/x/net/lif.lo
-golang_org_x_net_lif_check = \
-       golang_org/x/net/lif/check
+internal_x_net_lif_lo = \
+       internal/x/net/lif.lo
+internal_x_net_lif_check = \
+       internal_org/x/net/lif/check
 
 endif
 
 TPACKAGES = $(shell cat $(srcdir)/check-packages.txt)
 TEST_PACKAGES = $(addsuffix /check,$(TPACKAGES)) \
-       $(golang_org_x_net_lif_check) \
-       $(golang_org_x_net_route_check)
+       $(internal_x_net_lif_check) \
+       $(internal_x_net_route_check)
 
 check: check-tail
 check-recursive: check-head
Index: libgo/VERSION
===================================================================
--- libgo/VERSION       (revision 268078)
+++ libgo/VERSION       (working copy)
@@ -1 +1 @@
-go1.11.1
+go1.12beta2
Index: libgo/check-packages.txt
===================================================================
--- libgo/check-packages.txt    (revision 268078)
+++ libgo/check-packages.txt    (working copy)
@@ -8,6 +8,8 @@ cmd/go/internal/generate
 cmd/go/internal/get
 cmd/go/internal/imports
 cmd/go/internal/load
+cmd/go/internal/lockedfile
+cmd/go/internal/lockedfile/internal/filelock
 cmd/go/internal/modconv
 cmd/go/internal/modfetch
 cmd/go/internal/modfetch/codehost
@@ -25,7 +27,6 @@ cmd/internal/buildid
 cmd/internal/edit
 cmd/internal/objabi
 cmd/internal/test2json
-cmd/vet/internal/cfg
 compress/bzip2
 compress/flate
 compress/gzip
@@ -61,7 +62,6 @@ debug/elf
 debug/macho
 debug/pe
 debug/plan9obj
-debug/xcoff
 encoding/ascii85
 encoding/asn1
 encoding/base32
@@ -91,19 +91,6 @@ go/printer
 go/scanner
 go/token
 go/types
-golang_org/x/crypto/internal/chacha20
-golang_org/x/crypto/chacha20poly1305
-golang_org/x/crypto/chacha20poly1305/internal/chacha20
-golang_org/x/crypto/cryptobyte
-golang_org/x/crypto/curve25519
-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/lex/httplex
-golang_org/x/net/proxy
 hash
 hash/adler32
 hash/crc32
@@ -118,9 +105,22 @@ image/jpeg
 image/png
 index/suffixarray
 internal/cpu
+internal/fmtsort
 internal/poll
 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
 log
@@ -162,6 +162,7 @@ regexp/syntax
 runtime
 runtime/debug
 runtime/internal/atomic
+runtime/internal/math
 runtime/internal/sys
 runtime/pprof
 runtime/pprof/internal/profile
Index: libgo/configure.ac
===================================================================
--- libgo/configure.ac  (revision 268078)
+++ 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=13:0:0
+libtool_VERSION=14:0:0
 AC_SUBST(libtool_VERSION)
 
 AM_ENABLE_MULTILIB(, ..)
@@ -153,7 +153,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 irix linux netbsd openbsd plan9 
rtems solaris windows"
+ALLGOOS="aix android darwin dragonfly freebsd hurd irix js linux netbsd 
openbsd plan9 rtems solaris windows"
 
 is_darwin=no
 is_freebsd=no
Index: libgo/go/runtime/internal/atomic/atomic.c
===================================================================
--- libgo/go/runtime/internal/atomic/atomic.c   (revision 268078)
+++ libgo/go/runtime/internal/atomic/atomic.c   (working copy)
@@ -13,7 +13,7 @@ uint32_t Load (uint32_t *ptr)
 uint32_t
 Load (uint32_t *ptr)
 {
-  return __atomic_load_n (ptr, __ATOMIC_ACQUIRE);
+  return __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
 }
 
 void *Loadp (void *ptr)
@@ -23,7 +23,7 @@ void *Loadp (void *ptr)
 void *
 Loadp (void *ptr)
 {
-  return __atomic_load_n ((void **) ptr, __ATOMIC_ACQUIRE);
+  return __atomic_load_n ((void **) ptr, __ATOMIC_SEQ_CST);
 }
 
 uint64_t Load64 (uint64_t *ptr)
@@ -35,6 +35,16 @@ Load64 (uint64_t *ptr)
 {
   if (((uintptr_t) ptr & 7) != 0)
     panicmem ();
+  return __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
+}
+
+uint32_t LoadAcq (uint32_t *ptr)
+  __asm__ (GOSYM_PREFIX "runtime..z2finternal..z2fatomic.LoadAcq")
+  __attribute__ ((no_split_stack));
+
+uint32_t
+LoadAcq (uint32_t *ptr)
+{
   return __atomic_load_n (ptr, __ATOMIC_ACQUIRE);
 }
 
@@ -45,7 +55,7 @@ uintptr_t Loaduintptr (uintptr_t *ptr)
 uintptr_t
 Loaduintptr (uintptr_t *ptr)
 {
-  return __atomic_load_n (ptr, __ATOMIC_ACQUIRE);
+  return __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
 }
 
 uintgo Loaduint (uintgo *ptr)
@@ -55,7 +65,7 @@ uintgo Loaduint (uintgo *ptr)
 uintgo
 Loaduint (uintgo *ptr)
 {
-  return __atomic_load_n (ptr, __ATOMIC_ACQUIRE);
+  return __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
 }
 
 int64_t Loadint64 (int64_t *ptr)
@@ -67,7 +77,7 @@ Loadint64 (int64_t *ptr)
 {
   if (((uintptr_t) ptr & 7) != 0)
     panicmem ();
-  return __atomic_load_n (ptr, __ATOMIC_ACQUIRE);
+  return __atomic_load_n (ptr, __ATOMIC_SEQ_CST);
 }
 
 uint32_t Xadd (uint32_t *ptr, int32_t delta)
@@ -188,6 +198,16 @@ Cas64 (uint64_t *ptr, uint64_t old, uint
   return __atomic_compare_exchange_n (ptr, &old, new, false, __ATOMIC_SEQ_CST, 
__ATOMIC_RELAXED);
 }
 
+_Bool CasRel (uint32_t *ptr, uint32_t old, uint32_t new)
+  __asm__ (GOSYM_PREFIX "runtime..z2finternal..z2fatomic.CasRel")
+  __attribute__ ((no_split_stack));
+
+_Bool
+CasRel (uint32_t *ptr, uint32_t old, uint32_t new)
+{
+  return __atomic_compare_exchange_n (ptr, &old, new, false, __ATOMIC_RELEASE, 
__ATOMIC_RELAXED);
+}
+
 _Bool Casp1 (void **ptr, void *old, void *new)
   __asm__ (GOSYM_PREFIX "runtime..z2finternal..z2fatomic.Casp1")
   __attribute__ ((no_split_stack));
@@ -230,6 +250,16 @@ Store64 (uint64_t *ptr, uint64_t val)
   __atomic_store_n (ptr, val, __ATOMIC_SEQ_CST);
 }
 
+void StoreRel (uint32_t *ptr, uint32_t val)
+  __asm__ (GOSYM_PREFIX "runtime..z2finternal..z2fatomic.StoreRel")
+  __attribute__ ((no_split_stack));
+
+void
+StoreRel (uint32_t *ptr, uint32_t val)
+{
+  __atomic_store_n (ptr, val, __ATOMIC_RELEASE);
+}
+
 void Storeuintptr (uintptr_t *ptr, uintptr_t val)
   __asm__ (GOSYM_PREFIX "runtime..z2finternal..z2fatomic.Storeuintptr")
   __attribute__ ((no_split_stack));
Index: libgo/go/runtime/internal/atomic/gccgo.go
===================================================================
--- libgo/go/runtime/internal/atomic/gccgo.go   (revision 268078)
+++ libgo/go/runtime/internal/atomic/gccgo.go   (working copy)
@@ -18,6 +18,9 @@ func Loadp(ptr unsafe.Pointer) unsafe.Po
 func Load64(ptr *uint64) uint64
 
 //go:noescape
+func LoadAcq(ptr *uint32) uint32
+
+//go:noescape
 func Xadd(ptr *uint32, delta int32) uint32
 
 //go:noescape
@@ -47,11 +50,17 @@ func Or8(ptr *uint8, val uint8)
 func Cas64(ptr *uint64, old, new uint64) bool
 
 //go:noescape
+func CasRel(ptr *uint32, old, new uint32) bool
+
+//go:noescape
 func Store(ptr *uint32, val uint32)
 
 //go:noescape
 func Store64(ptr *uint64, val uint64)
 
+//go:noescape
+func StoreRel(ptr *uint32, val uint32)
+
 // StorepNoWB performs *ptr = val atomically and without a write
 // barrier.
 //
Index: libgo/go/runtime/cgo_gccgo.go
===================================================================
--- libgo/go/runtime/cgo_gccgo.go       (revision 268078)
+++ libgo/go/runtime/cgo_gccgo.go       (working copy)
@@ -84,8 +84,8 @@ func CgocallBack() {
 
        lockOSThread()
 
-       exitsyscall()
        gp.m.incgo = false
+       exitsyscall()
 
        if gp.m.ncgo == 0 {
                // The C call to Go came from a thread created by C.
@@ -108,37 +108,41 @@ func CgocallBack() {
 func CgocallBackDone() {
        unlockOSThread()
 
-       // If we are the top level Go function called from C/C++, then
-       // we need to release the m. But don't release it if we are
-       // panicing; since this is the top level, we are going to
-       // crash the program, and we need the g and m to print the
-       // panic values.
-       //
-       // Dropping the m is going to clear g. This function is being
-       // called as a deferred function, so we will return to
-       // deferreturn which will want to clear the _defer field.
-       // As soon as we call dropm another thread may call needm and
-       // start using g, so we must not tamper with the _defer field
-       // after dropm. So clear _defer now.
+       // We are going to stop running in Go mode and return to C mode.
+       // We were almost certainly called by defer; if so, clean up
+       // the defer struct now, before we leave Go mode. But don't
+       // leave Go mode if we are panicing or called from Goexit,
+       // since in those cases we will continue executing deferred functions.
        gp := getg()
        mp := gp.m
        drop := false
-       if mp.dropextram && mp.ncgo == 0 && gp._panic == nil {
+       if gp.deferring && gp._panic == nil && !gp.goexiting {
                d := gp._defer
-               if d == nil || d.link != nil {
-                       throw("unexpected g._defer in CgocallBackDone")
+               if d == nil {
+                       throw("no defer struct when deferring")
                }
-               gp._defer = nil
+               gp._defer = d.link
                freedefer(d)
-               drop = true
+
+               // If we are the top level Go function called from C,
+               // then we need to release the m.
+               if mp.dropextram && mp.ncgo == 0 {
+                       drop = true
+               }
        }
 
-       gp.m.incgo = true
-       entersyscall()
+       // Don't go back to C mode if we are panicing. Just let the
+       // panic walk up through the Go stack.
+       if gp._panic == nil && !gp.goexiting {
+               gp.m.incgo = true
+               entersyscall()
+       }
 
        if drop {
                mp.dropextram = false
                dropm()
+       } else if gp.deferring && gp._panic == nil && !gp.goexiting {
+               gp.ranCgocallBackDone = true
        }
 }
 
Index: libgo/go/runtime/panic.go
===================================================================
--- libgo/go/runtime/panic.go   (revision 268078)
+++ libgo/go/runtime/panic.go   (working copy)
@@ -54,7 +54,7 @@ var indexError = error(errorString("inde
 
 func panicindex() {
        name, _, _ := funcfileline(getcallerpc(), -1)
-       if hasprefix(name, "runtime.") {
+       if hasPrefix(name, "runtime.") {
                throw(string(indexError.(errorString)))
        }
        panicCheckMalloc(indexError)
@@ -65,7 +65,7 @@ var sliceError = error(errorString("slic
 
 func panicslice() {
        name, _, _ := funcfileline(getcallerpc(), -1)
-       if hasprefix(name, "runtime.") {
+       if hasPrefix(name, "runtime.") {
                throw(string(sliceError.(errorString)))
        }
        panicCheckMalloc(sliceError)
@@ -151,6 +151,14 @@ func newdefer() *_defer {
                systemstack(func() {
                        d = new(_defer)
                })
+               if debugCachedWork {
+                       // Duplicate the tail below so if there's a
+                       // crash in checkPut we can tell if d was just
+                       // allocated or came from the pool.
+                       d.link = gp._defer
+                       gp._defer = d
+                       return d
+               }
        }
        d.link = gp._defer
        gp._defer = d
@@ -242,17 +250,22 @@ func deferreturn(frame *bool) {
                        // code in jmpdefer.
                        var fn func(unsafe.Pointer)
                        *(*uintptr)(unsafe.Pointer(&fn)) = 
uintptr(noescape(unsafe.Pointer(&pfn)))
+                       gp.deferring = true
                        fn(d.arg)
+                       gp.deferring = false
                }
 
-               // If we are returning from a Go function called by a
-               // C function running in a C thread, g may now be nil,
-               // in which case CgocallBackDone will have cleared _defer.
-               // In that case some other goroutine may already be using gp.
+               // If that was CgocallBackDone, it will have freed the
+               // defer for us, since we are no longer running as Go code.
                if getg() == nil {
                        *frame = true
                        return
                }
+               if gp.ranCgocallBackDone {
+                       gp.ranCgocallBackDone = false
+                       *frame = true
+                       return
+               }
 
                gp._defer = d.link
 
@@ -316,7 +329,9 @@ func checkdefer(frame *bool) {
 
                        var fn func(unsafe.Pointer)
                        *(*uintptr)(unsafe.Pointer(&fn)) = 
uintptr(noescape(unsafe.Pointer(&pfn)))
+                       gp.deferring = true
                        fn(d.arg)
+                       gp.deferring = false
 
                        freedefer(d)
 
@@ -389,6 +404,7 @@ func Goexit() {
        // This code is similar to gopanic, see that implementation
        // for detailed comments.
        gp := getg()
+       gp.goexiting = true
        for {
                d := gp._defer
                if d == nil {
@@ -409,7 +425,9 @@ func Goexit() {
 
                var fn func(unsafe.Pointer)
                *(*uintptr)(unsafe.Pointer(&fn)) = 
uintptr(noescape(unsafe.Pointer(&pfn)))
+               gp.deferring = true
                fn(d.arg)
+               gp.deferring = false
 
                if gp._defer != d {
                        throw("bad defer entry in Goexit")
@@ -419,6 +437,7 @@ func Goexit() {
                freedefer(d)
                // Note: we ignore recovers here because Goexit isn't a panic
        }
+       gp.goexiting = false
        goexit1()
 }
 
@@ -532,7 +551,9 @@ func gopanic(e interface{}) {
 
                var fn func(unsafe.Pointer)
                *(*uintptr)(unsafe.Pointer(&fn)) = 
uintptr(noescape(unsafe.Pointer(&pfn)))
+               gp.deferring = true
                fn(d.arg)
+               gp.deferring = false
 
                if gp._defer != d {
                        throw("bad defer entry in panic")
@@ -649,7 +670,7 @@ func canrecover(retaddr uintptr) bool {
        }
 
        name := locs[1].function
-       if hasprefix(name, "runtime.") {
+       if hasPrefix(name, "runtime.") {
                return true
        }
 
@@ -676,7 +697,7 @@ func canrecover(retaddr uintptr) bool {
                }
 
                // Ignore function in libffi.
-               if hasprefix(name, "ffi_") {
+               if hasPrefix(name, "ffi_") {
                        continue
                }
 
@@ -690,7 +711,7 @@ func canrecover(retaddr uintptr) bool {
                }
 
                // Ignore other functions in the reflect package.
-               if hasprefix(name, "reflect.") || hasprefix(name, ".1reflect.") 
{
+               if hasPrefix(name, "reflect.") || hasPrefix(name, ".1reflect.") 
{
                        continue
                }
 
@@ -700,7 +721,7 @@ func canrecover(retaddr uintptr) bool {
 
        if i < n {
                name = locs[i].function
-               if hasprefix(name, "runtime.") {
+               if hasPrefix(name, "runtime.") {
                        return true
                }
        }
@@ -734,7 +755,7 @@ func makefuncfficanrecover(loc []locatio
        }
 
        name := loc[1].function
-       if hasprefix(name, "runtime.") {
+       if hasPrefix(name, "runtime.") {
                d.makefunccanrecover = true
        }
 }
@@ -935,10 +956,13 @@ func fatalpanic(msgs *_panic) {
 // It returns true if panic messages should be printed, or false if
 // the runtime is in bad shape and should just print stacks.
 //
-// It can have write barriers because the write barrier explicitly
-// ignores writes once dying > 0.
+// It must not have write barriers even though the write barrier
+// explicitly ignores writes once dying > 0. Write barriers still
+// assume that g.m.p != nil, and this function may not have P
+// in some contexts (e.g. a panic in a signal handler for a signal
+// sent to an M with no P).
 //
-//go:yeswritebarrierrec
+//go:nowritebarrierrec
 func startpanic_m() bool {
        _g_ := getg()
        if mheap_.cachealloc.size == 0 { // very early
@@ -958,8 +982,8 @@ func startpanic_m() bool {
 
        switch _g_.m.dying {
        case 0:
+               // Setting dying >0 has the side-effect of disabling this G's 
writebuf.
                _g_.m.dying = 1
-               _g_.writebuf = nil
                atomic.Xadd(&panicking, 1)
                lock(&paniclk)
                if debug.schedtrace > 0 || debug.scheddetail > 0 {
@@ -1061,7 +1085,7 @@ func canpanic(gp *g) bool {
        return true
 }
 
-// isAbortPC returns true if pc is the program counter at which
+// isAbortPC reports whether pc is the program counter at which
 // runtime.abort raises a signal.
 //
 // It is nosplit because it's part of the isgoexception
Index: libgo/gotool-packages.txt
===================================================================
--- libgo/gotool-packages.txt   (revision 268078)
+++ libgo/gotool-packages.txt   (working copy)
@@ -15,6 +15,8 @@ cmd/go/internal/help
 cmd/go/internal/imports
 cmd/go/internal/list
 cmd/go/internal/load
+cmd/go/internal/lockedfile
+cmd/go/internal/lockedfile/internal/filelock
 cmd/go/internal/modcmd
 cmd/go/internal/modconv
 cmd/go/internal/modfetch
@@ -26,6 +28,7 @@ cmd/go/internal/modload
 cmd/go/internal/module
 cmd/go/internal/mvs
 cmd/go/internal/par
+cmd/go/internal/renameio
 cmd/go/internal/run
 cmd/go/internal/search
 cmd/go/internal/semver
@@ -43,6 +46,39 @@ cmd/internal/browser
 cmd/internal/buildid
 cmd/internal/edit
 cmd/internal/objabi
+cmd/internal/sys
 cmd/internal/test2json
-cmd/vet/internal/cfg
-cmd/vet/internal/whitelist
+golang.org/x/tools/go/analysis
+golang.org/x/tools/go/analysis/internal/analysisflags
+golang.org/x/tools/go/analysis/internal/facts
+golang.org/x/tools/go/analysis/passes/asmdecl
+golang.org/x/tools/go/analysis/passes/assign
+golang.org/x/tools/go/analysis/passes/atomic
+golang.org/x/tools/go/analysis/passes/bools
+golang.org/x/tools/go/analysis/passes/buildtag
+golang.org/x/tools/go/analysis/passes/cgocall
+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/httpresponse
+golang.org/x/tools/go/analysis/passes/inspect
+golang.org/x/tools/go/analysis/passes/internal/analysisutil
+golang.org/x/tools/go/analysis/passes/loopclosure
+golang.org/x/tools/go/analysis/passes/lostcancel
+golang.org/x/tools/go/analysis/passes/nilfunc
+golang.org/x/tools/go/analysis/passes/pkgfact
+golang.org/x/tools/go/analysis/passes/printf
+golang.org/x/tools/go/analysis/passes/shift
+golang.org/x/tools/go/analysis/passes/stdmethods
+golang.org/x/tools/go/analysis/passes/structtag
+golang.org/x/tools/go/analysis/passes/tests
+golang.org/x/tools/go/analysis/passes/unmarshal
+golang.org/x/tools/go/analysis/passes/unreachable
+golang.org/x/tools/go/analysis/passes/unsafeptr
+golang.org/x/tools/go/analysis/passes/unusedresult
+golang.org/x/tools/go/analysis/unitchecker
+golang.org/x/tools/go/ast/astutil
+golang.org/x/tools/go/ast/inspector
+golang.org/x/tools/go/cfg
+golang.org/x/tools/go/types/objectpath
+golang.org/x/tools/go/types/typeutil
Index: libgo/libgo-packages.txt
===================================================================
--- libgo/libgo-packages.txt    (revision 268078)
+++ libgo/libgo-packages.txt    (working copy)
@@ -40,7 +40,6 @@ debug/gosym
 debug/macho
 debug/pe
 debug/plan9obj
-debug/xcoff
 encoding
 encoding/ascii85
 encoding/asn1
@@ -71,27 +70,6 @@ go/printer
 go/scanner
 go/token
 go/types
-golang_org/x/crypto/internal/chacha20
-golang_org/x/crypto/chacha20poly1305
-golang_org/x/crypto/chacha20poly1305/internal/chacha20
-golang_org/x/crypto/cryptobyte
-golang_org/x/crypto/cryptobyte/asn1
-golang_org/x/crypto/curve25519
-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/internal/nettest
-golang_org/x/net/lex/httplex
-golang_org/x/net/nettest
-golang_org/x/net/proxy
-golang_org/x/text/secure/bidirule
-golang_org/x/text/transform
-golang_org/x/text/unicode/bidi
-golang_org/x/text/unicode/norm
-golang_org/x/text/width
 hash
 hash/adler32
 hash/crc32
@@ -110,6 +88,7 @@ image/png
 index/suffixarray
 internal/bytealg
 internal/cpu
+internal/fmtsort
 internal/goroot
 internal/nettrace
 internal/poll
@@ -119,6 +98,25 @@ 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
 log
@@ -161,6 +159,7 @@ regexp/syntax
 runtime
 runtime/debug
 runtime/internal/atomic
+runtime/internal/math
 runtime/internal/sys
 runtime/pprof
 runtime/pprof/internal/profile
Index: libgo/match.sh
===================================================================
--- libgo/match.sh      (revision 268078)
+++ libgo/match.sh      (working copy)
@@ -113,7 +113,7 @@ for f in $gofiles; do
        "") ;;
        $goarch) ;;
        $goos) ;;
-       aix | android | darwin | dragonfly | freebsd | linux | nacl | netbsd | 
openbsd | plan9 | solaris | windows)
+       aix | android | darwin | dragonfly | freebsd | hurd | js | linux | nacl 
| netbsd | openbsd | plan9 | solaris | windows)
            tag1=nonmatchingtag
            ;;
        386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | 
m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | nios2 | 
ppc | ppc64 | ppc64le | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64 | 
wasm)
@@ -125,7 +125,7 @@ for f in $gofiles; do
        "") ;;
        $goarch) ;;
        $goos) ;;
-       aix | android | darwin | dragonfly | freebsd | linux | nacl | netbsd | 
openbsd | plan9 | solaris | windows)
+       aix | android | darwin | dragonfly | freebsd | hurd | js | linux | nacl 
| netbsd | openbsd | plan9 | solaris | windows)
            tag2=nonmatchingtag
            ;;
        386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | ia64 | 
m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | nios2 | 
ppc | ppc64 | ppc64le | riscv64 | s390 | s390x | sh | shbe | sparc | sparc64 | 
wasm)
Index: libgo/merge.sh
===================================================================
--- libgo/merge.sh      (revision 268078)
+++ libgo/merge.sh      (working copy)
@@ -128,7 +128,7 @@ echo ${rev} > VERSION
 (cd ${NEWDIR}/src && find . -name '*.go' -print) | while read f; do
   skip=false
   case "$f" in
-  ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | 
./cmd/testjson/* | ./cmd/vet/* | ./cmd/internal/browser/* | 
./cmd/internal/buildid/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | 
./cmd/internal/testj2on/* )
+  ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | 
./cmd/testjson/* | ./cmd/vet/* | ./cmd/internal/browser/* | 
./cmd/internal/buildid/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | 
./cmd/internal/testj2on/* | ./cmd/internal/sys/* | 
./cmd/vendor/golang.org/x/tools/* )
     ;;
   ./cmd/*)
     skip=true
@@ -143,14 +143,14 @@ echo ${rev} > VERSION
 
   oldfile=${OLDDIR}/src/$f
   newfile=${NEWDIR}/src/$f
-  libgofile=go/`echo $f | sed -e 's|/vendor/|/|'`
+  libgofile=go/`echo $f | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
   merge $f ${oldfile} ${newfile} ${libgofile}
 done
 
 (cd ${NEWDIR}/src && find . -name testdata -print) | while read d; do
   skip=false
   case "$d" in
-  ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | ./cmd/internal/browser/*)
+  ./cmd/buildid/* | ./cmd/cgo/* | ./cmd/go/* | ./cmd/gofmt/* | 
./cmd/testjson/* | ./cmd/vet/* | ./cmd/internal/browser/* | 
./cmd/internal/buildid/* | ./cmd/internal/edit/* | ./cmd/internal/objabi/* | 
./cmd/internal/testj2on/* | ./cmd/internal/sys/* | 
./cmd/vendor/golang.org/x/tools/* )
     ;;
   ./cmd/*)
     skip=true
@@ -165,7 +165,7 @@ done
 
   oldtd=${OLDDIR}/src/$d
   newtd=${NEWDIR}/src/$d
-  libgotd=go/$d
+  libgofile=go/`echo $d | sed -e 's|cmd/vendor/|/|' | sed -e 's|/vendor/|/|'`
   if ! test -d ${oldtd}; then
     echo "merge.sh: $d: NEWDIR"
     continue
Index: libgo/runtime/runtime.h
===================================================================
--- libgo/runtime/runtime.h     (revision 268078)
+++ libgo/runtime/runtime.h     (working copy)
@@ -394,7 +394,7 @@ void __wrap_rtems_task_variable_add(void
  */
 void reflect_call(const struct __go_func_type *, FuncVal *, _Bool, _Bool,
                  void **, void **)
-  __asm__ (GOSYM_PREFIX "reflect.call");
+  __asm__ (GOSYM_PREFIX "runtime.reflectcall");
 void runtime_panic(Eface)
   __asm__ (GOSYM_PREFIX "runtime.gopanic");
 void runtime_panic(Eface)
Index: libgo/testsuite/gotest
===================================================================
--- libgo/testsuite/gotest      (revision 268078)
+++ libgo/testsuite/gotest      (working copy)
@@ -311,7 +311,7 @@ x)
            "") ;;
            $goarch) ;;
            $goos) ;;
-           aix | android | darwin | dragonfly | freebsd | linux | nacl | 
netbsd | openbsd | plan9 | solaris | windows)
+           aix | android | darwin | dragonfly | freebsd | hurd | js | linux | 
nacl | netbsd | openbsd | plan9 | solaris | windows)
                tag1=nonmatchingtag
                ;;
            386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | 
ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le·| 
nios2 | ppc | ppc64 | ppc64le | riscv64 | s390 | s390x | sh | shbe | sparc | 
sparc64 | wasm)
@@ -323,7 +323,7 @@ x)
            "") ;;
            $goarch) ;;
            $goos) ;;
-           aix | android | darwin | dragonfly | freebsd | linux | nacl | 
netbsd | openbsd | plan9 | solaris | windows)
+           aix | android | darwin | dragonfly | freebsd | hurd | js | linux | 
nacl | netbsd | openbsd | plan9 | solaris | windows)
                tag2=nonmatchingtag
                ;;
            386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | 
ia64 | m68k | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le·| 
nios2 | ppc | ppc64 | ppc64le | riscv64 | s390 | s390x | sh | shbe | sparc | 
sparc64 | wasm)

Reply via email to