This patch updates libgo to the Go 1.8.3 release.  This is a fairly
minor patch for a minor release.  Bootstrapped and ran Go tests on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 249029)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-81d9f6d05c2bb92b2b3af02807713b6bed9bf053
+82961ce59e8bb02598d963d2a05b3acca860d9dd
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/MERGE
===================================================================
--- libgo/MERGE (revision 249028)
+++ libgo/MERGE (working copy)
@@ -1,4 +1,4 @@
-a4c18f063b6659079ca2848ca217a0587dabc001
+352996a381701cfa0c16e8de29cbde8f3922182f
 
 The first line of this file holds the git revision number of the
 last merge done from the master library sources.
Index: libgo/VERSION
===================================================================
--- libgo/VERSION       (revision 249028)
+++ libgo/VERSION       (working copy)
@@ -1 +1 @@
-go1.8.1
+go1.8.3
Index: libgo/go/cmd/go/build.go
===================================================================
--- libgo/go/cmd/go/build.go    (revision 249028)
+++ libgo/go/cmd/go/build.go    (working copy)
@@ -3133,6 +3133,26 @@ func (b *builder) ccompile(p *Package, o
        desc := p.ImportPath
        output, err := b.runOut(p.Dir, desc, nil, compiler, flags, "-o", 
outfile, "-c", file)
        if len(output) > 0 {
+               // On FreeBSD 11, when we pass -g to clang 3.8 it
+               // invokes its internal assembler with -dwarf-version=2.
+               // When it sees .section .note.GNU-stack, it warns
+               // "DWARF2 only supports one section per compilation unit".
+               // This warning makes no sense, since the section is empty,
+               // but it confuses people.
+               // We work around the problem by detecting the warning
+               // and dropping -g and trying again.
+               if bytes.Contains(output, []byte("DWARF2 only supports one 
section per compilation unit")) {
+                       newFlags := make([]string, 0, len(flags))
+                       for _, f := range flags {
+                               if !strings.HasPrefix(f, "-g") {
+                                       newFlags = append(newFlags, f)
+                               }
+                       }
+                       if len(newFlags) < len(flags) {
+                               return b.ccompile(p, outfile, newFlags, file, 
compiler)
+                       }
+               }
+
                b.showOutput(p.Dir, desc, b.processOutput(output))
                if err != nil {
                        err = errPrintedOutput
Index: libgo/go/crypto/elliptic/elliptic_test.go
===================================================================
--- libgo/go/crypto/elliptic/elliptic_test.go   (revision 249028)
+++ libgo/go/crypto/elliptic/elliptic_test.go   (working copy)
@@ -300,6 +300,29 @@ var p224BaseMultTests = []baseMultTest{
        },
 }
 
+type scalarMultTest struct {
+       k          string
+       xIn, yIn   string
+       xOut, yOut string
+}
+
+var p256MultTests = []scalarMultTest{
+       {
+               
"2a265f8bcbdcaf94d58519141e578124cb40d64a501fba9c11847b28965bc737",
+               
"023819813ac969847059028ea88a1f30dfbcde03fc791d3a252c6b41211882ea",
+               
"f93e4ae433cc12cf2a43fc0ef26400c0e125508224cdb649380f25479148a4ad",
+               
"4d4de80f1534850d261075997e3049321a0864082d24a917863366c0724f5ae3",
+               
"a22d2b7f7818a3563e0f7a76c9bf0921ac55e06e2e4d11795b233824b1db8cc0",
+       },
+       {
+               
"313f72ff9fe811bf573176231b286a3bdb6f1b14e05c40146590727a71c3bccd",
+               
"cc11887b2d66cbae8f4d306627192522932146b42f01d3c6f92bd5c8ba739b06",
+               
"a2f08a029cd06b46183085bae9248b0ed15b70280c7ef13a457f5af382426031",
+               
"831c3f6b5f762d2f461901577af41354ac5f228c2591f84f8a6e51e2e3f17991",
+               
"93f90934cd0ef2c698cc471c60a93524e87ab31ca2412252337f364513e43684",
+       },
+}
+
 func TestBaseMult(t *testing.T) {
        p224 := P224()
        for i, e := range p224BaseMultTests {
@@ -379,6 +402,19 @@ func TestP256Mult(t *testing.T) {
                        break
                }
        }
+
+       for i, e := range p256MultTests {
+               x, _ := new(big.Int).SetString(e.xIn, 16)
+               y, _ := new(big.Int).SetString(e.yIn, 16)
+               k, _ := new(big.Int).SetString(e.k, 16)
+               expectedX, _ := new(big.Int).SetString(e.xOut, 16)
+               expectedY, _ := new(big.Int).SetString(e.yOut, 16)
+
+               xx, yy := p256.ScalarMult(x, y, k.Bytes())
+               if xx.Cmp(expectedX) != 0 || yy.Cmp(expectedY) != 0 {
+                       t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, xx, yy, 
expectedX, expectedY)
+               }
+       }
 }
 
 func TestInfinity(t *testing.T) {
Index: libgo/go/database/sql/sql.go
===================================================================
--- libgo/go/database/sql/sql.go        (revision 249028)
+++ libgo/go/database/sql/sql.go        (working copy)
@@ -1955,12 +1955,12 @@ func (s *Stmt) QueryContext(ctx context.
                                rowsi: rowsi,
                                // releaseConn set below
                        }
-                       rows.initContextClose(ctx)
                        s.db.addDep(s, rows)
                        rows.releaseConn = func(err error) {
                                releaseConn(err)
                                s.db.removeDep(s, rows)
                        }
+                       rows.initContextClose(ctx)
                        return rows, nil
                }
 
Index: libgo/go/database/sql/sql_test.go
===================================================================
--- libgo/go/database/sql/sql_test.go   (revision 249028)
+++ libgo/go/database/sql/sql_test.go   (working copy)
@@ -322,7 +322,7 @@ func TestQueryContext(t *testing.T) {
        select {
        case <-ctx.Done():
                if err := ctx.Err(); err != context.Canceled {
-                       t.Fatalf("context err = %v; want context.Canceled")
+                       t.Fatalf("context err = %v; want context.Canceled", 
ctx.Err())
                }
        default:
                t.Fatalf("context err = nil; want context.Canceled")
@@ -413,7 +413,8 @@ func TestTxContextWait(t *testing.T) {
        db := newTestDB(t, "people")
        defer closeDB(t, db)
 
-       ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
+       ctx, cancel := context.WithTimeout(context.Background(), 
time.Millisecond*15)
+       defer cancel()
 
        tx, err := db.BeginTx(ctx, nil)
        if err != nil {
Index: libgo/go/net/http/h2_bundle.go
===================================================================
--- libgo/go/net/http/h2_bundle.go      (revision 249028)
+++ libgo/go/net/http/h2_bundle.go      (working copy)
@@ -1,4 +1,4 @@
-// Code generated by golang.org/x/tools/cmd/bundle.
+// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
 //go:generate bundle -o h2_bundle.go -prefix http2 -underscore 
golang.org/x/net/http2
 
 // Package http2 implements the HTTP/2 protocol.
@@ -3536,9 +3536,13 @@ func (sc *http2serverConn) serve() {
                sc.idleTimerCh = sc.idleTimer.C
        }
 
-       var gracefulShutdownCh <-chan struct{}
+       var gracefulShutdownCh chan struct{}
        if sc.hs != nil {
-               gracefulShutdownCh = http2h1ServerShutdownChan(sc.hs)
+               ch := http2h1ServerShutdownChan(sc.hs)
+               if ch != nil {
+                       gracefulShutdownCh = make(chan struct{})
+                       go sc.awaitGracefulShutdown(ch, gracefulShutdownCh)
+               }
        }
 
        go sc.readFrames()
@@ -3587,6 +3591,14 @@ func (sc *http2serverConn) serve() {
        }
 }
 
+func (sc *http2serverConn) awaitGracefulShutdown(sharedCh <-chan struct{}, 
privateCh chan struct{}) {
+       select {
+       case <-sc.doneServing:
+       case <-sharedCh:
+               close(privateCh)
+       }
+}
+
 // readPreface reads the ClientPreface greeting from the peer
 // or returns an error on timeout or an invalid greeting.
 func (sc *http2serverConn) readPreface() error {
@@ -6003,7 +6015,6 @@ func http2commaSeparatedTrailers(req *Re
        }
        if len(keys) > 0 {
                sort.Strings(keys)
-
                return strings.Join(keys, ","), nil
        }
        return "", nil
Index: libgo/go/runtime/malloc.go
===================================================================
--- libgo/go/runtime/malloc.go  (revision 249028)
+++ libgo/go/runtime/malloc.go  (working copy)
@@ -412,10 +412,12 @@ func (h *mheap) sysAlloc(n uintptr) unsa
                        if p == 0 {
                                return nil
                        }
+                       // p can be just about anywhere in the address
+                       // space, including before arena_end.
                        if p == h.arena_end {
                                h.arena_end = new_end
                                h.arena_reserved = reserved
-                       } else if h.arena_start <= p && 
p+p_size-h.arena_start-1 <= _MaxArena32 {
+                       } else if h.arena_end < p && p+p_size-h.arena_start-1 
<= _MaxArena32 {
                                // Keep everything page-aligned.
                                // Our pages are bigger than hardware pages.
                                h.arena_end = p + p_size
@@ -425,6 +427,16 @@ func (h *mheap) sysAlloc(n uintptr) unsa
                                h.arena_used = used
                                h.arena_reserved = reserved
                        } else {
+                               // We got a mapping, but it's not
+                               // linear with our current arena, so
+                               // we can't use it.
+                               //
+                               // TODO: Make it possible to allocate
+                               // from this. We can't decrease
+                               // arena_used, but we could introduce
+                               // a new variable for the current
+                               // allocation position.
+
                                // We haven't added this allocation to
                                // the stats, so subtract it from a
                                // fake stat (but avoid underflow).
Index: libgo/go/runtime/mbitmap.go
===================================================================
--- libgo/go/runtime/mbitmap.go (revision 249028)
+++ libgo/go/runtime/mbitmap.go (working copy)
@@ -374,6 +374,7 @@ func heapBitsForAddr(addr uintptr) heapB
 // heapBitsForSpan returns the heapBits for the span base address base.
 func heapBitsForSpan(base uintptr) (hbits heapBits) {
        if base < mheap_.arena_start || base >= mheap_.arena_used {
+               print("runtime: base ", hex(base), " not in range [", 
hex(mheap_.arena_start), ",", hex(mheap_.arena_used), ")\n")
                throw("heapBitsForSpan: base out of range")
        }
        return heapBitsForAddr(base)
Index: libgo/go/runtime/mgc.go
===================================================================
--- libgo/go/runtime/mgc.go     (revision 249028)
+++ libgo/go/runtime/mgc.go     (working copy)
@@ -1908,7 +1908,7 @@ func gchelper() {
                traceGCScanDone()
        }
 
-       nproc := work.nproc // work.nproc can change right after we increment 
work.ndone
+       nproc := atomic.Load(&work.nproc) // work.nproc can change right after 
we increment work.ndone
        if atomic.Xadd(&work.ndone, +1) == nproc-1 {
                notewakeup(&work.alldone)
        }

Reply via email to