[release-branch.go1.3] remove cmd/link

http://codereview.appspot.com/106740043
[release-branch.go1.3] remove package debug/goobj and copy functionality to cmd/nm

https://codereview.appspot.com/103760043/
[release-branch.go1.3] misc/nacl: remove cmd/link from testzip.proto

There's no cmd/link in this branch.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/102050043
go1.3rc1

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://codereview.appspot.com/102920050
[release-branch.go1.3] doc: mention WriteHeapDump in 1.3 release notes

««« CL 103810044 / 603f6c3b152c
doc: mention WriteHeapDump in 1.3 release notes

LGTM=r
R=khr, r
CC=golang-codereviews
https://codereview.appspot.com/103810044
»»»

TBR=adg
R=adg
CC=golang-codereviews
https://codereview.appspot.com/99700043
[release-branch.go1.3] cmd/cgo: use same Go type for typedef to anonymous struct

««« CL 102080043 / 256d975c53cb
cmd/cgo: use same Go type for typedef to anonymous struct

If we see a typedef to an anonymous struct more than once,
presumably in two different Go files that import "C", use the
same Go type name.

Fixes issue 8133.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/102080043
»»»

TBR=adg
CC=golang-codereviews
https://codereview.appspot.com/102100043
[release-branch.go1.3] cmd/gc: don't generate zillions of linehists for wrapper functions

««« CL 104840043 / 876107512a67
cmd/gc: don't generate zillions of linehists for wrapper functions
This is a workaround - the code should be better than this - but the
fix avoids generating large numbers of linehist entries for the wrapper
functions that enable interface conversions. There can be many of
them, they all happen at the end of compilation, and they can all
share a linehist entry.
Avoids bad n^2 behavior in liblink.
Test case in issue 8135 goes from 64 seconds to 2.5 seconds (still bad
but not intolerable).

Fixes issue 8135.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/104840043
»»»

TBR=adg
CC=golang-codereviews
https://codereview.appspot.com/102070045
[release-branch.go1.3] runtime: fix 1-byte return during x.(T) for 0-byte T

««« CL 100940043 / 93baf7bea171
runtime: fix 1-byte return during x.(T) for 0-byte T

The 1-byte write was silently clearing a byte on the stack.
If there was another function call with more arguments
in the same stack frame, no harm done.
Otherwise, if the variable at that location was already zero,
no harm done.
Otherwise, problems.

Fixes issue 8139.

LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews, iant, r
https://codereview.appspot.com/100940043
»»»

TBR=adg
CC=golang-codereviews
https://codereview.appspot.com/105760045
[release-branch.go1.3] cmd/gc: fix liveness for address-taken variables in inlined functions

««« CL 96670046 / 1bec455e95f1
cmd/gc: fix liveness for address-taken variables in inlined functions

The 'address taken' bit in a function variable was not
propagating into the inlined copies, causing incorrect
liveness information.

LGTM=dsymonds, bradfitz
R=golang-codereviews, bradfitz
CC=dsymonds, golang-codereviews, iant, khr, r
https://codereview.appspot.com/96670046
»»»

TBR=adg
R=adg
CC=golang-codereviews
https://codereview.appspot.com/103810046
[release-branch.go1.3] time: support version 3 zone records

««« CL 100930044 / fde405c62fca
time: support version 3 zone records

Fixes Issue 8134

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r, rsc
https://codereview.appspot.com/100930044
»»»

LGTM=rsc
R=adg, rsc
CC=golang-codereviews
https://codereview.appspot.com/96690043
[release-branch.go1.3] cmd/gc: fix escape analysis of func returning indirect of parameter

««« CL 102040046 / a078b2056ebc
cmd/gc: fix escape analysis of func returning indirect of parameter

I introduced this bug when I changed the escape
analysis to run in phases based on call graph
dependency order, in order to be more precise about
inputs escaping back to outputs (functions returning
their arguments).

Given

        func f(z **int) *int { return *z }

we were tagging the function as 'z does not escape
and is not returned', which is all true, but not
enough information.

If used as:

        var x int
        p := &x
        q := &p
        leak(f(q))

then the compiler might try to keep x, p, and q all
on the stack, since (according to the recorded
information) nothing interesting ends up being
passed to leak.

In fact since f returns *q = p, &x is passed to leak
and x needs to be heap allocated.

To trigger the bug, you need a chain that the
compiler wants to keep on the stack (like x, p, q
above), and you need a function that returns an
indirect of its argument, and you need to pass the
head of the chain to that function. This doesn't
come up very often: this bug has been present since
June 2012 (between Go 1 and Go 1.1) and we haven't
seen it until now. It helps that most functions that
return indirects are getters that are simple enough
to be inlined, avoiding the bug.

Earlier versions of Go also had the benefit that if
&x really wasn't used beyond x's lifetime, nothing
broke if you put &x in a heap-allocated structure
accidentally. With the new stack copying, though,
heap-allocated structures containing &x are not
updated when the stack is copied and x moves,
leading to crashes in Go 1.3 that were not crashes
in Go 1.2 or Go 1.1.

The fix is in two parts.

First, in the analysis of a function, recognize when
a value obtained via indirect of a parameter ends up
being returned. Mark those parameters as having
content escape back to the return results (but we
don't bother to write down which result).

Second, when using the analysis to analyze, say,
f(q), mark parameters with content escaping as
having any indirections escape to the heap. (We
don't bother trying to match the content to the
return value.)

The fix could be less precise (simpler).
In the first part we might mark all content-escaping
parameters as plain escaping, and then the second
part could be dropped. Or we might assume that when
calling f(q) all the things pointed at by q escape
always (for any f and q).

The fix could also be more precise (more complex).
We might record the specific mapping from parameter
to result along with the number of indirects from the
parameter to the thing being returned as the result,
and then at the call sites we could set up exactly the
right graph for the called function. That would make
notleaks(f(q)) be able to keep x on the stack, because
the reuslt of f(q) isn't passed to anything that leaks it.

The less precise the fix, the more stack allocations
become heap allocations.

This fix is exactly as precise as it needs to be so that
none of the current stack allocations in the standard
library turn into heap allocations.

Fixes issue 8120.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, khr, r
https://codereview.appspot.com/102040046
»»»

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/103870043
[release-branch.go1.3] crypto/tls: fix typo referencing the required Config field

««« CL 107740043 / d86ec79a5f30
crypto/tls: fix typo referencing the required Config field

Thanks to Frithjof Schulze for noticing.

LGTM=adg
R=adg
CC=agl, golang-codereviews, r
https://codereview.appspot.com/107740043

Committer: Andrew Gerrand <adg@golang.org>
»»»

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant
https://codereview.appspot.com/103020043
[release-branch.go1.3] compress/gzip: allow Reset on Reader without NewReader

««« CL 103020044 / 318b56ffe04b
compress/gzip: allow Reset on Reader without NewReader

Fixes issue 8126.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/103020044
»»»

TBR=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/105820043
[release-branch.go1.3] debug/elf: support DWARF that needs relocs for 386

««« CL 96680045 / 5439c77d4acb
debug/elf: support DWARF that needs relocs for 386

It's not clear how widespread this issue is, but we do have a
test case generated by a development version of clang.

I don't know whether this should go into 1.3 or not; happy to
hear arguments either way.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://codereview.appspot.com/96680045
»»»

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/102140043
[release-branch.go1.3] doc/install-source.html: document that GO386 will be auto-detected when building on both 386 and amd64.

««« CL 102150046 / ccf7893cc2f0
doc/install-source.html: document that GO386 will be auto-detected when building on both 386 and amd64.
Fixes issue 8152.

LGTM=iant
R=iant
CC=golang-codereviews
https://codereview.appspot.com/102150046
»»»

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/105830044
[release-branch.go1.3] cmd/cgo: for typedef of untagged struct, use typedef name in C code

««« CL 103080043 / 5e058e21b67d
cmd/cgo: for typedef of untagged struct, use typedef name in C code

Fixes issue 8148.

LGTM=cookieo9, rsc
R=rsc, cookieo9
CC=golang-codereviews
https://codereview.appspot.com/103080043
»»»

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://codereview.appspot.com/103900046
[release-branch.go1.3] doc: fix happens-before rules for buffered channels

««« CL 101980047 / 12c9a9ff50d8
doc: fix happens-before rules for buffered channels
The current wording is reversed in 2 places.
Not sure how it got 4 LGTMs (mine was there as well).
Update issue 6242.

LGTM=dan.kortschak, r, rsc
R=golang-codereviews, 0xjnml, dan.kortschak, r, rsc
CC=golang-codereviews
https://codereview.appspot.com/101980047
»»»

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://codereview.appspot.com/106830047
[release-branch.go1.3] cmd/6g: fix stack zeroing on native client

««« CL 108740047 / c8e9255aed3f
cmd/6g: fix stack zeroing on native client

I am not sure what the rounding here was
trying to do, but it was skipping the first
pointer on native client.

The code above the rounding already checks
that xoffset is widthptr-aligned, so the rnd
was a no-op everywhere but on Native Client.
And on Native Client it was wrong.

Perhaps it was supposed to be rounding down,
not up, but zerorange handles the extra 32 bits
correctly, so the rnd does not seem to be necessary
at all.

This wouldn't be worth doing for Go 1.3 except
that it can affect code on the playground.

Fixes issue 8155.

LGTM=r, iant
R=golang-codereviews, r, iant
CC=dvyukov, golang-codereviews, khr
https://codereview.appspot.com/108740047
»»»

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://codereview.appspot.com/107830044
[release-branch.go1.3] runtime: fix panic stack during runtime.Goexit during panic

««« CL 102220043 / 00224712f89e
runtime: fix panic stack during runtime.Goexit during panic

A runtime.Goexit during a panic-invoked deferred call
left the panic stack intact even though all the stack frames
are gone when the goroutine is torn down.
The next goroutine to reuse that struct will have a
bogus panic stack and can cause the traceback routines
to walk into garbage.

Most likely to happen during tests, because t.Fatal might
be called during a deferred func and uses runtime.Goexit.

This "not enough cleared in Goexit" failure mode has
happened to us multiple times now. Clear all the pointers
that don't make sense to keep, not just gp->panic.

Fixes issue 8158.

LGTM=iant, dvyukov
R=iant, dvyukov
CC=golang-codereviews
https://codereview.appspot.com/102220043
»»»

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r
https://codereview.appspot.com/108780044
[release-branch.go1.3] docs: link to the assembler document from the Documents tab

««« CL 108840045 / 087e446f2c41
docs: link to the assembler document from the Documents tab

Fixes issue 8156.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/108840045
»»»

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews, iant
https://codereview.appspot.com/101170045