]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
8 years agogo/types: rename Importer2 to ImporterFrom go1.6beta2
Brad Fitzpatrick [Wed, 13 Jan 2016 23:20:20 +0000 (23:20 +0000)]
go/types: rename Importer2 to ImporterFrom

Per https://groups.google.com/forum/#!topic/golang-dev/javNmryAh0I

Change-Id: I08d7cbc94da4fc61c848f3dbee4637bf8fcfeb01
Reviewed-on: https://go-review.googlesource.com/18630
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agoruntime: don't use CMOV for 386
Keith Randall [Wed, 13 Jan 2016 21:09:46 +0000 (13:09 -0800)]
runtime: don't use CMOV for 386

CMOVs were not introduced until P6.  We need 386 to run on
Pentium MMX.

Fixes #13923

Change-Id: Iee9572cd83e64c3a1336bc1e6b300b048fbcc996
Reviewed-on: https://go-review.googlesource.com/18621
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agonet/http: update bundled http2
Brad Fitzpatrick [Wed, 13 Jan 2016 22:14:40 +0000 (22:14 +0000)]
net/http: update bundled http2

Updates x/net/http2 to git rev 341cd08 for https://golang.org/cl/18576

Change-Id: If5dcb60ac449b798c34fe332ede5ec74e66eb9db
Reviewed-on: https://go-review.googlesource.com/18579
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agonet/http: clarify ConnState StateActive docs for HTTP/2
Brad Fitzpatrick [Wed, 13 Jan 2016 19:36:51 +0000 (19:36 +0000)]
net/http: clarify ConnState StateActive docs for HTTP/2

Update #13925

Change-Id: I7cd0625fad841eb0e3f364629f9bc225aa2fdce9
Reviewed-on: https://go-review.googlesource.com/18575
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agogo/importer: fix field/method package for binary importer
Robert Griesemer [Wed, 13 Jan 2016 18:52:56 +0000 (10:52 -0800)]
go/importer: fix field/method package for binary importer

This is the equivalent of https://golang.org/cl/18549 for
the binary importer (which is usually not used because by
default the gc compiler produces the traditional textual
export format).

For #13898.

Change-Id: Idb6b515f2ee49e6d0362c71846994b0bd4dae8f7
Reviewed-on: https://go-review.googlesource.com/18598
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>

8 years agocmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0
Ian Lance Taylor [Wed, 13 Jan 2016 18:45:54 +0000 (10:45 -0800)]
cmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0

GCC 4.8 exits 1 on an unrecognized option, but GCC 4.4 and 4.5 exit 0.
I didn't check other versions, or try to figure out just when this
changed.

Fixes #13937.

Change-Id: If193e9053fbb535999c9bde99f430f465a8c7c57
Reviewed-on: https://go-review.googlesource.com/18597
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agogo/importer: revert incorrect change that slipped in prior CL
Robert Griesemer [Wed, 13 Jan 2016 18:41:37 +0000 (10:41 -0800)]
go/importer: revert incorrect change that slipped in prior CL

The package of anonymous fields is the package in which they were
declared, not the package of the anonymous field's type. Was correct
before and incorrectly changed with https://golang.org/cl/18549.

Change-Id: I9fd5bfbe9d0498c8733b6ca7b134a85defe16113
Reviewed-on: https://go-review.googlesource.com/18596
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocmd/link: add LC_VERSION_MIN_MACOSX to linkmode=internal OS X binaries
Russ Cox [Wed, 13 Jan 2016 14:59:16 +0000 (09:59 -0500)]
cmd/link: add LC_VERSION_MIN_MACOSX to linkmode=internal OS X binaries

This makes lldb willing to debug them.
The minimum version is hard-coded at OS X 10.7,
because that is the minimum that Go requires.
For more control over the version, users can
use linkmode=external and pass the relevant flags to the host linker.

Fixes #12941.

Change-Id: I20027be8aa034d07dd2a3326828f75170afe905f
Reviewed-on: https://go-review.googlesource.com/18588
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: allow for C pointers between arena_start and arena_used in cgo check
Russ Cox [Wed, 13 Jan 2016 17:23:44 +0000 (12:23 -0500)]
runtime: allow for C pointers between arena_start and arena_used in cgo check

Fixes #13928.

Change-Id: Ia04c6bdef5ae6924d03982682ee195048f8f387f
Reviewed-on: https://go-review.googlesource.com/18611
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: arrange to show a few local variables when cgoCheckUnknownPointer panics
Russ Cox [Wed, 13 Jan 2016 17:45:52 +0000 (12:45 -0500)]
runtime: arrange to show a few local variables when cgoCheckUnknownPointer panics

For #13934.

Change-Id: Id399e35598def96f8bb89b9fcd1bf14ee06e2e62
Reviewed-on: https://go-review.googlesource.com/18612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agogo/importer: associate exported field and interface methods with correct package
Robert Griesemer [Wed, 13 Jan 2016 01:02:32 +0000 (17:02 -0800)]
go/importer: associate exported field and interface methods with correct package

In gc export data, exported struct field and interface method names appear
in unqualified form (i.e., w/o package name). The (gc)importer assumed that
unqualified exported names automatically belong to the package being imported.
This is not the case if the field or method belongs to a struct or interface
that was declared in another package and re-exported.

The issue becomes visible if a type T (say an interface with a method M)
is declared in a package A, indirectly re-exported by a package B (which
imports A), and then imported in C. If C imports both A and B, if A is
imported before B, T.M gets associated with the correct package A. If B
is imported before A, T.M appears to be exported by B (even though T itself
is correctly marked as coming from A). If T.M is imported again via the
import of A if gets dropped (as it should) because it was imported already.

The fix is to pass down the parent package when we parse imported types
so that the importer can use the correct package when creating fields
and methods.

Fixes #13898.

Change-Id: I7ec2ee2dda15859c582b65db221c3841899776e1
Reviewed-on: https://go-review.googlesource.com/18549
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agocmd/go: -buildmode=c-shared should work on darwin/386
Joe Sylve [Mon, 11 Jan 2016 05:23:51 +0000 (23:23 -0600)]
cmd/go: -buildmode=c-shared should work on darwin/386

* Enable c-shared buildmode on darwin/386
* dyld does not support text relocation on i386. Add -read_only_relocs suppress flag to linker

Fixes #13904

Change-Id: I9adbd20d3f36ce9bbccf1bffb746b391780d088f
Reviewed-on: https://go-review.googlesource.com/18500
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http: update bundled http2
Brad Fitzpatrick [Wed, 13 Jan 2016 17:53:57 +0000 (17:53 +0000)]
net/http: update bundled http2

Updates x/net/http2 to git rev c93a9b4f2a for https://golang.org/cl/18474

Forgot to submit this four days ago.

Change-Id: Id96ab164ec765911c31874cca39b44aa55e80153
Reviewed-on: https://go-review.googlesource.com/18574
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agodatabase/sql/driver: clarify DefaultParameterConverter docs
Brad Fitzpatrick [Mon, 11 Jan 2016 19:54:29 +0000 (11:54 -0800)]
database/sql/driver: clarify DefaultParameterConverter docs

Fixes #11489

Change-Id: I887ebac2dcb772e73ee393891c487f694028aaf2
Reviewed-on: https://go-review.googlesource.com/18520
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http: fix Transport crash when abandoning dial which upgrades protos
Brad Fitzpatrick [Wed, 13 Jan 2016 16:30:00 +0000 (16:30 +0000)]
net/http: fix Transport crash when abandoning dial which upgrades protos

When the Transport was creating an bound HTTP connection (protocol
unknown initially) and then ends up deciding it doesn't need it, a
goroutine sits around to clean up whatever the result was. That
goroutine made the false assumption that the result was always an
HTTP/1 connection or an error. It may also be an alternate protocol
in which case the *persistConn.conn net.Conn field is nil, and the
alt field is non-nil.

Fixes #13839

Change-Id: Ia4972e5eb1ad53fa00410b3466d4129c753e0871
Reviewed-on: https://go-review.googlesource.com/18573
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodoc: document Go 1.5.3
Russ Cox [Wed, 13 Jan 2016 11:52:27 +0000 (06:52 -0500)]
doc: document Go 1.5.3

Change-Id: I9b4b76abfba66ff655aef55b43d9b4721aba604a
Reviewed-on: https://go-review.googlesource.com/18587
Reviewed-by: Chris Broadfoot <cbro@golang.org>
8 years agonet/http: reject non three digit status codes in ReadResponse
Emmanuel Odeke [Mon, 11 Jan 2016 06:20:06 +0000 (23:20 -0700)]
net/http: reject non three digit status codes in ReadResponse

Change-Id: If4a90c4017ef4b5c9f497cf117c8ad62b7e15c62
Reviewed-on: https://go-review.googlesource.com/18501
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: stop using fucomi* ops for 387 builds
Keith Randall [Tue, 12 Jan 2016 20:42:28 +0000 (12:42 -0800)]
cmd/compile: stop using fucomi* ops for 387 builds

The fucomi* opcodes were only introduced for the Pentium Pro.
They do not exist for an MMX Pentium.  Use the fucom* instructions
instead and move the condition codes from the fp flags register to
the integer flags register explicitly.

The use of fucomi* opcodes in ggen.go was introduced in 1.5 (CL 8738).
The bad ops were generated for 64-bit floating-point comparisons.

The use of fucomi* opcodes in gsubr.go dates back to at least 1.1.
The bad ops were generated for float{32,64} to uint64 conversions.

Fixes #13923

Change-Id: I5290599f5edea8abf8fb18036f44fa78bd1fc9e6
Reviewed-on: https://go-review.googlesource.com/18590
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: fixes for -compiler=gccgo -buildmode=c-shared
Ian Lance Taylor [Wed, 13 Jan 2016 05:24:49 +0000 (21:24 -0800)]
cmd/go: fixes for -compiler=gccgo -buildmode=c-shared

Install pkg.h rather than libpkg.h.

Link against -lc.

Fixes #13860.

Change-Id: I4e429426f8363712a5dbbd2655b9aab802ab2888
Reviewed-on: https://go-review.googlesource.com/18592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/internal/obj/x86: add new instructions, cleanup.
Ilya Tocar [Wed, 13 Jan 2016 13:43:22 +0000 (16:43 +0300)]
cmd/internal/obj/x86: add new instructions, cleanup.

Add several instructions that were used via BYTE and use them.
Instructions added: PEXTRB, PEXTRD, PEXTRQ, PINSRB, XGETBV, POPCNT.

Change-Id: I5a80cd390dc01f3555dbbe856a475f74b5e6df65
Reviewed-on: https://go-review.googlesource.com/18593
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet: LookupAddr("127.0.0.1") is "localhost" not "localhost." on Plan 9 and Windows
Mikio Hara [Wed, 13 Jan 2016 12:04:10 +0000 (21:04 +0900)]
net: LookupAddr("127.0.0.1") is "localhost" not "localhost." on Plan 9 and Windows

This change applies the fix for #13564 to Plan 9 and Windows.
Also enables Lookup API test cases on builders.

Updates #13564.

Change-Id: I863f03c7cb6fbe58b3a55223bfa0ac5f9bf9c3df
Reviewed-on: https://go-review.googlesource.com/18559
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http2: update bundled http2
Brad Fitzpatrick [Wed, 13 Jan 2016 04:51:08 +0000 (20:51 -0800)]
net/http2: update bundled http2

Update bundled http2 to git rev 76365a4 for https://golang.org/issue/18571

Fixes golang/go#13924

Change-Id: Ibb48cd6935b35d9965df70fb8761be5986d79ffc
Reviewed-on: https://go-review.googlesource.com/18591
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocrypto/tls: don't block in Conn.Close if Writes are in-flight
Brad Fitzpatrick [Tue, 12 Jan 2016 21:15:51 +0000 (21:15 +0000)]
crypto/tls: don't block in Conn.Close if Writes are in-flight

Conn.Close sends an encrypted "close notify" to signal secure EOF.
But writing that involves acquiring mutexes (handshake mutex + the
c.out mutex) and writing to the network. But if the reason we're
calling Conn.Close is because the network is already being
problematic, then Close might block, waiting for one of those mutexes.

Instead of blocking, and instead of introducing new API (at least for
now), distinguish between a normal Close (one that sends a secure EOF)
and a resource-releasing destructor-style Close based on whether there
are existing Write calls in-flight.

Because io.Writer and io.Closer aren't defined with respect to
concurrent usage, a Close with active Writes is already undefined, and
should only be used during teardown after failures (e.g. deadlines or
cancelations by HTTP users). A normal user will do a Write then
serially do a Close, and things are unchanged for that case.

This should fix the leaked goroutines and hung net/http.Transport
requests when there are network errors while making TLS requests.

Change-Id: If3f8c69d6fdcebf8c70227f41ad042ccc3f20ac9
Reviewed-on: https://go-review.googlesource.com/18572
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile: better modeling of escape across loop levels
David Chase [Mon, 4 Jan 2016 21:44:20 +0000 (16:44 -0500)]
cmd/compile: better modeling of escape across loop levels

Brief background on "why heap allocate".  Things can be
forced to the heap for the following reasons:

1) address published, hence lifetime unknown.
2) size unknown/too large, cannot be stack allocated
3) multiplicity unknown/too large, cannot be stack allocated
4) reachable from heap (not necessarily published)

The bug here is a case of failing to enforce 4) when an
object Y was reachable from a heap allocation X forced
because of 3).  It was found in the case of a closure
allocated within a loop (X) and assigned to a variable
outside the loop (multiplicity unknown) where the closure
also captured a map (Y) declared outside the loop (reachable
from heap). Note the variable declared outside the loop (Y)
is not published, has known size, and known multiplicity
(one). The only reason for heap allocation is that it was
reached from a heap allocated item (X), but because that was
not forced by publication, it has to be tracked by loop
level, but escape-loop level was not tracked and thus a bug
results.

The fix is that when a heap allocation is newly discovered,
use its looplevel as the minimum loop level for downstream
escape flooding.

Every attempt to generalize this bug to X-in-loop-
references-Y-outside loop succeeded, so the fix was aimed
to be general.  Anywhere that loop level forces heap
allocation, the loop level is tracked.  This is not yet
tested for all possible X and Y, but it is correctness-
conservative and because it caused only one trivial
regression in the escape tests, it is probably also
performance-conservative.

The new test checks the following:
1) in the map case, that if fn escapes, so does the map.
2) in the map case, if fn does not escape, neither does the map.
3) in the &x case, that if fn escapes, so does &x.
4) in the &x case, if fn does not escape, neither does &x.

Fixes #13799.

Change-Id: Ie280bef2bb86ec869c7c206789d0b68f080c3fdb
Reviewed-on: https://go-review.googlesource.com/18234
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime/internal/atomic: use //go:noinline to prevent inlining, not assembly nop
Michael Hudson-Doyle [Mon, 11 Jan 2016 22:40:17 +0000 (11:40 +1300)]
runtime/internal/atomic: use //go:noinline to prevent inlining, not assembly nop

A bit cleanuppy for 1.6 maybe, but something I happened to notice.

Change-Id: I70f3b48445f4f527d67f7b202b6171195440b09f
Reviewed-on: https://go-review.googlesource.com/18550
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: make NumGoroutine and Stack agree not to include system goroutines
Russ Cox [Thu, 7 Jan 2016 02:16:01 +0000 (21:16 -0500)]
runtime: make NumGoroutine and Stack agree not to include system goroutines

[Repeat of CL 18343 with build fixes.]

Before, NumGoroutine counted system goroutines and Stack (usually) didn't show them,
which was inconsistent and confusing.

To resolve which way they should be consistent, it seems like

package main
import "runtime"
func main() { println(runtime.NumGoroutine()) }

should print 1 regardless of internal runtime details. Make it so.

Fixes #11706.

Change-Id: If26749fec06aa0ff84311f7941b88d140552e81d
Reviewed-on: https://go-review.googlesource.com/18432
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

8 years agomath/big: fix Exp(x, x, x) for certain large x
Russ Cox [Mon, 11 Jan 2016 14:52:56 +0000 (09:52 -0500)]
math/big: fix Exp(x, x, x) for certain large x

Fixes #13907.

Change-Id: Ieaa5183f399b12a9177372212adf481c8f0b4a0d
Reviewed-on: https://go-review.googlesource.com/18491
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Vlad Krasnov <vlad@cloudflare.com>
Reviewed-by: Adam Langley <agl@golang.org>
8 years agocmd/cgo: document C.sizeof_T and zero-sized field restriction
Ian Lance Taylor [Tue, 12 Jan 2016 15:03:28 +0000 (07:03 -0800)]
cmd/cgo: document C.sizeof_T and zero-sized field restriction

Update #9401.
Update #11925.
Update #13919.

Change-Id: I52c679353693e8165b2972d4d3974ee8bb1207ef
Reviewed-on: https://go-review.googlesource.com/18542
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http: support URLs without schemes in http.Redirect
Denys Honsiorovskyi [Wed, 2 Sep 2015 10:40:34 +0000 (13:40 +0300)]
net/http: support URLs without schemes in http.Redirect

Many browsers now support schemeless URLs in the Location headers
and also it is allowed in the draft HTTP/1.1 specification (see
http://stackoverflow.com/q/4831741#comment25926312_4831741), but
Go standard library lacks support for them.

This patch implements schemeless URLs support in http.Redirect().
Since url.Parse() correctly handles schemeless URLs, I've just added
an extra condition to verify URL's Host part in the absoulute/relative
check in the http.Redirect function.

Also I've moved oldpath variable initialization inside the block
of code where it is used.

Change-Id: Ib8a6347816a83e16576f00c4aa13224a89d610b5
Reviewed-on: https://go-review.googlesource.com/14172
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: mark greyobject go:nowritebarrierrec
Austin Clements [Tue, 24 Nov 2015 19:03:58 +0000 (14:03 -0500)]
runtime: mark greyobject go:nowritebarrierrec

It would certainly be a mistake to invoke a write barrier while
greying an object.

Change-Id: I34445a15ab09655ea8a3628a507df56aea61e618
Reviewed-on: https://go-review.googlesource.com/18533
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: remove out-of-date comment
Austin Clements [Mon, 11 Jan 2016 21:52:11 +0000 (16:52 -0500)]
runtime: remove out-of-date comment

It used to be the case that repeatedly getting one GC pointer and
enqueuing one GC pointer could cause contention on the work buffers as
each operation passed over the boundary of a work buffer. As of
b6c0934, we use a two buffer cache that prevents this sort of
contention.

Change-Id: I4f1111623f76df9c5493dd9124dec1e0bfaf53b7
Reviewed-on: https://go-review.googlesource.com/18532
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoruntime: fix incorrect comment
Austin Clements [Tue, 24 Nov 2015 18:52:28 +0000 (13:52 -0500)]
runtime: fix incorrect comment

This comment is probably a hold-over from when the heap bitmap was
interleaved and the shift was 0, 2, 4, or 6. Now the shift is 0, 1, 2,
or 3.

Change-Id: I096ec729e1ca31b708455c98b573dd961d16aaee
Reviewed-on: https://go-review.googlesource.com/18531
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agodoc: add Overview and other small edits to How To Write Go Code
Andrew Gerrand [Fri, 8 Jan 2016 01:06:45 +0000 (12:06 +1100)]
doc: add Overview and other small edits to How To Write Go Code

Fixes #9228

Change-Id: Ic4df4a39f6f363bdd6eb9228c8164e6e9dccee1b
Reviewed-on: https://go-review.googlesource.com/5561
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agocmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux
Michael Hudson-Doyle [Thu, 7 Jan 2016 23:57:02 +0000 (12:57 +1300)]
cmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux

Go fails to build on a system which has PIE enabled by default like this:

/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status

The only system I know that has this property right now is Ubuntu Xenial
running on s390x, which is hardly the most accessible system, but it's planned
to enable this on amd64 soon too. The fix is to pass -no-pie along with -Wl,-r
to the compiler, but unfortunately that flag is very new as well. So this does
a test compile of a trivial file to see if the flag is supported.

Change-Id: I1345571142b7c3a96212e43297d19e84ec4a3d41
Reviewed-on: https://go-review.googlesource.com/18359
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: disable sendfile on Solaris for now
Brad Fitzpatrick [Mon, 11 Jan 2016 20:27:37 +0000 (12:27 -0800)]
net: disable sendfile on Solaris for now

There are reports of corruption. Let's disable it for now (for Go 1.6,
especially) until we can investigate and fix properly.

Update #13892

Change-Id: I557275e5142fe616e8a4f89c00ffafb830eb3b78
Reviewed-on: https://go-review.googlesource.com/18540
Reviewed-by: Dave Cheney <dave@cheney.net>
8 years agoruntime: fix ppc64le cgocallback code
Ian Lance Taylor [Mon, 11 Jan 2016 19:18:23 +0000 (11:18 -0800)]
runtime: fix ppc64le cgocallback code

Change-Id: I5a4a842cab2173357e8d3e349011c0c2b63be4f9
Reviewed-on: https://go-review.googlesource.com/18512
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: return full error for first test to be built
Ian Lance Taylor [Mon, 11 Jan 2016 17:34:38 +0000 (09:34 -0800)]
runtime: return full error for first test to be built

Change-Id: I5a0206e8074f3a2790954c45a217922b7b3fe851
Reviewed-on: https://go-review.googlesource.com/18487
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agogo/types: slightly better doc strings
Robert Griesemer [Mon, 11 Jan 2016 18:59:36 +0000 (10:59 -0800)]
go/types: slightly better doc strings

Per suggestion from adonovan.

Change-Id: Icbb4d2f201590bc94672b8d8141b6e7901e11dc5
Reviewed-on: https://go-review.googlesource.com/18510
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agogo/importer: use correct path for path->package map
Robert Griesemer [Sat, 9 Jan 2016 01:56:50 +0000 (17:56 -0800)]
go/importer: use correct path for path->package map

In the presence of vendored packages, the path found in a package
declaration may not be the path at which the package imported from
srcDir was found. Use the correct package path.

Change-Id: I74496c3cdf82a5dbd6a5bd189bb3cd0ca103fd52
Reviewed-on: https://go-review.googlesource.com/18460
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agoruntime: fix arm/arm64/ppc64/mips64 to dropm when necessary
Ian Lance Taylor [Sat, 9 Jan 2016 00:56:02 +0000 (16:56 -0800)]
runtime: fix arm/arm64/ppc64/mips64 to dropm when necessary

Fixes #13881.

Change-Id: Idff77db381640184ddd2b65022133bb226168800
Reviewed-on: https://go-review.googlesource.com/18449
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

8 years agoruntime: eagerly share GC work buffers
Rick Hudson [Wed, 6 Jan 2016 22:07:58 +0000 (17:07 -0500)]
runtime: eagerly share GC work buffers

Currently, due to an oversight, we only balance work buffers
in background and idle workers and not in assists. As a
result, in assist-heavy workloads, assists are likely to tie
up large work buffers in per-P caches increasing the
likelihood that the global list will be empty. This increases
the likelihood that other GC workers will exit and assists
will block, slowing down the system as a whole. Fix this by
eagerly balancing work buffers as soon as the assists notice
that the global buffers are empty. This makes it much more
likely that work will be immediately available to other
workers and assists.

This change reduces the garbage benchmark time by 39% and
fixes the regresssion seen at CL 15893 golang.org/cl/15893.

Garbage benchmark times before and after this CL.
Before GOPERF-METRIC:time=4427020
After  GOPERF-METRIC:time=2721645

Fixes #13827

Change-Id: I9cb531fb873bab4b69ce9c1617e30df6c49cdcfe
Reviewed-on: https://go-review.googlesource.com/18341
Reviewed-by: Austin Clements <austin@google.com>
8 years agodoc: note GCM behaviour change in Go 1.6.
Adam Langley [Sun, 10 Jan 2016 03:10:33 +0000 (19:10 -0800)]
doc: note GCM behaviour change in Go 1.6.

This change documents the behaviour change caused by
https://go-review.googlesource.com/18480 in Go 1.6.

Updates #13886

Change-Id: I2daa08a62775bbc209f0f4cbeae21b8184ce7609
Reviewed-on: https://go-review.googlesource.com/18481
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocrypto/cipher: always zero dst buffer on GCM authentication failure.
Adam Langley [Sun, 10 Jan 2016 02:31:35 +0000 (18:31 -0800)]
crypto/cipher: always zero dst buffer on GCM authentication failure.

The AESNI GCM code decrypts and authenticates concurrently and so
overwrites the destination buffer even in the case of an authentication
failure.

This change updates the documentation to make that clear and also
mimics that behaviour in the generic code so that different platforms
act identically.

Fixes #13886

Change-Id: Idc54e51f01e27b0fc60c1745d50bb4c099d37e94
Reviewed-on: https://go-review.googlesource.com/18480
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/dist: restrict parallel tests to NumCPU on mips64x
Yao Zhang [Sun, 10 Jan 2016 03:22:58 +0000 (22:22 -0500)]
cmd/dist: restrict parallel tests to NumCPU on mips64x

mips64 builder and one machine of the mips64le builder has small amount
of memory. Since CL 18199, they have been running slowly, as more
processes were launched in running 'test' directory, and a lot of swap
were used. This CL brings all.bash from 5h back to 3h on Loongson 2E
with 512 MB memory.

Change-Id: I4a22e239a542a99ba5986753205d8cd1f4b3d3c6
Reviewed-on: https://go-review.googlesource.com/18483
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: update bundled http2
Brad Fitzpatrick [Sat, 9 Jan 2016 23:34:56 +0000 (15:34 -0800)]
net/http: update bundled http2

Updates http2 to x/net git rev 0e6d34ef942 for https://golang.org/cl/18472
which means we'll get to delete a ton of grpc-go code and just use the
standard library's HTTP client instead.

Also, the comments in this CL aren't entirely accurate it turns out.
RFC 2616 says:

"The Trailer header field can be used to indicate which header fields
are included in a trailer (see section 14.40)."

And 14.40:

"  An HTTP/1.1 message SHOULD include a Trailer header field in a
   message using chunked transfer-coding with a non-empty trailer. Doing
   so allows the recipient to know which header fields to expect in the
   trailer.

   If no Trailer header field is present, the trailer SHOULD NOT include
   any header fields. See section 3.6.1 for restrictions on the use of
   trailer fields in a "chunked" transfer-coding."

So it's really a SHOULD more than a MUST.

And gRPC (at least Google's server) doesn't predeclare "grpc-status"
ahead of time in a Trailer Header, so we'll be lenient. We were too
strict anyway. It's also not a concern for the Go client we have a
different place to populate the Trailers, and it won't confuse clients
which aren't looking for them. The ResponseWriter server side is more
complicated (and strict), though, since we don't want to widen the
ResponseWriter interface. So the Go server still requires that you
predeclare Trailers.

Change-Id: Ia2defc11a2469fb8570ecfabb8453537121084eb
Reviewed-on: https://go-review.googlesource.com/18473
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: don't remove Expect Request header in Server.
Harshavardhana [Sat, 9 Jan 2016 19:55:32 +0000 (11:55 -0800)]
net/http: don't remove Expect Request header in Server.

Fixes #13893

Change-Id: I2577b38fdb19299227dc146f707cf9df663dcdfc
Reviewed-on: https://go-review.googlesource.com/18471
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: improve ReadResponse test coverage
Emmanuel Odeke [Sun, 3 Jan 2016 14:32:52 +0000 (07:32 -0700)]
net/http: improve ReadResponse test coverage

Change-Id: I08d77d52b68b062c2eb1901fcfca34d45a210cce
Reviewed-on: https://go-review.googlesource.com/18142
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: fix typo in lookup_windows getprotobyname
Matt Robenolt [Sat, 9 Jan 2016 06:22:59 +0000 (22:22 -0800)]
net: fix typo in lookup_windows getprotobyname

Change-Id: Ia6d40ead1e54dd0b8998370cbabc2d7cd8b7aa0b
Reviewed-on: https://go-review.googlesource.com/18470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: stop scanning for domain name once the first label has been found
Mikio Hara [Fri, 8 Jan 2016 18:47:40 +0000 (03:47 +0900)]
net: stop scanning for domain name once the first label has been found

Change-Id: I95c6c85eecb53ffe52b64d521180148b624e9424
Reviewed-on: https://go-review.googlesource.com/18423
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: for c-archive/c-shared, install signal handlers synchronously
Ian Lance Taylor [Sat, 26 Dec 2015 17:51:59 +0000 (09:51 -0800)]
runtime: for c-archive/c-shared, install signal handlers synchronously

The previous behaviour of installing the signal handlers in a separate
thread meant that Go initialization raced with non-Go initialization if
the non-Go initialization also wanted to install signal handlers.  Make
installing signal handlers synchronous so that the process-wide behavior
is predictable.

Update #9896.

Change-Id: Ice24299877ec46f8518b072a381932d273096a32
Reviewed-on: https://go-review.googlesource.com/18150
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agogo/types, go/importer: importing package unsafe is responsibility of importer
Robert Griesemer [Fri, 8 Jan 2016 22:27:02 +0000 (14:27 -0800)]
go/types, go/importer: importing package unsafe is responsibility of importer

TBR adonovan

Fixes #13882.

Change-Id: I8664669f5d6adfec6f16e154263b1f0ea8988175
Reviewed-on: https://go-review.googlesource.com/18445
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agoruntime: clean up gctrace format
Austin Clements [Fri, 8 Jan 2016 19:57:26 +0000 (14:57 -0500)]
runtime: clean up gctrace format

Go 1.6 simplified the GC phases. The "synchronize Ps" phase no longer
exists and "root scan" and "mark" phases have been combined.

Update the gctrace line implementation and documentation to remove the
unused phases.

Fixes #13536.

Change-Id: I4fc37a3ce1ae3a99d48c0be2df64cbda3e05dee6
Reviewed-on: https://go-review.googlesource.com/18458
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agogo/types: provide Importer2 supporting the Go 1.5 vendor experiment
Robert Griesemer [Thu, 7 Jan 2016 00:07:27 +0000 (16:07 -0800)]
go/types: provide Importer2 supporting the Go 1.5 vendor experiment

Fixes #13688.

Change-Id: I53363aeeeba4560211d56d4571a8e058d5dbbd8a
Reviewed-on: https://go-review.googlesource.com/18308
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years agoruntime/pprof: skip TestStackBarrierProfiling on FreeBSD, too
Austin Clements [Fri, 8 Jan 2016 19:32:52 +0000 (14:32 -0500)]
runtime/pprof: skip TestStackBarrierProfiling on FreeBSD, too

Sigh. Sleeps on FreeBSD also yield the rest of the time slice and
profiling signals are only delivered when a process completes a time
slice (worse, itimer time is only accounted to the process that
completes a time slice). It's less noticeable than the other BSDs
because the default tick rate is 1000Hz, but it's still failing
regularly.

Fixes #13846.

Change-Id: I41bf116bffe46682433b677183f86944d0944ed4
Reviewed-on: https://go-review.googlesource.com/18455
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

8 years agoapi: more go1.6 API additions
Brad Fitzpatrick [Fri, 8 Jan 2016 20:06:04 +0000 (20:06 +0000)]
api: more go1.6 API additions

Change-Id: Ib838d2b98e3f84ffd240849817cafc69415ba74e
Reviewed-on: https://go-review.googlesource.com/18376
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agomath/big: fix typo in comment
Robert Griesemer [Fri, 8 Jan 2016 19:33:17 +0000 (11:33 -0800)]
math/big: fix typo in comment

Fixes #13875.

Change-Id: Icbb85c858d0bc545499a2b31622e9e7abdd7e5f9
Reviewed-on: https://go-review.googlesource.com/18441
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoapi: fix build for go/build change
Russ Cox [Fri, 8 Jan 2016 19:51:50 +0000 (14:51 -0500)]
api: fix build for go/build change

Fixes build.

Change-Id: I5235deed7b93157854acb79c15e2e99cc28d300a
Reviewed-on: https://go-review.googlesource.com/18456
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime/testdata: gofmt
Mikio Hara [Fri, 8 Jan 2016 18:45:06 +0000 (03:45 +0900)]
runtime/testdata: gofmt

Change-Id: I728d4c709c4122fe4b96e1350be73696ac6fb1f7
Reviewed-on: https://go-review.googlesource.com/18422
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: apply -importmap to imports before checking for package unsafe
Russ Cox [Fri, 8 Jan 2016 16:36:36 +0000 (11:36 -0500)]
cmd/compile: apply -importmap to imports before checking for package unsafe

There are fewer special cases this way: the import map applies
to all import paths, not just the ones not spelled "unsafe".

This is also consistent with what the code in cmd/go and go/build expects.
They make no exception for "unsafe".

For #13703.

Change-Id: I622295261ca35a6c1e83e8508d363bddbddb6c0a
Reviewed-on: https://go-review.googlesource.com/18438
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agonet/http: fix validHeaderValue yet again, excluding the DEL CTL byte
Brad Fitzpatrick [Fri, 8 Jan 2016 18:30:04 +0000 (18:30 +0000)]
net/http: fix validHeaderValue yet again, excluding the DEL CTL byte

Third time's a charm.

Thanks to Ralph Corderoy for noticing the DEL omission.

Update #11207

Change-Id: I174fd01eaecceae1eb220f2c9136e12d40fbe943
Reviewed-on: https://go-review.googlesource.com/18375
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agogo/build: invert AllowVendor to IgnoreVendor
Russ Cox [Fri, 8 Jan 2016 17:38:41 +0000 (12:38 -0500)]
go/build: invert AllowVendor to IgnoreVendor

Looking for vendor directories is a better default.

Fixes #13772

Change-Id: Iabbaea71ccc67b72f14f1f412dc8ab70cb41996d
Reviewed-on: https://go-review.googlesource.com/18450
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agoruntime: save callee-saved regs in darwin-amd64 library init
Ian Lance Taylor [Fri, 8 Jan 2016 15:36:35 +0000 (07:36 -0800)]
runtime: save callee-saved regs in darwin-amd64 library init

We're only getting away with it today by luck.

Change-Id: I24d1cceee4d20c5181ca64fceda152e875f6ad81
Reviewed-on: https://go-review.googlesource.com/18440
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agoruntime: add nowritebarrierrec to funcs called at signal time
Ian Lance Taylor [Fri, 8 Jan 2016 04:28:04 +0000 (20:28 -0800)]
runtime: add nowritebarrierrec to funcs called at signal time

Also nosplit where needed.

Change-Id: I1e3f6f8f76df9ee7e87ed1b8560cef145928314c
Reviewed-on: https://go-review.googlesource.com/18395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoRevert "net: ensure that malformed domain names report a consistent error"
Russ Cox [Fri, 8 Jan 2016 17:17:53 +0000 (17:17 +0000)]
Revert "net: ensure that malformed domain names report a consistent error"

This reverts commit bb8c2e19a7fe2ca2283eca44dba2047c9f4307fe.

Change-Id: I9bc089e9f2296805ef055b98e8c86ba73af30226
Reviewed-on: https://go-review.googlesource.com/18439
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/dist: fix cgoTestSO on FreeBSD amd64 with GOHOSTARCH=386
Joel Sing [Fri, 8 Jan 2016 12:22:12 +0000 (23:22 +1100)]
cmd/dist: fix cgoTestSO on FreeBSD amd64 with GOHOSTARCH=386

The cgoTestSO test currently fails when run on FreeBSD amd64 with
GOHOSTARCH=386. This is due to it failing to find the shared object.

On FreeBSD 64-bit architectures, the linker for 32-bit objects
looks for a separate environment variable. Export both LD_LIBRARY_PATH
and LD_32_LIBRARY_PATH on FreeBSD when GOHOSTARCH=386.

Update issue #13873.

Change-Id: I1fb20dd04eb2007061768b2e4530886521813d42
Reviewed-on: https://go-review.googlesource.com/18420
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoos: read only 10,000 bytes at a time from Windows console
Russ Cox [Fri, 8 Jan 2016 16:23:25 +0000 (11:23 -0500)]
os: read only 10,000 bytes at a time from Windows console

Reading 32,767 is too many on some versions of Windows.
The exact upper bound is unclear.

For #13697, but may not fix the problem on all systems.

Change-Id: I197021ed60cbcd33c91ca6ceed456ec3d5a6c9d6
Reviewed-on: https://go-review.googlesource.com/18433
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoregexp/syntax: fix factoring of common prefixes in alternations
Paul Wankadia [Thu, 7 Jan 2016 07:55:18 +0000 (18:55 +1100)]
regexp/syntax: fix factoring of common prefixes in alternations

In the past, `a.*?c|a.*?b` was factored to `a.*?[bc]`. Thus, given
"abc" as its input string, the automaton would consume "ab" and
then stop (when unanchored) whereas it should consume all of "abc"
as per leftmost semantics.

Fixes #13812.

Change-Id: I67ac0a353d7793b3d0c9c4aaf22d157621dfe784
Reviewed-on: https://go-review.googlesource.com/18357
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/textproto: accept multi-line error messages
Daniel Speichert [Tue, 29 Dec 2015 15:46:40 +0000 (16:46 +0100)]
net/textproto: accept multi-line error messages

Ads documentation for both formats of messages accepted by
ReadResponse(). Validity of message should not be altered by
the validation process. On message with unexpected code,
a properly formatted message was not fully read.

Fixes #10230

Change-Id: Ic0b473059a68ab624ce0525e359d0f5d0b8d2117
Reviewed-on: https://go-review.googlesource.com/18172
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet: ensure that malformed domain names report a consistent error
Russ Cox [Thu, 7 Jan 2016 01:50:11 +0000 (20:50 -0500)]
net: ensure that malformed domain names report a consistent error

Previously it depended on whether we were using the Go resolver or the Cgo resolver.

Fixes #12421.

Change-Id: Ib162e336f30f736d7244e29d96651c3be11fc3cd
Reviewed-on: https://go-review.googlesource.com/18383
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agointernal/syscall/windows: correct GetACP and MultiByteToWideChar
Alex Brainman [Mon, 21 Dec 2015 05:16:06 +0000 (16:16 +1100)]
internal/syscall/windows: correct GetACP and MultiByteToWideChar

CL 4310 introduced these functions, but their
implementation does not match with their published
documentation. Correct the implementation.

Change-Id: I285e41f9c7c5fc4e550ff59b0adb8b2bcbf6737a
Reviewed-on: https://go-review.googlesource.com/17997
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoencoding/json: doc: Decode only writes to exported fields
Ian Lance Taylor [Fri, 8 Jan 2016 02:48:42 +0000 (18:48 -0800)]
encoding/json: doc: Decode only writes to exported fields

Fixes #13867.

Change-Id: I6c0a6c64369681840df60f63036c2eece27de8b8
Reviewed-on: https://go-review.googlesource.com/18394
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodatabase/sql: guard against panics in driver.Stmt implementation
Russ Cox [Fri, 18 Dec 2015 17:16:05 +0000 (12:16 -0500)]
database/sql: guard against panics in driver.Stmt implementation

For #13677, but there is more to do.

Change-Id: Id1af999dc972d07cdfc771e5855a1a7dca47ca96
Reviewed-on: https://go-review.googlesource.com/18046
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: allow signal.Ignore of user-generated throwing signals
Russ Cox [Thu, 7 Jan 2016 15:19:55 +0000 (10:19 -0500)]
runtime: allow signal.Ignore of user-generated throwing signals

Today, signal.Ignore(syscall.SIGTRAP) does nothing
while signal.Notify(make(chan os.Signal), syscall.SIGTRAP)
correctly discards user-generated SIGTRAPs.
The same applies to any signal that we throw on.

Make signal.Ignore work for these signals.

Fixes #12906.

Change-Id: Iba244813051e0ce23fa32fbad3e3fa596a941094
Reviewed-on: https://go-review.googlesource.com/18348
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: fix up OS X kernel bug sending user-generated SIGTRAP
Russ Cox [Thu, 7 Jan 2016 04:00:08 +0000 (23:00 -0500)]
runtime: fix up OS X kernel bug sending user-generated SIGTRAP

OS X unconditionally sets si_code = TRAP_BRKPT when sending SIGTRAP,
even if it was generated by kill -TRAP and not a breakpoint.
Correct the si_code by looking to see if the PC is after a breakpoint.

For #12906.

Change-Id: I998c2499f7f12b338e607282a325b045f1f4f690
Reviewed-on: https://go-review.googlesource.com/18347
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoRevert "runtime: make NumGoroutine and Stack agree not to include system goroutines"
Russ Cox [Fri, 8 Jan 2016 15:31:09 +0000 (15:31 +0000)]
Revert "runtime: make NumGoroutine and Stack agree not to include system goroutines"

This reverts commit c5bafc828126c8fa057e1accaa448583c7ec145f.

Change-Id: Ie7030c978c6263b9e996d5aa0e490086796df26d
Reviewed-on: https://go-review.googlesource.com/18431
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: make NumGoroutine and Stack agree not to include system goroutines
Russ Cox [Thu, 7 Jan 2016 02:16:01 +0000 (21:16 -0500)]
runtime: make NumGoroutine and Stack agree not to include system goroutines

Before, NumGoroutine counted system goroutines and Stack (usually) didn't show them,
which was inconsistent and confusing.

To resolve which way they should be consistent, it seems like

package main
import "runtime"
func main() { println(runtime.NumGoroutine()) }

should print 1 regardless of internal runtime details. Make it so.

Fixes #11706.

Change-Id: I6bfe26a901de517728192cfb26a5568c4ef4fe47
Reviewed-on: https://go-review.googlesource.com/18343
Reviewed-by: Austin Clements <austin@google.com>
8 years agoencoding/base64: fix streaming decode of padding-free base64
Russ Cox [Wed, 6 Jan 2016 19:32:17 +0000 (14:32 -0500)]
encoding/base64: fix streaming decode of padding-free base64

Fixes #13384.

Change-Id: Id9e827acddc8de139f93c5de0c6486bc4334c7d4
Reviewed-on: https://go-review.googlesource.com/18330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoos/signal: clarify signal doc
Ian Lance Taylor [Thu, 7 Jan 2016 17:41:45 +0000 (09:41 -0800)]
os/signal: clarify signal doc

Based on comments from Thomas Bushnell.

Update #9896.

Change-Id: I603b1382d17dff00b5d18f17f8b5d011503e9e4c
Reviewed-on: https://go-review.googlesource.com/18365
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoos: fix rename on Plan 9
David du Colombier [Thu, 7 Jan 2016 06:45:59 +0000 (07:45 +0100)]
os: fix rename on Plan 9

Rename should remove newname if the file already exists
and is not a directory.

Fixes #13844.

Change-Id: I85a5cc28e8d161637a8bc1de33f4a637d9154cd1
Reviewed-on: https://go-review.googlesource.com/18291
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoA+C: manual updates
Brad Fitzpatrick [Thu, 7 Jan 2016 20:25:09 +0000 (12:25 -0800)]
A+C: manual updates

Add Colin Cross (Google CLA)
Add Quentin Perez (Individual CLA)
Add Andy Balholm (Individual CLA)
Add Dirk Gadsden (Individual CLA)
Add Derek Che (Yahoo CLA)

And:

Add CL Sung (Individual CLA), but where gerrit is using personal email
address with CLA signed, but the git commit itself is using an
unverified htc.com address. The commit is:
    https://github.com/golang/oauth2/commit/099e4f0
For github user https://github.com/clsung which says "Self-Employed"
and "clsung@gmail.com". Perhaps the self-employed part is new
since Sep 10, 2014.

Change-Id: Ic1130fb79d167259a9bb76e3be56b9c8ad6b95ca
Reviewed-on: https://go-review.googlesource.com/18369
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: fix too-strict validation of server header values
Brad Fitzpatrick [Fri, 8 Jan 2016 01:06:00 +0000 (01:06 +0000)]
net/http: fix too-strict validation of server header values

As Andy Balholm noted in #11207:

"RFC2616 §4.2 says that a header's field-content can consist of *TEXT,
and RFC2616 §2.2 says that TEXT is <any OCTET except CTLs, but
including LWS>, so that would mean that bytes greater than 128 are
allowed."

This is a partial rollback of the strictness from
https://golang.org/cl/11207 (added in the Go 1.6 dev cycle, only
released in Go 1.6beta1)

Fixes #11207

Change-Id: I3a752a7941de100e4803ff16a5d626d5cfec4f03
Reviewed-on: https://go-review.googlesource.com/18374
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agogo/doc: don't drop "factory" functions with dot-imported result types
Robert Griesemer [Fri, 8 Jan 2016 02:40:40 +0000 (18:40 -0800)]
go/doc: don't drop "factory" functions with dot-imported result types

Fixes #13742.

Change-Id: I7c8b51b60e31402bf708bf8d70e07fd06295e8ce
Reviewed-on: https://go-review.googlesource.com/18393
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/cgo, runtime: recognize unsafe.Pointer(&s[0]) in cgo pointer checks
Ian Lance Taylor [Thu, 7 Jan 2016 23:22:39 +0000 (15:22 -0800)]
cmd/cgo, runtime: recognize unsafe.Pointer(&s[0]) in cgo pointer checks

It's fairly common to call cgo functions with conversions to
unsafe.Pointer or other C types.  Apply the simpler checking of address
expressions when possible when the address expression occurs within a
type conversion.

Change-Id: I5187d4eb4d27a6542621c396cad9ee4b8647d1cd
Reviewed-on: https://go-review.googlesource.com/18391
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agotime: restore old error text for day out of range
Russ Cox [Thu, 7 Jan 2016 20:36:54 +0000 (15:36 -0500)]
time: restore old error text for day out of range

Go 1.5 and earlier said "day out of range".
As part of working on this code it morphed into "day of month out of range".
To avoid churn in the output restore the old text.

This fixes some tests reported privately.

Change-Id: If179676cd49f9a471a9441fec2f5220c85eb0799
Reviewed-on: https://go-review.googlesource.com/18386
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: LookupAddr("127.0.0.1") is "localhost" not "localhost."
Russ Cox [Thu, 7 Jan 2016 01:37:05 +0000 (20:37 -0500)]
net: LookupAddr("127.0.0.1") is "localhost" not "localhost."

Fixes #13564.

Change-Id: I30c827ef4a112fee21b8493a67d0227109e35072
Reviewed-on: https://go-review.googlesource.com/18384
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: document GODEBUG settings, update bundled http2
Brad Fitzpatrick [Thu, 7 Jan 2016 23:43:52 +0000 (23:43 +0000)]
net/http: document GODEBUG settings, update bundled http2

Document the three GODEBUG environment variables in the package doc.

Updates the bundled http2 to x/net git rev 415f1917
for https://golang.org/cl/18372.

Fixes #13611

Change-Id: I3116c5d7de70d3d15242d7198f3758b1fb7d94b9
Reviewed-on: https://go-review.googlesource.com/18373
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet/http: add some tests around sending & receiving star requests
Brad Fitzpatrick [Thu, 7 Jan 2016 19:57:49 +0000 (11:57 -0800)]
net/http: add some tests around sending & receiving star requests

I thought there was still work to do in http2 for this, but I guess
not: the work for parsing them is in net/url (used by http2) and the
handling of OPTIONS * is already in net/http serverHandler, also used
by http2.

But keep the tests.

Change-Id: I566dd0a03cf13c9ea8e735c6bd32d2c521ed503b
Reviewed-on: https://go-review.googlesource.com/18368
Reviewed-by: Blake Mizerany <blake.mizerany@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agocmd/compile: recognize !typedbool is typed
Matthew Dempsky [Thu, 7 Jan 2016 11:06:49 +0000 (03:06 -0800)]
cmd/compile: recognize !typedbool is typed

Adding the evconst(n) call for OANDAND and OOROR in
golang.org/cl/18262 was originally just to parallel the above iscmp
branch, but upon further inspection it seemed odd that removing it
caused test/fixedbugs/issue6671.go's

    var b mybool
    // ...
    b = bool(true) && true // ERROR "cannot use"

to start failing (i.e., by not emitting the expected "cannot use"
error).

The problem is that evconst(n)'s settrue and setfalse paths always
reset n.Type to idealbool, even for logical operators where n.Type
should preserve the operand type.  Adding the evconst(n) call for
OANDAND/OOROR inadvertantly worked around this by turning the later
evconst(n) call at line 2167 into a noop, so the "n.Type = t"
assignment at line 739 would preserve the operand type.

However, that means evconst(n) was still clobbering n.Type for ONOT,
so declarations like:

    const _ bool = !mybool(true)

were erroneously accepted.

Update #13821.

Change-Id: I18e37287f05398fdaeecc0f0d23984e244f025da
Reviewed-on: https://go-review.googlesource.com/18362
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: fix sigprof stack barrier locking
Austin Clements [Tue, 5 Jan 2016 20:21:27 +0000 (15:21 -0500)]
runtime: fix sigprof stack barrier locking

f90b48e intended to require the stack barrier lock in all cases of
sigprof that walked the user stack, but got it wrong. In particular,
if sp < gp.stack.lo || gp.stack.hi < sp, tracebackUser would be true,
but we wouldn't acquire the stack lock. If it then turned out that we
were in a cgo call, it would walk the stack without the lock.

In fact, the whole structure of stack locking is sigprof is somewhat
wrong because it assumes the G to lock is gp.m.curg, but all three
gentraceback calls start from potentially different Gs.

To fix this, we lower the gcTryLockStackBarriers calls much closer to
the gentraceback calls. There are now three separate trylock calls,
each clearly associated with a gentraceback and the locked G clearly
matches the G from which the gentraceback starts. This actually brings
the sigprof logic closer to what it originally was before stack
barrier locking.

This depends on "runtime: increase assumed stack size in
externalthreadhandler" because it very slightly increases the stack
used by sigprof; without this other commit, this is enough to blow the
profiler thread's assumed stack size.

Fixes #12528 (hopefully for real this time!).

For the 1.5 branch, though it will require some backporting. On the
1.5 branch, this will *not* require the "runtime: increase assumed
stack size in externalthreadhandler" commit: there's no pcvalue cache,
so the used stack is smaller.

Change-Id: Id2f6446ac276848f6fc158bee550cccd03186b83
Reviewed-on: https://go-review.googlesource.com/18328
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: increase assumed stack size in externalthreadhandler
Austin Clements [Wed, 6 Jan 2016 17:17:46 +0000 (12:17 -0500)]
runtime: increase assumed stack size in externalthreadhandler

On Windows, externalthreadhandler currently sets the assumed stack
size for the profiler thread and the ctrlhandler threads to 8KB. The
actual stack size is determined by the SizeOfStackReserve field in the
binary set by the linker, which is currently at least 64KB (and
typically 128KB).

It turns out the profiler thread is running within a few words of the
8KB-(stack guard) bound set by externalthreadhandler. If it overflows
this bound, morestack crashes unceremoniously with an access
violation, which we then fail to handle, causing the whole process to
exit without explanation.

To avoid this problem and give us some breathing room, increase the
assumed stack size in externalthreadhandler to 32KB (there's some
unknown amount of stack already in use, so it's not safe to increase
this all the way to the reserve size).

We also document the relationships between externalthreadhandler and
SizeOfStackReserve to make this more obvious in the future.

Change-Id: I2f9f9c0892076d78e09827022ff0f2bedd9680a9
Reviewed-on: https://go-review.googlesource.com/18304
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
8 years agoruntime: don't ignore success of cgo profiling tracebacks
Austin Clements [Wed, 6 Jan 2016 19:02:50 +0000 (14:02 -0500)]
runtime: don't ignore success of cgo profiling tracebacks

If a sigprof happens during a cgo call, we traceback from the entry
point of the cgo call. However, if the SP is outside of the G's stack,
we'll then ignore this traceback, even if it was successful, and
overwrite it with just _ExternalCode.

Fix this by accepting any successful traceback, regardless of whether
we got it from a cgo entry point or from regular Go code.

Fixes #13466.

Change-Id: I5da9684361fc5964f44985d74a8cdf02ffefd213
Reviewed-on: https://go-review.googlesource.com/18327
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet: document ":port" syntax in Dial, Listen, ListenPacket
Russ Cox [Thu, 7 Jan 2016 01:55:59 +0000 (20:55 -0500)]
net: document ":port" syntax in Dial, Listen, ListenPacket

Change-Id: Ideb4bd9ffb1b5f1aef7d94ff791a262f54a650d5
Reviewed-on: https://go-review.googlesource.com/18344
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: add pointer to net and net/http for more GODEBUG settings
Russ Cox [Thu, 7 Jan 2016 03:04:06 +0000 (22:04 -0500)]
runtime: add pointer to net and net/http for more GODEBUG settings

net has GODEBUG text already.
net/http still needs it (leaving for Brad).

For #13611.

Change-Id: Icea1027924a23a687cbbe4001985e8c6384629d7
Reviewed-on: https://go-review.googlesource.com/18346
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: update bundled http2, fixes TestConcurrentReadWriteReqBody_h2
Brad Fitzpatrick [Thu, 7 Jan 2016 04:59:25 +0000 (04:59 +0000)]
net/http: update bundled http2, fixes TestConcurrentReadWriteReqBody_h2

Updates http2 to x/net git rev 520af5de654d for
https://golang.org/cl/18370

Fixes #13659

Change-Id: I920eaff6036ac22c500a97449826c6b12f873d7f
Reviewed-on: https://go-review.googlesource.com/18371
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agonet/http: Minor fix to error messages in test.
Michael McGreevy [Thu, 7 Jan 2016 02:32:46 +0000 (13:32 +1100)]
net/http: Minor fix to error messages in test.

Change-Id: I995ac0559f89110662d79d136d710ef3a0bb1505
Reviewed-on: https://go-review.googlesource.com/18351
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: mention that Go no longer calls timeBeginPeriod(1) on Windows
Russ Cox [Thu, 7 Jan 2016 02:28:06 +0000 (21:28 -0500)]
doc: mention that Go no longer calls timeBeginPeriod(1) on Windows

Fixes #13731.

Change-Id: Iaf70a8b41c947f0d86013808564112ab676136e3
Reviewed-on: https://go-review.googlesource.com/18345
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
8 years agodoc: update 1.6 release notes with buildmode progress
Michael Hudson-Doyle [Wed, 6 Jan 2016 23:50:13 +0000 (12:50 +1300)]
doc: update 1.6 release notes with buildmode progress

Fixes #13358

Change-Id: I57ed50c2610cab11fb3d9749f9e7d4a37daa7977
Reviewed-on: https://go-review.googlesource.com/18276
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodoc: remove note about installing from source for ARM
Russ Cox [Wed, 6 Jan 2016 20:47:47 +0000 (15:47 -0500)]
doc: remove note about installing from source for ARM

Now there are ARM downloads too.

Change-Id: I236381508c69d56748e672d184b92caa715e81ae
Reviewed-on: https://go-review.googlesource.com/18342
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agonet/http: update bundled http2; fixes TestTransportAndServerSharedBodyRace_h2
Brad Fitzpatrick [Thu, 7 Jan 2016 00:51:13 +0000 (00:51 +0000)]
net/http: update bundled http2; fixes TestTransportAndServerSharedBodyRace_h2

Update bundled http2 to git rev d1ba260648 (https://golang.org/cl/18288).

Fixes the flaky TestTransportAndServerSharedBodyRace_h2.

Also adds some debugging to TestTransportAndServerSharedBodyRace_h2
which I hope won't ever be necessary again, but I know will be.

Fixes #13556

Change-Id: Ibcf2fc23ec0122dcac8891fdc3bd7f8acddd880e
Reviewed-on: https://go-review.googlesource.com/18289
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodoc: show relevant test instructions on install page
Andrew Gerrand [Wed, 6 Jan 2016 23:53:07 +0000 (10:53 +1100)]
doc: show relevant test instructions on install page

Fixes golang/go#12490

Change-Id: I0861e62aaa589fc63217c83e9c227c17e35cda75
Reviewed-on: https://go-review.googlesource.com/18277
Reviewed-by: Russ Cox <rsc@golang.org>