1
0
mirror of https://github.com/golang/go synced 2024-10-05 16:41:21 -06:00
Commit Graph

6833 Commits

Author SHA1 Message Date
Håvard Haugen
b9dbb030d5 cmd/compiler/internal/gc: make Type.Copyto a []*Node
Passes go build -a -toolexec 'toolstash -cmp' std cmd

Change-Id: Ief4613cfb341172a85e3a894f44fb2bb308c7b55
Reviewed-on: https://go-review.googlesource.com/14554
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-14 04:51:46 +00:00
Håvard Haugen
4c96e7b79b cmd/compile/internal/gc: clean up errcmp
Change-Id: Id07811a25bf4aa3ff834e7254a3dfb04522b2926
Reviewed-on: https://go-review.googlesource.com/14174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-13 23:50:25 +00:00
Dave Cheney
ea4e321d4d cmd/compile/internal/gc: avoid allocation in bnum
Although bnum was being called with a Bits value, a limitation
of the escape analyser (golang/go#12588) meant that taking the
address of the Bits.b array in the range statement caused the
formal parameter to escape to the heap.

Passing the a pointer to a Bits, as with all the other Bits helper
methods avoids the allocation.

Before:
BenchmarkBnum1-4        20000000                69.6 ns/op            32 B/op          1 allocs/op

After:
BenchmarkBnum1-4        100000000               10.1 ns/op             0 B/op          0 allocs/op

Change-Id: I673bd57ddc032ee67d09474156d795fb1ba72018
Reviewed-on: https://go-review.googlesource.com/14501
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-12 02:55:38 +00:00
Rob Pike
67ddae87b9 all: use one 'l' when cancelling everywhere except Solaris
Fixes #11626.

Change-Id: I1b70c0844473c3b57a53d7cca747ea5cdc68d232
Reviewed-on: https://go-review.googlesource.com/14526
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-11 18:31:51 +00:00
Didier Spezia
41713b4d2b cmd/doc: slice/map literals janitoring
Simplify slice/map literal expression.
Caught with gofmt -d -s

Change-Id: I7f38ef9fb528e2fd284bd0f190fbdf4a91956e55
Reviewed-on: https://go-review.googlesource.com/13834
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 14:04:46 +00:00
Didier Spezia
90f69259ec cmd/compile/internal/ppc64: map/slice literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I201cd90fdfb8de2971c46ad7fce64111152b697e
Reviewed-on: https://go-review.googlesource.com/13832
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 12:59:18 +00:00
Rob Pike
5e89acb580 cmd/asm: fix some fuzz bugs
One (12466) was an actual logic error, backing up when there was
nothing there. The others were due to continuing to process an
instruction when it cannot work.

Methodically stop assembling an instruction when it's not going to
succeed.

Fixes #12466.
Fixes #12467.
Fixes #12468.

Change-Id: I88c568f2b9c1a8408043b2ac5a78f5e2ffd62abd
Reviewed-on: https://go-review.googlesource.com/14498
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 00:52:21 +00:00
Shenghou Ma
3f2baa3e60 cmd/dist: re-enable GOARM auto-detection
cmd/dist will re-exec itself to detect VFP support at run-time.

Fixes #9732, #12548.

Change-Id: I9ad0c5c7fa3e97bd79a32da372e1a962565bb3af
Reviewed-on: https://go-review.googlesource.com/3973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 22:43:07 +00:00
Didier Spezia
7d48573d46 cmd/internal/obj: map/slice literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I0a6773d12200a7b43491f25f914335069a1fa5e8
Reviewed-on: https://go-review.googlesource.com/13833
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 21:47:41 +00:00
Michael Hudson-Doyle
b0344e9fd5 cmd/internal/obj, cmd/link, runtime: a saner model for TLS on arm
this leaves lots of cruft behind, will delete that soon

Change-Id: I12d6b6192f89bcdd89b2b0873774bd3458373b8a
Reviewed-on: https://go-review.googlesource.com/14196
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 19:49:13 +00:00
Yao Zhang
b456aac388 cmd/objdump: skip TestDisasm* for mips64{,le}
Disassembler for mips64 is not supported yet.

Change-Id: Ie923dd1e37fed47fc395b9d1cd9194e55020bee5
Reviewed-on: https://go-review.googlesource.com/14459
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 18:27:09 +00:00
Yao Zhang
1153737e86 cmd/go: skip part of TestNoteReading for mips64{,le}
Because external linking is not supported for now.

Change-Id: Icdd8f3cb3bfb781a990e529fce9129d91e98a9ec
Reviewed-on: https://go-review.googlesource.com/14457
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 18:26:30 +00:00
Russ Cox
d8384e9a8f cmd/vet: diagnose plain assignment in copylock detector
It went out of its way to look for implicit assignments
but never checked explicit assignments.

This detects the root bug for #12099.

Change-Id: I6a6e774cc38749ea8be7cfd58ba6421247b67000
Reviewed-on: https://go-review.googlesource.com/13646
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
2015-09-10 16:55:51 +00:00
Dave Cheney
81a4bbffbf cmd/go: use RawToken to parse remote package metadata
CL 14315 broke the tests for parsing loosely formed remote package
metadata. Switch the parsing to use RawToken to recover the previous
behaviour that Token provided.

It could be argued that the parser should be stricter, but as remote
metadata has been readable with the parser for several years, it is
safer to change the parser to continue to accept the samples provided
in the test cases.

Change-Id: I2a3ba1757d3cff53b1a1c4386276955bb46cf8cd
Reviewed-on: https://go-review.googlesource.com/14482
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 07:30:43 +00:00
Dave Cheney
bab01a0b4b cmd/compile: convert typecheckdefstack to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ie02d2cf35f1e8438c6e9dc1d5fba51e8adde1bc0
Reviewed-on: https://go-review.googlesource.com/14480
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 05:37:22 +00:00
Keith Randall
00c638d243 runtime: on map update, don't overwrite key if we don't need to.
Keep track of which types of keys need an update and which don't.

Strings need an update because the new key might pin a smaller backing store.
Floats need an update because it might be +0/-0.
Interfaces need an update because they may contain strings or floats.

Fixes #11088

Change-Id: I9ade53c1dfb3c1a2870d68d07201bc8128e9f217
Reviewed-on: https://go-review.googlesource.com/10843
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-09 21:06:49 +00:00
Rob Pike
cf3134a017 cmd/doc: the builtin package should always show unexported symbols
Trivial fix: set unexported=true for builtin.
Godoc itself has a similar hack.

Fixes #12541

Change-Id: Ib701f867d117931eb6ec6de223941b52eb6cd4a7
Reviewed-on: https://go-review.googlesource.com/14441
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-09 19:46:08 +00:00
Keith Randall
1ca7a64a0d cmd/compile/internal/gc: handle weird map literals in key dedup
We compute whether two keys k1 and k2 in a map literal are duplicates by
constructing the expression OEQ(k1, k2) and calling the constant
expression evaluator on that expression, then extracting the boolean
result.

Unfortunately, the constant expression evaluator can fail for various
reasons.  I'm not really sure why it is dying in the case of 12536, but
to be safe we should use the result only if we get a constant back (if
we get a constant back, it must be boolean).  This probably isn't a
permanent fix, but it should be good enough for 1.5.2.

A permanent fix would be to ensure that the constant expression
evaluator can always work for map literal keys, and if not the compiler
should generate an error saying that the key isn't a constant (or isn't
comparable to some specific other key).

This patch has the effect of allowing the map literal to compile when
constant eval of the OEQ fails.  If the keys are really equal (which the
map impl will notice at runtime), one will overwrite the other in the
resulting map.  Not great, but better than a compiler crash.

Fixes #12536

Change-Id: Ic151a5e3f131c2e8efa0c25c9218b431c55c1b30
Reviewed-on: https://go-review.googlesource.com/14400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-09 17:50:52 +00:00
Marvin Stenger
05c35ac5d1 cmd/compile/internal/gc: convert fields of TempVar to bool
Convert two fields of struct TempVar in popt.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I1aa14313e0241a4e9cadd63c6c681ed4e965a9a3
Reviewed-on: https://go-review.googlesource.com/14377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 17:03:02 +00:00
Marvin Stenger
a20fbe8e18 cmd/compile/internal/gc: convert fields of Symlink to bool
Convert two fields of struct Symlink in subr.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I913006f41605b17b0d82fe358ee773f6ecaa681c
Reviewed-on: https://go-review.googlesource.com/14378
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 16:07:51 +00:00
Michael Hudson-Doyle
f7b66fffc5 cmd/dist, cmd/link: force external linking for shared libs on arm
Also run testcshared.

Fixes #12425

Change-Id: I5baea8d772d3462f945aab96260b4197dbb20c0a
Reviewed-on: https://go-review.googlesource.com/14143
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-09 01:42:22 +00:00
Dave Cheney
fd50db2a66 cmd/internal/obj: remove unused code
Following on from CL 14350, remove the remaining dead code from data.go.

Also leave a TODO to be addressed later (with a unit test) to reduce
the overhead of SymGrow.

Change-Id: Iebad775b1280b54b89e87a3a073ca8af19a8bfba
Reviewed-on: https://go-review.googlesource.com/14359
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 00:39:36 +00:00
Michael Hudson-Doyle
5cbca8d84b cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object
Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

The change in genasmsym to add STYPELINK to the switch should fix things on
darwin/arm64.

Fixes #10914
Updates #9210

Change-Id: Iab4a6678dd04cec6114e683caac5cf31b1063309
Reviewed-on: https://go-review.googlesource.com/14306
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 23:34:16 +00:00
Shenghou Ma
14f919578d cmd/compile/internal/mips64: copy cmd/compile/internal/ppc64
Just a mechanical copy, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfaf
Reviewed-on: https://go-review.googlesource.com/14324
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 22:40:16 +00:00
Shenghou Ma
5cc86c6f55 cmd/internal/obj/mips: copy cmd/internal/obj/ppc64
Just a mechanical copy with filename renames, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfae
Reviewed-on: https://go-review.googlesource.com/14323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 22:39:56 +00:00
Michael Hudson-Doyle
69a143e388 cmd/internal/obj: remove dead code and small cleanups
Change-Id: I88fa0cc245a2141af04acced8716e08b1133abd1
Reviewed-on: https://go-review.googlesource.com/14350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 21:04:43 +00:00
Marvin Stenger
9ac0fff70a cmd/compile/internal/gc: convert fields of Type to bool
Convert some fields of struct Type in go.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I0a6c53f8ee686839b5234010ee2de7ae3940d499
Reviewed-on: https://go-review.googlesource.com/14370
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-08 17:15:08 +00:00
Marvin Stenger
e03c7896a7 cmd/compile/internal/gc: convert fields of Pkg to bool
Convert Pkg.Imported, Pkg.Exported, Pkg.Direct from uint8/int8/int8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I67a71f1186ff9737c03eca413f7d35d8a79ebc9b
Reviewed-on: https://go-review.googlesource.com/14371
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 15:53:06 +00:00
Håvard Haugen
259466452d cmd/compile/internal/gc: unexport and make Hasdefer a bool
Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I804ee4252fa9be78cb277faf7f467e6c9cfdd4a6
Reviewed-on: https://go-review.googlesource.com/14319
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 05:45:29 +00:00
Marvin Stenger
704e05c6ec cmd/compile/internal/gc: remove unused field Type.Siggen
Remove unused field Type.Siggen in go.go.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ia61fe65a226c913fbf4a11a71d7453c56aa46c0e
Reviewed-on: https://go-review.googlesource.com/14372
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-08 05:28:37 +00:00
Håvard Haugen
391cc54da8 cmd/compile: make importlist a []*Node instead of *NodeList
Passes go build -a -toolexec 'toolstash -cmp' std.

Change-Id: Ica62765d3c1ef052afed34da1b3ac3f80646cc55
Reviewed-on: https://go-review.googlesource.com/14318
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 03:41:24 +00:00
Dave Cheney
8937780c8a cmd/compile/internal/gc: convert Type.Broke into a bool
Convert Type.Broke from a uint8 to a boolean

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I44e7548c71b00467e36576bdf62933c42555a21a
Reviewed-on: https://go-review.googlesource.com/14307
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Håvard Haugen <havard.haugen@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 03:17:10 +00:00
Dave Cheney
8712e1867b cmd/compile/internal/gc: convert Label.Used to bool
Convert Label.Used to a boolean. Also move the field to the
bottom of the struct to avoid padding.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: If09ee92f9d54dce807e7b862cf771005daed810d
Reviewed-on: https://go-review.googlesource.com/14308
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-07 21:35:06 +00:00
Marvin Stenger
932c1e3dd3 cmd/compile/internal: some janitoring
Nicer swaps, loops (removed tmp variables). Use of bool instead of int.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I541904c74b57297848decc51a8a4913a8eca4af3
Reviewed-on: https://go-review.googlesource.com/14316
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-07 17:42:48 +00:00
Dave Cheney
60f0345667 cmd/dist: fix mkzversion to produce gofmt'd output
Fix mkzversion to produce correctly formatted runtime/zversion.go.

Change-Id: Ie6bcd361a2f2e390b7f6c4980fcae2c41bb7e52f
Reviewed-on: https://go-review.googlesource.com/14355
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-07 06:12:21 +00:00
Dave Cheney
dab0dac01a cmd/compile: convert typecheck_stack to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I4d041b343952f4a31f3150fd70669e08fcaa74f8
Reviewed-on: https://go-review.googlesource.com/14305
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-06 23:50:51 +00:00
Didier Spezia
63e2bed0ab cmd/asm: fix another infinite loop in register list parser
The code parsing register lists involves an inner loop on
each range defined by the lo,hi bounds. The condition on
this loop (for lo<=hi) is fragile, because the bounds
are unsigned 16 bits numbers.

In some corner cases, the calculated upper bound is 2^16-1
leading to an infinite loop.

Parsing operand `[):[o-FP` results in:
- an infinite loop for non ARM architectures
- the generation of almost 2^16 errors for the ARM architecture
  (which are then ignored)

This CL improves the code in 3 ways:
- bail out early when parsing non R prefixed registers
- make sure the register index is never negative
- make sure the number of iterations is limited by the
  maximum size of the range (as a defensive measure).

Fixes #12469

Change-Id: Ib1e7e36fb8ad5a3a52c50fc6219d3cfe2b39cc34
Reviewed-on: https://go-review.googlesource.com/14314
Reviewed-by: Rob Pike <r@golang.org>
2015-09-05 18:57:11 +00:00
Dave Cheney
22452ac592 cmd/compile: use []*Node instead of NodeList in bottomUpVisitor
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I582ff8b077eb384b84721a1edb0c1efbc0c40059
Reviewed-on: https://go-review.googlesource.com/14304
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-05 04:34:55 +00:00
Dave Cheney
703bd83623 cmd/compile: use []*Node instead of NodeList in sinit
This is a first of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Iad10b75e42b5b24e1694407841282fa3bab2dc9f
Reviewed-on: https://go-review.googlesource.com/14232
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-05 02:25:01 +00:00
Robert Griesemer
ace303297f cmd/compile/internal/gc: fix go.y (rename of Fatal -> Fatalf)
Also go generate to update generated files.

Change-Id: I049708db93455f0030ba5afc6f218fde6220958d
Reviewed-on: https://go-review.googlesource.com/14331
Reviewed-by: Damien Neil <dneil@google.com>
2015-09-05 00:01:33 +00:00
Shawn Walker-Salas
4f74de1e4d cmd/go: fix Go buildid reading on Solaris
TestNoteReading fails on Solaris with linkmode=external due to some
assumptions made about how ELF .note sections are written by some
linkers.

On current versions of Solaris and older derivatives, SHF_ALLOC is
intentionally ignored for .note sections unless the .note section is
assigned to the text segment via a mapfile.  Also, if .note sections
are assigned to the text segment, no PT_NOTE program header will be
created thwarting Go's attempts at attempting to quickly find the
.note.

Furthermore, Go assumes that the relevant note segment will be placed
early in the file while the Solaris linker currently places the note
segment last in the file, additionally thwarting Go's optimisation
attempts that read only the first 16KB of the file to find the
buildid.

The fix is to detect when the note section is outside of the first
16KB of the file and then fallback to additionally reading that
section of the file.  This way, in future versions of Solaris when
this linking behaviour is changed, the fast path will always succeed
and we'll only be slower if it fails; likewise, any other linker that
does this will also just work.

Fixes #12178

Change-Id: I61c1dc3f744ae3ad63938386d2ace8a432c0efe1
Reviewed-on: https://go-review.googlesource.com/14210
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-09-04 20:01:09 +00:00
Dave Cheney
e49b2460a4 Revert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object"
This reverts commit 2c2cbb69c8.

Broke darwin/arm64

Change-Id: Ibd2dea475d6ce6a8b4b40e2da19a83fc0514025d
Reviewed-on: https://go-review.googlesource.com/14301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 19:47:36 +00:00
Didier Spezia
3c37a61455 cmd/compile/internal: slice/map literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I5c58801c20919618d2ad52b8e2380d53df2783f1
Reviewed-on: https://go-review.googlesource.com/13831
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-04 15:27:59 +00:00
Michael Hudson-Doyle
876b7cc227 cmd/compile, cmd/go: generate position independent code with -buildmode=c-shared on arm
All the code was there to do this, it just wasn't hooked up.

Fixes #10914

Change-Id: Ide8f9bbe50fecb5d11cd579915ee98d4c7efe403
Reviewed-on: https://go-review.googlesource.com/14142
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 07:08:09 +00:00
Shenghou Ma
821e124c24 cmd/link/internal/ld: align PE .text section to 32-byte when external linking
Some symbols, for example, masks requires 16-byte alignment, and
they are placed in the text section. Before this change, the text
section is only aligned to 4-byte, and it's making masks unaligned.

Fixes #12415.

Change-Id: I7767778d1b4f7d3e74c2719a02848350782a4160
Reviewed-on: https://go-review.googlesource.com/14166
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 05:27:02 +00:00
Michael Hudson-Doyle
2c2cbb69c8 cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object
Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

Fixes #10914
Updates #9210

Change-Id: I7178daadc0ae87953d5a084aa3d580f4e3b46d47
Reviewed-on: https://go-review.googlesource.com/10300
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 05:25:10 +00:00
Michael Hudson-Doyle
eaea5ade2b cmd/asm: fix handling of nested #if[n]defs
The lexer needs to process all #if[n]defs, even those found when processing is
disabled by a preceding failed conditional, or the first #endif in something
like:

    #ifdef <undefined>
    #ifdef whatever
    #endif
    #endif

terminates the first #ifdef and the second causes an error. And then the
processing of the inner #ifdefs needs to ignore their argument when they are
disabled by an outer failed condition.

Change-Id: Iba259498f1e16042f5b7580b9c000bb0599733d0
Reviewed-on: https://go-review.googlesource.com/14253
Reviewed-by: Rob Pike <r@golang.org>
2015-09-04 05:23:28 +00:00
Andrew Gerrand
b8efc006f2 all: remove executable bit from several files
Change-Id: Iab669b2a9dd0510c0e54f9ec1cbe2b83b991bceb
Reviewed-on: https://go-review.googlesource.com/14283
Reviewed-by: Minux Ma <minux@golang.org>
2015-09-04 02:59:49 +00:00
Michael Hudson-Doyle
06da8fd84a cmd/link: only embed runtime.goarm in the module that contains the runtime package
And do it properly so freebsd and nacl still work.

Change-Id: I6f9f30e93ceae6dee59215ed608c6a158bdbdbb0
Reviewed-on: https://go-review.googlesource.com/14280
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 02:20:47 +00:00
Shenghou Ma
dac87e9ed3 cmd/compile/internal/gc: allow //go:systemstack only in runtime
Fixes #12454.

Change-Id: I6406b0119bc4d6c3d1e6f1896b588b7d101448a3
Reviewed-on: https://go-review.googlesource.com/14274
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 02:16:50 +00:00
Michael Hudson-Doyle
c788a8e05d Revert "cmd/link: only embed runtime.goarm in the module that contains the runtime package"
This reverts commit bf99d8f843.

Change-Id: Id4374ed35802cfbfe11e015ccd9526d3497dc8cc
Reviewed-on: https://go-review.googlesource.com/14239
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-03 21:20:53 +00:00
Rob Pike
36af087aef cmd/asm: handle CMPF and CMPD on ARM
These instructions are special cases that were missed in the translation.
The second argument must go into the Reg field not the To field.

Fixes #12458

For Go 1.5.1

Change-Id: Iad57c60c7e38e3bcfafda483ed5037ce670e8816
Reviewed-on: https://go-review.googlesource.com/14183
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-09-03 19:40:11 +00:00
Michael Hudson-Doyle
bf99d8f843 cmd/link: only embed runtime.goarm in the module that contains the runtime package
Change-Id: Ia18984343ca4ced3671d967ff9a5b0e32874430c
Reviewed-on: https://go-review.googlesource.com/14220
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-03 16:22:21 +00:00
Michael Hudson-Doyle
9e6ba37b86 cmd/internal/obj: some platform independent bits of proper toolchain support for thread local storage
Also simplifies some silliness around making the .tbss section wrt internal
vs external linking. The "make TLS make sense" project has quite a few more
steps to go.

Issue #11270

Change-Id: Ia4fa135cb22d916728ead95bdbc0ebc1ae06f05c
Reviewed-on: https://go-review.googlesource.com/13990
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-03 14:06:07 +00:00
Michael Hudson-Doyle
7bf959c67a cmd/internal/obj: remove Link.Tlsoffset
Nothing uses it any more.

Change-Id: I42ee7222b06b1a79b8b44894f3071752f9166d7a
Reviewed-on: https://go-review.googlesource.com/14193
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-03 02:16:22 +00:00
Didier Spezia
df37c4b987 cmd/asm: fix several panics with erroneous input
The parser tries to read as much information as possible,
issuing some errors when needed. Errors generally do not
stop the parsing.

With some pathological input, it may result in various
panics when the error message itself is built, or when the
next operand is parsed. It happens while parsing
pseudo-instructions.

For instance, the following lines all generate a panic:

	TEXT
	TEXT%
	TEXT 1,1
	TEXT $"toto", 0, $1
	FUNCDATA
	DATA 0
	DATA(0),1
	FUNCDATA(SB
	GLOBL 0, 1
	PCDATA 1

Added corresponding tests.

Introduced a writer in the parser to capture error messages
for testing purpose. It defaults to os.Stderr.

Added an explicit check when symbol names cannot be displayed.

Interrupted parsing early when the number of operands is wrong for
pseudo-instructions.

Note that the last point is a change of behavior, because some
operands will not get parsed anymore in case of early error.

IMO, it is acceptable, because only the first error of the line
is considered anyway. If it is not acceptable, it can probably
be improved at the price of a more verbose CL.

Fixes #11765
Fixes #11760
Fixes #11759

Change-Id: I9602a848132e358a1bccad794d7555e0823970dd
Reviewed-on: https://go-review.googlesource.com/13925
Reviewed-by: Rob Pike <r@golang.org>
2015-09-02 20:24:40 +00:00
Håvard Haugen
dc3540d982 compile/internal/gc: make typecheckok a bool
Change-Id: Ib3960321a4c8164f6b221bfd15977d2f34dbc65b
Reviewed-on: https://go-review.googlesource.com/14175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-02 19:08:19 +00:00
Rob Pike
45537d893d cmd/doc: document that json.Decode documents encoding/json.Decoder.Decode
Refine the documentation in cmd/doc and go help doc.

Fixes #12377.

Change-Id: I670c0a5cf18c9c9d5bb9bb222d8a3dd3722a3934
Reviewed-on: https://go-review.googlesource.com/14121
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-02 17:58:17 +00:00
Rob Pike
43a7a9cf43 cmd/vet: diagnose using Printf on a function value
Printing a function value is nearly useless outside of debugging, but
can occur by mistake when one forgets to call it. Diagnose this.

I did this myself just the other day and it arose in cl/14031.
Easy to fix and seems worthwhile.

Fixes #12295.

Change-Id: Ice125a84559f0394f7fa7272b5d31ae602b07f83
Reviewed-on: https://go-review.googlesource.com/14122
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-02 17:58:04 +00:00
Håvard Haugen
dd42eff8fe cmd/compile/internal/gc: use slice instead of NodeList for Label.Use
Change-Id: I021c95df24edbff24ff2922769ef2b2acd47016a
Reviewed-on: https://go-review.googlesource.com/14081
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-01 22:13:16 +00:00
Håvard Haugen
e8da46f6db cmd/compile/internal/gc: remove dead code found by vet
See report in commit 3c9fa388df.

Change-Id: I74a5995a1c1ca62b8d01857e89b084502e7da928
Reviewed-on: https://go-review.googlesource.com/14170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-01 21:21:15 +00:00
Michael Hudson-Doyle
e92d0d82e0 cmd/link: remove some dead code
Change-Id: I125a12a2cb7e792f357e4d841f55c0bed2971dce
Reviewed-on: https://go-review.googlesource.com/14140
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-01 16:28:49 +00:00
Dave Cheney
8d478e845c cmd/internal/obj/arm: remove CASE and BCASE
Update #10994

CASE and BCASE were used by 5c in switch statements, cmd/compile
does not use them.

Change-Id: I7a578c461b52b94690e35460926849b28971b770
Reviewed-on: https://go-review.googlesource.com/14009
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-31 21:03:57 +00:00
Dave Cheney
3578bdf3c3 internal/obj/arm64: remove CASE and BCASE
Fixes #10994

CASE and BCASE were used by 7c in switch statements, cmd/compile
does not use them, cmd/assemble couldn't assemble them, and the arm64
peephole optimiser didn't know about them.

Change-Id: Id04835fcb37e207f76d211ce54a4db9c057d6112
Reviewed-on: https://go-review.googlesource.com/14100
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-31 13:22:55 +00:00
Håvard Haugen
3c9fa388df cmd/compile/internal/gc: rename Fatal to Fatalf
This helps vet see a real issue:

    cmd/internal/gc$ go vet
    gen.go:1223: unreachable code

Fixes #12106.

Change-Id: I720868b07ae6b6d5a4dc6b238baa8c9c889da6d8
Reviewed-on: https://go-review.googlesource.com/14083
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-31 01:35:23 +00:00
Michael Hudson-Doyle
af799d94f9 cmd/link: pass value being relocated to archreloc
And clean up the mess on arm64 (the mess on arm is too confusing).

See issue #10050

Change-Id: I2ce813fe8646d4e818eb660612a7e4b2bb04de4c
Reviewed-on: https://go-review.googlesource.com/13884
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-31 00:07:59 +00:00
Robert Griesemer
3d3bc88bb5 cmd/compile/internal/gc: use slice instead of linked list for nodes to export
Change-Id: Ib79ab787fdc90a5a29b25474d91afa9bfaf51276
Reviewed-on: https://go-review.googlesource.com/13589
Reviewed-by: Minux Ma <minux@golang.org>
2015-08-28 22:49:15 +00:00
Robert Griesemer
68f4f96c1e cmd/compiler/internal/gc: fix argument for Sprintf
Val.Ctype used to be struct field, it's now a method.

Change-Id: I08f0b32b66dba15b2a392e84a557efb905b530cb
Reviewed-on: https://go-review.googlesource.com/14031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-28 22:46:53 +00:00
Russ Cox
63862afb27 cmd/internal/rsc.io: delete
The code is now in cmd/vendor/golang.org/x/arch.

Change-Id: I518d48c21b0d7fed914552b89ee41411f088456b
Reviewed-on: https://go-review.googlesource.com/14021
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-28 16:34:52 +00:00
Russ Cox
90dbd975fd cmd/internal/objfile: use golang.org/x/arch instead of rsc.io
Change-Id: I5348774ff01a5f0f706a1dba4aa9500661841f47
Reviewed-on: https://go-review.googlesource.com/14020
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-28 16:34:39 +00:00
Russ Cox
10efac8782 cmd/vendor/golang.org/x/arch: import arm/armasm and x86/x86asm
For use by cmd/objdump in place of the current cmd/internal/rsc.io/... tree.

Change-Id: I7d765ddf43ab4118a3221fd755ff0a2a02daa5de
Reviewed-on: https://go-review.googlesource.com/13979
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-28 16:34:30 +00:00
Ian Lance Taylor
499845bfe0 cmd/go: -a does apply to the standard library
This changed in https://golang.org/cl/10761.

Update #12203.

Change-Id: Ia37ebb7ecba689ad3cb2559213d675f21cf03a95
Reviewed-on: https://go-review.googlesource.com/13799
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-27 18:34:19 +00:00
Russ Cox
a82ed3bc81 cmd/go: enable vendoring experiment by default
If we're going to do this for Go 1.6 we might as well do it now
and find out what breaks.

Change-Id: I8306b7829d8d13b564a1466c902ec6ba1a5a58c1
Reviewed-on: https://go-review.googlesource.com/13967
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-27 17:33:03 +00:00
Vincent Vanackere
b55c4a0c54 cmd/go: properly ignore import comments for vendored packages rooted at GOPATH
Fixes #12232.

Change-Id: Ide3fb7f5fc5ae377ae8683fbb94fd0dc01480549
Reviewed-on: https://go-review.googlesource.com/13924
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-27 15:30:30 +00:00
Didier Spezia
7437e3f02e cmd/asm: fix potential infinite loop in parser
For ARM machines, the assembler supports list of registers
operands such as [R1,R2].

A list missing a ']' results in the parser issuing many errors
and consuming all the tokens. At EOF (i.e. end of the line),
it still loops.

Normally, a counter is maintained to make sure the parser
stops after 10 errors. However, multiple errors occuring on the
same line are simply ignored. Only the first one is reported.
At most one error per line is accounted.

Missing ']' in a register list therefore results in an
infinite loop.

Fixed the parser by explicitly checking for ']' to interrupt
this loops

In the operand tests, also fixed a wrong entry which I think was
not set on purpose (but still led to a successful result).

Fixes #11764

Change-Id: Ie87773388ee0d21b3a2a4cb941d4d911d0230ba4
Reviewed-on: https://go-review.googlesource.com/13920
Reviewed-by: Rob Pike <r@golang.org>
2015-08-27 10:26:40 +00:00
Michael Hudson-Doyle
af78482d6b cmd/compile, cmd/link, reflect, runtime: remove type.zero field
No longer used after previous hashmap change.

Change-Id: I558470f872281e84a78406132df4e391d077b833
Reviewed-on: https://go-review.googlesource.com/13785
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-26 00:28:17 +00:00
Andy Maloney
dc110f245d cmd/cgo: annotate named return struct members in comments
If an exported function has named return variables, then show the names
as comments in the return struct we create in the header file.

Example here:

 https://groups.google.com/forum/#!topic/golang-nuts/r393ne4zIfY

Change-Id: I21fb4ca2673f6977bec35ccab0cef7d42b311f96
Reviewed-on: https://go-review.googlesource.com/13061
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-26 00:24:34 +00:00
Michael Hudson-Doyle
38519e69d0 cmd/compile, runtime: stop returning t.zero on hashmap miss
Previously t.zero always pointed to runtime.zerovalue. Change the hashmap code
to always return a runtime pointer directly, and change that pointer to point
to a larger buffer if one is needed.

(It might be better to only copy from the pointer returned by the mapaccess
functions when the value type is small enough and have the compiler insert
explicit zeroing for larger value types, but I tried and failed to do this).

This removes all uses of the zero field of the type data; the field itself can
be removed in a separate change.

Fixes #11491

Change-Id: I5b81752ff4067d74a5a281c41e88f151bae0171e
Reviewed-on: https://go-review.googlesource.com/13784
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-26 00:03:21 +00:00
Andy Maloney
79a3d239e9 cmd/cgo: change comments in generated C code to be C-style
Change-Id: I3889eda72ae0f57117f1d4299e3574f8bf68be67
Reviewed-on: https://go-review.googlesource.com/13310
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-26 00:01:08 +00:00
Michael Hudson-Doyle
7f9e443d9c cmd/link: call moduledata symbols "local.moduledata" if they are created by the linker
This was always a bit confusing, but it also fixes a problem: runtime.firstmoduledata
was always overridden in the linker to be a local symbol but cmd/internal/obj had
already rewritten code accessing it to access it via the GOT. This works on amd64, but
causes link failures on other platforms (e.g. arm64).

Change-Id: I9b8153af74b4d0f092211d63a000d15818f39773
Reviewed-on: https://go-review.googlesource.com/13786
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-25 23:48:12 +00:00
Ulrich Kunitz
6ec1809b83 cmd/compile: fix register allocation for == operator
The issue 12226 has been caused by the allocation of the same register
for the equality check of two byte values. The code in cgen.go freed the
register for the second operand before the allocation of the register
for the first operand.

Fixes #12226

Change-Id: Ie4dc33a488bd48a17f8ae9b497fd63c1ae390555
Reviewed-on: https://go-review.googlesource.com/13771
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-25 18:10:14 +00:00
Austin Clements
05a3b1fce5 cmd/compile: fix uninitialized memory in compare of interface value
A comparison of the form l == r where l is an interface and r is
concrete performs a type assertion on l to convert it to r's type.
However, the compiler fails to zero the temporary where the result of
the type assertion is written, so if the type is a pointer type and a
stack scan occurs while in the type assertion, it may see an invalid
pointer on the stack.

Fix this by zeroing the temporary. This is equivalent to the fix for
type switches from c4092ac.

Fixes #12253.

Change-Id: Iaf205d456b856c056b317b4e888ce892f0c555b9
Reviewed-on: https://go-review.googlesource.com/13872
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-25 14:37:08 +00:00
Shenghou Ma
b11c8b9370 cmd/go: skip test using external linking on linux/ppc64 too
While we're at it, also fix a typo.

Change-Id: Id436f33cffa5683e2a8450cce5b545960cf2877e
Reviewed-on: https://go-review.googlesource.com/13878
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-25 01:33:25 +00:00
Josh Bleecher Snyder
397b4f6cbf cmd/internal/obj: delete Debugzerostack dead code
Fixes #11060

Change-Id: I4c6647fc2f103015b67e30dc2cdb6f771526c139
Reviewed-on: https://go-review.googlesource.com/13840
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-23 14:07:14 +00:00
Brad Fitzpatrick
b3a508c03e cmd/compile: in usage messages, name the binary "compile" instead of "Xg"
Fixes #12227

Change-Id: I7c1b93e50736185a641fb637000aae2f15bc04ed
Reviewed-on: https://go-review.googlesource.com/13820
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-08-22 15:39:13 +00:00
Brad Fitzpatrick
2468227038 cmd/compile/internal, cmd/internal/obj: used keyed ProgInfo literals
Safer, more readable, shorter.

Change-Id: I5cf1f438e20a3df45fc43cc5c870a533f7c524bf
Reviewed-on: https://go-review.googlesource.com/10517
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-21 22:32:43 +00:00
Alberto Donizetti
85de30e72f cmd/compile: allow huge rsh in constants arithmetic
Currently an expression like

var v = 0 >> 1000

is rejected by gc with a "stupid shift" error, while gotype
compiles it successfully.

As suggested by gri on the issue tracker, allow an rsh right
operand to be any valid uint value.

Fixes #11328

Change-Id: I6ccb3b7f842338d91fd26ae37dd4fa279d7fc440
Reviewed-on: https://go-review.googlesource.com/13777
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-08-21 20:27:22 +00:00
Robert Griesemer
548041ed08 cmd/compile/internal/big: update vendored math/big
This updates the big package used by the compiler to match the
public big package which contains some updates and bug fixes.
Obtained by running vendor.bash in the internal/big directory.
No manual changes.

Change-Id: I299aecc6599d4a745a721ce48def32449640dbb2
Reviewed-on: https://go-review.googlesource.com/13815
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-21 20:03:16 +00:00
David du Colombier
9538e4e73b cmd/trace: don't fail when no browser is available
When there is no browser available on the system,
we should print the URL instead of failing.

Change-Id: I4a2b099e17609394273eff150062c285d76bbac1
Reviewed-on: https://go-review.googlesource.com/13774
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-08-21 20:02:23 +00:00
Rob Pike
f62b749ae2 all: fix some vet-caught formatting errors, mostly but not only in tests
Could go in 1.5, although not critical.
See also #12107

Change-Id: I7f1608b58581d21df4db58f0db654fef79e33a90
Reviewed-on: https://go-review.googlesource.com/13481
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-08-21 05:37:36 +00:00
David Glasser
7c154d973b cmd/go: fix vendoredImportPath comment
Change-Id: I1650124dd459dc401ccd73943ff7287b1b8c57e4
Reviewed-on: https://go-review.googlesource.com/13689
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-20 08:38:38 +00:00
Russ Cox
6f0c7df8ed cmd/vet: power64 is now ppc64
This was missed when we did the rename months ago
because cmd/vet did not live in the main tree.
Now vet's asmdecl checks will apply to ppc64 assembly too.

Change-Id: I687cba89fef702f29dd118de76a7ca1041c414f6
Reviewed-on: https://go-review.googlesource.com/13677
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-18 17:00:59 +00:00
Russ Cox
5acde2d5aa cmd/go: really skip TestNoteReading on linux/ppc64le
Change-Id: Iaeba7c55bbb9e11ac30f3b61369aa597acc30190
Reviewed-on: https://go-review.googlesource.com/13691
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-18 15:41:54 +00:00
Russ Cox
92c984e064 cmd/go: disable TestNoteReading on solaris, linux/ppc64le
Update #11184 (linux/ppc64).
Filed #12178 (solaris) for Go 1.6.

Change-Id: I9e3a456aaccb49590ad4e14b53ddfefca5b0801c
Reviewed-on: https://go-review.googlesource.com/13679
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-18 15:25:19 +00:00
Russ Cox
f68d1df6b9 cmd/compile: fix interaction between GOEXPERIMENT=fieldtrack and race detector
Tested by hand.
Only lines of code changing are protected by Fieldtrack_enabled > 0,
which is never true in standard Go distributions.

Fixes #12171.

Change-Id: I963b9997dac10829db8ad4bfc97a7d6bf14b55c6
Reviewed-on: https://go-review.googlesource.com/13676
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-18 14:36:01 +00:00
Russ Cox
9e26cde786 cmd/go: fix vendor-related index out of range panic on bad file tree
Fixes #12156.

Change-Id: I2d71163b98bcc770147eb9e78dc551a9d0b5b817
Reviewed-on: https://go-review.googlesource.com/13674
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-18 13:53:28 +00:00
Russ Cox
d2cf46dedf cmd/go: fix spurious rebuild of binaries using cgo on OS X
The text segment starts farther into the binary when using
external linking on the mac. Test and fix.

Fixes #12173.

Change-Id: I1f0c81814bf70cd9decfceac3022784f4608eeef
Reviewed-on: https://go-review.googlesource.com/13672
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-18 13:51:16 +00:00
Russ Cox
3f016215a8 cmd/yacc: fix compile error in empty grammar
Fixes #12154.

Change-Id: I1e6d1a3479a8a6fc8f53aebd18fb142506110809
Reviewed-on: https://go-review.googlesource.com/13673
Reviewed-by: Rob Pike <r@golang.org>
2015-08-18 13:50:36 +00:00
Dave Cheney
467a2cb73c cmd/compile/internal/arm64: remove Reginuse check in clearfat
Fixes golang/go#12133

CL 13630 fixed the use of a stale reg[] array in the various arch
backends which was causing the check in clearfat to pass
unconditionally on arm64.

With this check fixed, arm64 now considers REGRT1 to always be in use
as it is part of the reserved register set, see arm64/gsubr.go.

However, ppc64 does not consider REGRT1 and REGRT2 to be part of its
reserved set, so its identical clearfat check passes.

This CL removes the Reginuse check inside clearfat as REGRT1 is
guarenteed always be free on arm64.

Change-Id: I4719150d3c3378fae155b863c474529df18d4c17
Reviewed-on: https://go-review.googlesource.com/13650
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-16 00:29:39 +00:00
Dmitry Vyukov
e8c4a5b893 cmd/trace: fix static file reference
Use runtime.GOROOT instead of os.Getenv("GOROOT") to reference
trace-viewer html file. GOROOT env var is not necessary set,
runtime.GOROOT has a default value for such case.

Change-Id: I906a720f6822915bd9575756e6cbf6d622857c2b
Reviewed-on: https://go-review.googlesource.com/13593
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-15 17:38:56 +00:00
Rahul Chaudhry
5bf1369c9b cmd/go: make "go test" recognize -exec flag again.
Fixes #12144.

Change-Id: I112c6517371215c9797db8f1dffca0f3047c39e3
Reviewed-on: https://go-review.googlesource.com/13633
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-15 17:38:41 +00:00
Keith Randall
e97ab0a0ac cmd/compile: remove stale register use array
The reg[] array in .../gc is where truth lies.  The copy in .../ARCH
is incorrect as it is mostly not updated to reflect regalloc decisions.

This bug was introduced in the rewrite
https://go-review.googlesource.com/#/c/7853/.  The new reg[] array was
introduced in .../gc but not all of the uses were removed in the
.../ARCH directories.

Fixes #12133

Change-Id: I6364fc403cdab92d802d17f2913ba1607734037c
Reviewed-on: https://go-review.googlesource.com/13630
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-15 17:37:14 +00:00
Dave Cheney
cda1fc0071 cmd/compile/internal/ppc64: disable DUFFZERO
Update #12108

If DUFFZERO is used within a tail call method it will overwrite the
link register.

Change-Id: I6abd2fde0f0ad909ccd55eb119b992673a74f0e2
Reviewed-on: https://go-review.googlesource.com/13570
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-12 20:31:26 +00:00
Russ Cox
58035ec8ee cmd/go: run test binaries in original environment
Fixes #12096.
Followup to CL 12483, which fixed #11709 and #11449.

Change-Id: I9031ea36cc60685f4d6f65c39f770c89b3e3395a
Reviewed-on: https://go-review.googlesource.com/13449
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-11 20:46:22 +00:00
Russ Cox
28fb0d8023 cmd/go: fix addition of "math" dependency for arm binaries
p.ImportPath is the directory-derived path (like cmd/go).
p.Name is the actual package name.

Fixes #12089.

Change-Id: Ief76d42a85f811b0dfe2218affb48551527a7d44
Reviewed-on: https://go-review.googlesource.com/13530
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 19:13:12 +00:00
Russ Cox
8ce80ce87d cmd/link: make -a output not crash
Fixes #12107.

Change-Id: I62f1b6ac9fb6f2cfa3472253dc1c6f7b7d2a6faf
Reviewed-on: https://go-review.googlesource.com/13448
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-11 19:12:59 +00:00
Rob Pike
546836556d cmd/yacc: use %q to print strings in Toknames
Fixes #12086

Belongs in 1.5

There remains a question of why the Statenames table's elements
are not printed. What purpose does that serve?

Change-Id: I83fd57b81d5e5065c3397a66ed457fc0d1c041bd
Reviewed-on: https://go-review.googlesource.com/13462
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2015-08-11 00:26:05 +00:00
Andrew Gerrand
0cd2999c3b cmd/go: replace code.google.com examples in docs with relevant repos
Change-Id: I625c9df161da2febdca85741c75fc32d4bef420b
Reviewed-on: https://go-review.googlesource.com/13344
Reviewed-by: Rob Pike <r@golang.org>
2015-08-07 05:52:11 +00:00
Russ Cox
0fb87abddf cmd/go: fix handling of vendored imports in foo_test.go files
Fixes #11977.
Fixes #11988.

Change-Id: I9f80006946d3752ee6d644ee51f2decfeaca1ff6
Reviewed-on: https://go-review.googlesource.com/13230
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-08-05 23:13:19 +00:00
Russ Cox
7d9faaa19f cmd/go: skip external tests on freebsd-arm builder
It is just far too slow.
I have a CL for Go 1.6 that makes many of these into internal tests.
That will improve the coverage.

It does not matter much, because basically none of the go command
tests are architecture dependent, so the other builders will catch
any problems.

Fixes freebsd-arm builder.

Change-Id: I8b2f6ac2cc1e7657019f7731c6662dc43e20bfb5
Reviewed-on: https://go-review.googlesource.com/13166
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-05 16:13:37 +00:00
Ian Lance Taylor
c2ef8e752f cmd/go: fix documentation for exported functions
I accidentally submitted https://golang.org/cl/13080 too early.

Update #11955.

Change-Id: I1a5a6860bb46bc4bc6fd278f8a867d2dd9e411e1
Reviewed-on: https://go-review.googlesource.com/13096
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-04 18:30:00 +00:00
Ian Lance Taylor
bc5a6ce6be cmd/go: document that functions are exported by cgo
The buildmode docs mention exported functions, but don't say anything
about how to export them.  Mention the cgo tool to make this somewhat
clearer.

Fixes #11955.

Change-Id: Ie5420445daa87f5aceec6ad743465d5d32d0a786
Reviewed-on: https://go-review.googlesource.com/13080
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-04 04:50:07 +00:00
Caleb Spare
8ac16b9d52 cmd/go: re-run mkalldocs.sh after testflag change
Change-Id: Ia21501df23a91c065d9f2acc6f043019a1419b22
Reviewed-on: https://go-review.googlesource.com/13092
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-04 00:26:58 +00:00
Caleb Spare
a65fa20541 cmd/go: documented default value of the -timeout testflag
Change-Id: I4dc75065038a9cfd06f61c0deca1c86c70713d3a
Reviewed-on: https://go-review.googlesource.com/13091
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-04 00:05:49 +00:00
Russ Cox
b3bf38e79d cmd/go: clean up installHeader action
This was confusing when I was trying to fix go build -o.
Perhaps due to that fix, this can now be simplified from
three functions to one.

Change-Id: I878a6d243b14132a631e7c62a3bb6d101bc243ea
Reviewed-on: https://go-review.googlesource.com/13027
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-03 20:00:07 +00:00
Russ Cox
961f456a1d cmd/go: document and fix 'go build -o' semantics
Quoting the new docs:

«
If the arguments to build are a list of .go files, build treats
them as a list of source files specifying a single package.

When compiling a single main package, build writes
the resulting executable to an output file named after
the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe')
or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe').
The '.exe' suffix is added when writing a Windows executable.

When compiling multiple packages or a single non-main package,
build compiles the packages but discards the resulting object,
serving only as a check that the packages can be built.

The -o flag, only allowed when compiling a single package,
forces build to write the resulting executable or object
to the named output file, instead of the default behavior described
in the last two paragraphs.
»

There is a change in behavior here, namely that 'go build -o x.a x.go'
where x.go is not a command (not package main) did not write any
output files (back to at least Go 1.2) but now writes x.a.
This seems more reasonable than trying to explain that -o is
sometimes silently ignored.

Otherwise the behavior is unchanged.

The lines being deleted in goFilesPackage look like they are
setting up 'go build x.o' to write 'x.a', but they were overridden
by the p.target = "" in runBuild. Again back to at least Go 1.2,
'go build x.go' for a non-main package has never produced
output. It seems better to keep it that way than to change it,
both for historical consistency and for consistency with
'go build strings' and 'go build std'.

All of this behavior is now tested.

Fixes #10865.

Change-Id: Iccdf21f366fbc8b5ae600a1e50dfe7fc3bff8b1c
Reviewed-on: https://go-review.googlesource.com/13024
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
2015-08-03 19:59:08 +00:00
Ian Lance Taylor
384789e82b cmd/objdump: don't run TestDisasmExtld if cgo is not enabled
The test uses external linking mode, which is probably not available
if cgo does not work.

Fixes #11969.

Change-Id: Id1c2828cd2540391e16b422bf51674ba6ff084b0
Reviewed-on: https://go-review.googlesource.com/13005
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-31 20:16:22 +00:00
Russ Cox
226b28c85c cmd/go: fix go get x/... matching internal directories
Fixes #11960.

Change-Id: I9361a9f17f4eaf8e4f54b4ba380fd50a4b9cf003
Reviewed-on: https://go-review.googlesource.com/13023
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-31 18:49:57 +00:00
Russ Cox
45971c60c3 cmd/go: fix disallow of p/vendor/x during vendor experiment
The percolation of errors upward in the load process could
drop errors, meaning that a build tree could, depending on the
processing order, import the same directory as both "p/vendor/x"
and as "x". That's not supposed to be allowed. But then, worse,
the build would generate two jobs for building that directory,
which would use the same work space and overwrite each other's files,
leading to very strange failures.

Two fixes:

1. Fix the propagation of errors upward (prefer errors over success).
2. Check explicitly for duplicated packages before starting a build.

New test for #1.
Since #2 can't happen, tested #2 by hand after reverting fix for #1.

Fixes #11913.

Change-Id: I6d2fc65f93b8fb5f3b263ace8d5f68d803a2ae5c
Reviewed-on: https://go-review.googlesource.com/13022
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-31 18:49:45 +00:00
Russ Cox
c5dff7282e cmd/compile, runtime: fix placement of map bucket overflow pointer on nacl
On most systems, a pointer is the worst case alignment, so adding
a pointer field at the end of a struct guarantees there will be no
padding added after that field (to satisfy overall struct alignment
due to some more-aligned field also present).

In the runtime, the map implementation needs a quick way to
get to the overflow pointer, which is last in the bucket struct,
so it uses size - sizeof(pointer) as the offset.

NaCl/amd64p32 is the exception, as always.
The worst case alignment is 64 bits but pointers are 32 bits.
There's a long history that is not worth going into, but when
we moved the overflow pointer to the end of the struct,
we didn't get the padding computation right.
The compiler computed the regular struct size and then
on amd64p32 added another 32-bit field.
And the runtime assumed it could step back two 32-bit fields
(one 64-bit register size) to get to the overflow pointer.
But in fact if the struct needed 64-bit alignment, the computation
of the regular struct size would have added a 32-bit pad already,
and then the code unconditionally added a second 32-bit pad.
This placed the overflow pointer three words from the end, not two.
The last two were padding, and since the runtime was consistent
about using the second-to-last word as the overflow pointer,
no harm done in the sense of overwriting useful memory.
But writing the overflow pointer to a non-pointer word of memory
means that the GC can't see the overflow blocks, so it will
collect them prematurely. Then bad things happen.

Correct all this in a few steps:

1. Add an explicit check at the end of the bucket layout in the
compiler that the overflow field is last in the struct, never
followed by padding.

2. When padding is needed on nacl (not always, just when needed),
insert it before the overflow pointer, to preserve the "last in the struct"
property.

3. Let the compiler have the final word on the width of the struct,
by inserting an explicit padding field instead of overwriting the
results of the width computation it does.

4. For the same reason (tell the truth to the compiler), set the type
of the overflow field when we're trying to pretend its not a pointer
(in this case the runtime maintains a list of the overflow blocks
elsewhere).

5. Make the runtime use "last in the struct" as its location algorithm.

This fixes TestTraceStress on nacl/amd64p32.
The 'bad map state' and 'invalid free list' failures no longer occur.

Fixes #11838.

Change-Id: If918887f8f252d988db0a35159944d2b36512f92
Reviewed-on: https://go-review.googlesource.com/12971
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2015-07-31 18:49:32 +00:00
Russ Cox
782eea0190 cmd/internal/obj/arm: fix large stack offsets on nacl/arm
The code already fixed large non-stack offsets
but explicitly excluded stack references.
Perhaps you could get away with that before,
but current versions of nacl reject such stack
references. Rewrite them the same as the others.

For #11956 but probably not the last problem.

Change-Id: I0db4e3a1ed4f88ccddf0d30228982960091d9fb7
Reviewed-on: https://go-review.googlesource.com/13010
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-07-31 04:35:48 +00:00
Russ Cox
66cb5cd530 cmd/link: increase ELFRESERVE to a full page
Etcd and kubernetes have hit this.
See  https://bugzilla.redhat.com/show_bug.cgi?id=1248071

Change-Id: I6231013efa0a19ee74f7ebacd1024adb368af83a
Reviewed-on: https://go-review.googlesource.com/12951
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-31 02:18:35 +00:00
Ian Lance Taylor
3548a1e7b8 cmd/go: permit installing into a subdirectory of $GOPATH/bin
In https://golang.org/cl/12080 we forbade installing cross-compiled
binaries into a subdirectory of $GOBIN, in order to fix
https://golang.org/issue/9769.  However, that fix was too aggressive,
in that it also forbade installing into a subdirectory of $GOPATH/bin.

This patch permits installing cross-compiled binaries into a
subdirectory $GOPATH/bin while continuing to forbid installing into a
subdirectory of $GOBIN.

Fixes #11778.

Change-Id: Ibc9919554e8c275beff54ec8bf919cfaa03b11ba
Reviewed-on: https://go-review.googlesource.com/12938
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-31 00:37:44 +00:00
David Chase
6f6bcadc17 cmd/compile: add case for ODOTTYPE to escwalk
ODOTTYPE should be treated a whole lot like ODOT,
but it was missing completely from the switch in
escwalk and thus escape status did not propagate
to fields.

Since interfaces are required to trigger this bug,
the test was added to escape_iface.go.

Fixes #11931.

Change-Id: Id0383981cc4b1a160f6ad447192a112eed084538
Reviewed-on: https://go-review.googlesource.com/12921
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-30 17:39:44 +00:00
Russ Cox
b2dfacf35e runtime: change arm software div/mod call sequence not to modify stack
Instead of pushing the denominator argument on the stack,
the denominator is now passed in m.

This fixes a variety of bugs related to trying to take stack traces
backwards from the middle of the software div/mod routines.
Some of those bugs have been kludged around in the past,
but others have not. Instead of trying to patch up after breaking
the stack, this CL stops breaking the stack.

This is an update of https://golang.org/cl/19810043,
which was rolled back in https://golang.org/cl/20350043.

The problem in the original CL was that there were divisions
at bad times, when m was not available. These were divisions
by constant denominators, either in C code or in assembly.
The Go compiler knows how to generate division by multiplication
for constant denominators, but the C compiler did not.
There is no longer any C code, so that's taken care of.
There was one problematic DIV in runtime.usleep (assembly)
but https://golang.org/cl/12898 took care of that one.
So now this approach is safe.

Reject DIV/MOD in NOSPLIT functions to keep them from
coming back.

Fixes #6681.
Fixes #6699.
Fixes #10486.

Change-Id: I09a13c76ad08ba75b3bd5d46a3eb78e66a84ab38
Reviewed-on: https://go-review.googlesource.com/12899
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-30 16:14:05 +00:00
Ian Lance Taylor
7904946eeb cmd/cgo: discard trailing zero-sized fields in a non-empty C struct
In order to fix issue #9401 the compiler was changed to add a padding
byte to any non-empty Go struct that ends in a zero-sized field.  That
causes the Go version of such a C struct to have a different size than
the C struct, which can considerable confusion.  Change cgo so that it
discards any such zero-sized fields, so that the Go and C structs are
the same size.

This is a change from previous releases, in that it used to be
possible to refer to a zero-sized trailing field (by taking its
address), and with this change it no longer is.  That is unfortunate,
but something has to change.  It seems better to visibly break
programs that do this rather than to silently break programs that rely
on the struct sizes being the same.

Update #9401.
Fixes #11925.

Change-Id: I3fba3f02f11265b3c41d68616f79dedb05b81225
Reviewed-on: https://go-review.googlesource.com/12864
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-30 15:55:25 +00:00
Russ Cox
a1e422071c cmd/internal/obj/arm: fix line numbers after constant pool
If a function is large enough to need to flush the constant pool
mid-function, the line number assignment code was forcing the
line numbers not just for the constant pool but for all the instructions
that follow it. This made the line number information completely
wrong for all but the beginning of large functions on arm.

Same problem in code copied into arm64.

This broke runtime/trace's TestTraceSymbolize.

Fixes arm build.

Change-Id: I84d9fb2c798c4085f69b68dc766ab4800c7a6ca4
Reviewed-on: https://go-review.googlesource.com/12894
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-07-30 15:47:31 +00:00
Russ Cox
c4092ac398 cmd/compile: fix uninitialized memory during type switch assertE2I2
Fixes arm64 builder crash.

The bug is possible on all architectures; you just have to get lucky
and hit a preemption or a stack growth on entry to assertE2I2.
The test stacks the deck.

Change-Id: I8419da909b06249b1ad15830cbb64e386b6aa5f6
Reviewed-on: https://go-review.googlesource.com/12890
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-07-30 05:21:56 +00:00
Russ Cox
c1ccbab097 cmd/internal/obj/arm64: fix build
Change-Id: I3088e17aff72096e3ec2ced49c70564627c982a6
Reviewed-on: https://go-review.googlesource.com/12854
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-29 21:44:27 +00:00
Russ Cox
034a10d44c cmd/internal/obj/arm64: reject misaligned stack frames, except empty frames
The layout code has to date insisted on stack frames that are 16-aligned
including the saved LR, and it ensured this by growing the frame itself.
This breaks code that refers to values near the top of the frame by positive
offset from SP, and in general it's too magical: if you see TEXT xxx, $N,
you expect that the frame size is actually N, not sometimes N and sometimes N+8.

This led to a serious bug in the compiler where ambiguously live values
were not being zeroed correctly, which in turn triggered an assertion
in the GC about finding only valid pointers. The compiler has been
fixed to always emit aligned frames, and the hand-written assembly
has also been fixed.

Now that everything is aligned, make unaligned an error instead of
something to "fix" silently.

For #9880.

Change-Id: I05f01a9df174d64b37fa19b36a6b6c5f18d5ba2d
Reviewed-on: https://go-review.googlesource.com/12848
Reviewed-by: Austin Clements <austin@google.com>
2015-07-29 21:37:12 +00:00
Russ Cox
767e065809 cmd/link: fix nosplit stack overflow checks
The nosplit stack overflow checks were confused about morestack.
The comment about not having correct SP information at the call
to morestack was true, but that was a real bug, not something to
work around. I fixed that problem in CL 12144. With that fixed,
no need to special-case morestack in the way done here.

This cleanup and simplification of the code was the first step
to fixing a bug that happened when I started working on the
arm64 frame size adjustments, but the cleanup was sufficient
to make the bug go away.

For #9880.

Change-Id: I16b69a5c16b6b8cb4090295d3029c42d606e3b9b
Reviewed-on: https://go-review.googlesource.com/12846
Reviewed-by: Austin Clements <austin@google.com>
2015-07-29 21:36:16 +00:00
Russ Cox
3952057cf6 cmd/compile: align arm64 stack frames correctly
If the compiler doesn't do it, cmd/internal/obj/arm64 will,
and that will break the zeroing of ambiguously live values
done in zerorange, which in turn produces uninitialized
pointer cells that the GC trips over.

For #9880.

Change-Id: Ice97c30bc8b36d06b7b88d778d87fab8e1827fdc
Reviewed-on: https://go-review.googlesource.com/12847
Reviewed-by: Austin Clements <austin@google.com>
2015-07-29 21:34:50 +00:00
Mikio Hara
861af80458 cmd/internal/asm: delete
Updates #10510.

Change-Id: Ib4d39943969d18517b373292b83d87650d5df12a
Reviewed-on: https://go-review.googlesource.com/12787
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-29 04:53:08 +00:00
Rob Pike
ba0c142d32 cmd: delete old[5689]a
These are the old assemblers written in C, and now they are
not needed.

Fixes #10510.

Change-Id: Id9337ffc8eccfd93c84b2e23f427fb1a576b543d
Reviewed-on: https://go-review.googlesource.com/12784
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-29 03:45:26 +00:00
Matthew Dempsky
6c08213dc0 cmd/dist: cleanup message about building go_bootstrap
At this stage, dist is only building go_bootstrap as cmd/compile and
the rest of the Go toolchain has already been built.

Change-Id: I6f99fa00ff1d3585e215f4ce84d49344c4fcb8a5
Reviewed-on: https://go-review.googlesource.com/12779
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-28 23:30:18 +00:00
Russ Cox
cd3a5edb04 cmd/go: fix go get -u with vendoring
Fixes #11864.

Change-Id: Ib9d5bd79f3b73ebd32f6585b354aaad556e0fc71
Reviewed-on: https://go-review.googlesource.com/12749
Reviewed-by: Rob Pike <r@golang.org>
2015-07-28 23:28:37 +00:00
David Crawshaw
17efbfc560 cmd/doc: extend darwin/arm64 test TODO to arm
Change-Id: Iee0f3890d66b4117aa5d9f486e5775b1cf31996c
Reviewed-on: https://go-review.googlesource.com/12745
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-28 17:39:19 +00:00
Russ Cox
ce23729af2 cmd/asm: fix and test CALL, JMP aliases on arm, arm64, ppc64
Fixes #11900.

Change-Id: Idfc54e1fac833c8d646266128efe46214a82dfed
Reviewed-on: https://go-review.googlesource.com/12741
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-07-28 14:19:53 +00:00
Jeff R. Allen
a7e81c37f4 cmd/go: avoid long lines in help messages
Reformat some help messages to stay within 80 characters.

Fixes #11840.

Change-Id: Iebafcb616f202ac44405e5897097492a79a51722
Reviewed-on: https://go-review.googlesource.com/12514
Reviewed-by: Rob Pike <r@golang.org>
2015-07-28 09:36:32 +00:00
Russ Cox
669f5be2ac cmd/go: prefer <meta> tags on launchpad.net to the hard-coded logic
Fixes #11436.

Change-Id: I5c4455e9b13b478838f23ac31e6343672dfc60af
Reviewed-on: https://go-review.googlesource.com/12143
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-28 03:30:44 +00:00
David Crawshaw
fd9b9c31fb cmd/go: import runtime/cgo into darwin/arm64 tests
Until cl/12721 and cl/12574, all standard library tests included
runtime/cgo on darwin/arm64 by virtue of package os including it. Now
that is no longer true, runtime/cgo needs to be added by the go tool
just as it is for darwin/arm. (This installs the Mach exception
handler used to properly handle EXC_BAD_ACCESS.)

Fixes #11901

Change-Id: I991525f46eca5b0750b93595579ebc0ff10e47eb
Reviewed-on: https://go-review.googlesource.com/12723
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-28 03:19:25 +00:00
Ian Lance Taylor
129cfa2745 cmd/dist: run misc/cgo/testsovar on darwin and netbsd
CL https://golang.org/cl/12470 has reportedly fixed the problems that
the misc/cgo/testsovar test encountered on darwin and netbsd.  Let's
actually run the test.

Update #10360.
Update #11654.

Change-Id: I4cdd27a8ec8713620e0135780a03f63cfcc538d0
Reviewed-on: https://go-review.googlesource.com/12702
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-27 18:10:26 +00:00
Russ Cox
ea085414ef cmd/go: do not panic on template I/O error
Fixes #11839.

Change-Id: Ie092a3a512a2d35967364b41081a066ab3a6aab4
Reviewed-on: https://go-review.googlesource.com/12571
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 17:44:02 +00:00
Russ Cox
00cf88e2c6 cmd/go: use hg repo for code.google.com shutdown check
svn dies due to not being able to validate the googlecode.com certificate.
hg does not even attempt to validate it.

Fixes #11806.

Change-Id: I84ced5aa84bb1e4a4cdb2254f2d08a64a1ef23f6
Reviewed-on: https://go-review.googlesource.com/12558
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 17:32:48 +00:00
Russ Cox
ca2a66431e cmd/go: fix custom import path wildcards (go get rsc.io/pdf/...)
Fixes TestGoGetWorksWithVanityWildcards,
but that test uses the network and is not run
on the builders.

For #11806.

Change-Id: I35c6677deaf84e2fa9bdb98b62d80d388b5248ae
Reviewed-on: https://go-review.googlesource.com/12557
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 17:32:27 +00:00
Rob Pike
3dcfb72fa3 cmd/go: mention go tool compile etc. in the help text for build
Not everyone is aware that go build is a wrapper for other
tools. Mention this in the text for go help build so people using
other build systems won't just wrap go build, which is usually a
mistake (it doesn't do incremental builds by default, for instance).

Update #11854.

Change-Id: I759f91f23ccd3671204c39feea12a3bfaf9f0114
Reviewed-on: https://go-review.googlesource.com/12625
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 01:09:36 +00:00
Ian Lance Taylor
dc4dd57594 cmd/cgo: document how CGO_ENABLED works today
Fixes #9530.

Change-Id: Iadfc027c7164e3ba35adb5c67deb42b51d3498ca
Reviewed-on: https://go-review.googlesource.com/12603
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-07-26 21:04:47 +00:00
Matthew Dempsky
c09d284953 cmd/compile: add missing quotation mark
Change-Id: I102901e3df76830ccd5ab74d757203d103eef9e8
Reviewed-on: https://go-review.googlesource.com/12657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-24 22:12:14 +00:00
Ian Lance Taylor
d23973d23c cmd/go: document environment variables
This adds documentation for all the environment variables I could
locate in the go tool and the commands that it invokes.

Fixes #9672.

Change-Id: Id5f09160a3a8a938af4a3fcb8757eb3eced05416
Reviewed-on: https://go-review.googlesource.com/12620
Reviewed-by: Rob Pike <r@golang.org>
2015-07-24 05:19:09 +00:00
David Chase
731dcdae6d cmd/compile: prepend captured args to called-closure params
Old code appended, did not play well with a closure
with a ... param.

Fixes #11075.

Change-Id: Ib7c8590c5c4e576e798837e7499e00f3494efb4a
Reviewed-on: https://go-review.googlesource.com/12580
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2015-07-23 19:02:19 +00:00
Ian Lance Taylor
ad84f84cb4 cmd/link: don't generate .exe extension for external Windows link
On Windows, gcc -o foo will generate foo.exe.  Prevent that from
happening by adding a final '.' if necessary so that GCC thinks that
the file already has an extension.

Also remove the initial output file when doing an external link, and
use mayberemoveoutfile, not os.Remove, when building an archive
(otherwise we will do the wrong thing for -buildmode=c-archive -o
/dev/null).

I didn't add a test, as it requires using cgo and -o on Windows.

Fixes #11725.

Change-Id: I6ea12437bb6b4b9b8ee5c3b52d83509fa2437b2d
Reviewed-on: https://go-review.googlesource.com/12243
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-23 17:49:44 +00:00
David Chase
2584974d16 cmd/compile: adjust annotation of implicit operations.
Limit probe to ODOT/OIND/ODOTPTR for now; that works.

Fixes #11790

Change-Id: I411271e702c5fe6ceb880ca47c7dacc37ffcbb6a
Reviewed-on: https://go-review.googlesource.com/12532
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-23 14:19:07 +00:00
Russ Cox
aad4fe4d8f cmd/go: document internal and vendor
Fixes #11606.

Change-Id: I70d38c22812c17119b998aad9c1c68e7cf74e98a
Reviewed-on: https://go-review.googlesource.com/12524
Reviewed-by: Rob Pike <r@golang.org>
2015-07-23 05:50:53 +00:00
Russ Cox
5659964d67 cmd/link: write combined dwarf file to same directory as output file
Fixes #11681.

Change-Id: I679d71ed25ac585af7d43611be01c1a0c4807871
Reviewed-on: https://go-review.googlesource.com/12554
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-23 03:52:20 +00:00
Russ Cox
3bab4ef68d cmd/pprof: fix race between viewer and web command
Fixes #11729.

Change-Id: I6e5e23169ac1368afcbd016ed544a710aa045326
Reviewed-on: https://go-review.googlesource.com/12553
Reviewed-by: Rob Pike <r@golang.org>
2015-07-23 03:51:39 +00:00
Ian Lance Taylor
a5caa7c94e cmd/go: for get -t and list, look up path in vendor directories
This is needed to handle vendor directories correctly.  It was already
done for the regular imports when the package was loaded, but not for
the test-only imports.

It would be nice to do this while loading the package, but that breaks
the code that checks for direct references to vendor packages when
running go test.  This change is relatively contained.

While we're at it, skip "C" test imports in go get.

Fixes #11628.
Fixes #11717.

Change-Id: I9cc308cf45683e3ff905320c2b5cb45db7716846
Reviewed-on: https://go-review.googlesource.com/12488
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 21:16:53 +00:00
Russ Cox
75d779566b runtime/cgo: make compatible with race detector
Some routines run without and m or g and cannot invoke the
race detector runtime. They must be opaque to the runtime.
That used to be true because they were written in C.
Now that they are written in Go, disable the race detector
annotations for those functions explicitly.

Add test.

Fixes #10874.

Change-Id: Ia8cc28d51e7051528f9f9594b75634e6bb66a785
Reviewed-on: https://go-review.googlesource.com/12534
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-22 20:28:47 +00:00
Russ Cox
0acecb7164 cmd/link: elide individual gcbits symbols
Same as we do for string symbols.

Fixes #11583.

Change-Id: Ia9264f6faf486697d987051b7f9851d37d8ad381
Reviewed-on: https://go-review.googlesource.com/12531
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-22 20:27:24 +00:00
Konstantin Shaposhnikov
428ed1e3d9 cmd/go: support git.apache.org Git repos
This change fixes resolution of secure (https) repo URL for
git.apache.org Git repositories.

E.g. the correct repo URL for git.apache.org/thrift.git/lib/go/thrift is
https://git.apache.org/thrift.git, not https://git.apache.org/thrift

Fixes #10797

Change-Id: I67d5312ad8620eb780e42c2e002c8f286f60645a
Reviewed-on: https://go-review.googlesource.com/10092
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 19:50:08 +00:00
Ingo Krabbe
1e9f59a7da cmd/dist: add command output for dist tests
It is very useful to see which test commands are executed.
This is of global use, but I wrote it for #11654.

Change-Id: I9bfc8e55d5bef21f4c49b917f58bc9a44aefcade
Reviewed-on: https://go-review.googlesource.com/12510
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 17:39:44 +00:00
Russ Cox
d709434313 cmd/go: fix missing internal import error
Fixes #11331.

Change-Id: I19b8172421044c301bc136fc8f7bfdadbf880e25
Reviewed-on: https://go-review.googlesource.com/12450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-22 17:33:18 +00:00
Dmitry Vyukov
ae1ea2aa94 runtime/trace: add new package
Move tracing functions from runtime/pprof to the new runtime/trace package.

Fixes #9710

Change-Id: I718bcb2ae3e5959d9f72cab5e6708289e5c8ebd5
Reviewed-on: https://go-review.googlesource.com/12511
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 15:47:16 +00:00
Brad Fitzpatrick
fc7f6d307a cmd/dist: remove prints during test registration
dist test should not print (especially to stdout) during test
registration.  This confuses other tools interacting with dist using
dist test --list, etc.

Change-Id: Ie4f82c13e49590c23a7a235d90ddbc4f5ed81e0b
Reviewed-on: https://go-review.googlesource.com/12487
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-21 22:40:01 +00:00
Ian Lance Taylor
c97b49976d cmd/go: fix typo in comment
Change-Id: I3d5e46d376953fbdd21ce8c161214eaed6378d84
Reviewed-on: https://go-review.googlesource.com/12490
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-21 22:25:11 +00:00
Ian Lance Taylor
419a6c0709 cmd/go: pass an unmodified environment to a go run program
Fixes #11709.
Fixed #11449.

Change-Id: If8fdb27d3dc25fb7017226d143a29cbebc1374c5
Reviewed-on: https://go-review.googlesource.com/12483
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-21 22:19:00 +00:00
Ian Lance Taylor
72921c663d cmd/go: skip TestGoInstallErrorOnCrossCompileToBin in short mode
That test will install cmd/pack for linux_386; we don't want to change
GOROOT in short mode.

Change-Id: I4b00c578a99779a13c558208bfd4115f8f0513fa
Reviewed-on: https://go-review.googlesource.com/12481
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-21 19:31:54 +00:00
Ian Lance Taylor
e9fcd6ed2b cmd/link: if -B option was used, pass it to the external linker
Fixes #10607.

Change-Id: Ib294cf65b07103b60f62b86b21ff2d07b25136fe
Reviewed-on: https://go-review.googlesource.com/12242
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-21 03:57:55 +00:00
Brad Fitzpatrick
852f383c9b api: add go1.5.txt API file, reset next.txt
Fixes #11752

Change-Id: If4196b4bbba4f1485608bfafa98fa54781177273
Reviewed-on: https://go-review.googlesource.com/12325
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-21 02:48:35 +00:00
Ian Lance Taylor
1a0818a40d cmd/dist: increase timeout for standard tests
The cmd/go tests run too long on a Raspberry Pi.  I've cut times as
much as I can see without more serious steps like not running tests.

Fixes #11779.

Change-Id: Ice5da052902decea2e6ac32d0f2ce084c39ea1ab
Reviewed-on: https://go-review.googlesource.com/12368
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-20 18:05:59 +00:00
Ian Lance Taylor
510f1dbad7 cmd/go: build errors rather than fmt in a couple of tests
The errors package is smaller and builds faster.

Update #11779.

Change-Id: Iaf2d43734ec4b0aa325590eb5d38522306b608cb
Reviewed-on: https://go-review.googlesource.com/12366
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-20 16:31:37 +00:00
Ian Lance Taylor
b9a3e5979d cmd/go: build errors rather than strings in some tests
Speed up the test suite by building the errors package rather than the
strings package in some cases where the specific package we are
building doesn't matter.  The errors package is smaller, and doesn't
have any assembler code.

Also make a couple of tests run in parallel.

Update #11779.

Change-Id: I62e47f8655f9d85bf93c70ae6e6121276d96aee0
Reviewed-on: https://go-review.googlesource.com/12365
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-20 15:57:05 +00:00
Ian Lance Taylor
f35868a49a cmd/go: don't run TestInstalls in short mode
It changes GOROOT, so we shouldn't run it in short mode.  Also, it's
fairly slow.

Update #11779.

Change-Id: I3d3344954cf9b2ac70070c878a67cb65ac8fd85c
Reviewed-on: https://go-review.googlesource.com/12364
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-20 03:27:22 +00:00
Ian Lance Taylor
f7e7719f65 cmd/go: rewrite TestNoteReading to use test harness
On my laptop reduces time required for test from 22 seconds to 0.14
seconds.

Update #11779.

Change-Id: I715d85bd9c6f7683c6915eedd2539813aa5efc58
Reviewed-on: https://go-review.googlesource.com/12363
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-20 03:25:18 +00:00
Michael Hudson-Doyle
1125cd4997 cmd/compile: define func value symbols at declaration
This is mostly Russ's https://golang.org/cl/12145 but with some extra fixes to
account for the fact that function declarations without implementations now
break shared libraries, and including my test case.

Fixes #11480.

Change-Id: Iabdc2934a0378e5025e4e7affadb535eaef2c8f1
Reviewed-on: https://go-review.googlesource.com/12340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-20 00:50:46 +00:00
Ian Lance Taylor
dabb268170 cmd/compile: ignore carriage return in magic comments
Update #11771.

Change-Id: I3bb3262619765d3ca79652817e17e8f260f41907
Reviewed-on: https://go-review.googlesource.com/12379
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-18 17:33:53 +00:00
Ian Lance Taylor
c4f18d5374 cmd/go: ignore import of "C" when fetching dependencies
The change https://golang.org/cl/12192 changed the get code to use the
list of package imports, not the computed list of dependencies, as the
computed list could be out of date if the package changed when using
go get -u.  Computing the dependency list would skip an import of "C",
but that would still be on the package import list.  This changes the
code to skip "C" when walking the import list.

No test--the best test would be to add an import of "C" to
github.com/rsc/go-get-issue-9224-cmd for TestGoGetUpdate.

Fixes #11738.

Change-Id: Id89ddafeade2391d15688bfd142fafd67844a941
Reviewed-on: https://go-review.googlesource.com/12322
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-17 22:58:39 +00:00
Rob Pike
5c62e5f9da cmd/fix: add gotypes module
Adjusts for the move from golang.org/x/tools/go/types and .../go/exact
to go/types and go/constant in the main repository.

Change-Id: I0da7248c540939e3e9b09c915b0a296937f1be73
Reviewed-on: https://go-review.googlesource.com/12284
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-17 01:47:14 +00:00
Mikio Hara
29ffa4bd92 cmd/go: don't put mycmd in wrong directory
Change-Id: Ia7cc1d52211b32a2eb2b3888d621b28d6932aca9
Reviewed-on: https://go-review.googlesource.com/12290
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-17 01:28:16 +00:00
Russ Cox
08dbd8ae6d Revert "cmd/internal/obj: fix pc/sp information for prologue"
This seems to have broken arm64 in a mysterious way. Will try again later.

This reverts commit 0a3c991fd3.

Change-Id: Ic1b53413c4168977a27381d9cc6fb8d9d7cbb780
Reviewed-on: https://go-review.googlesource.com/12245
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 23:28:42 +00:00
Andrew Gerrand
5cd2944803 cmd/go: fix parsing of Git SCP-like remotes
Now that we care about the protocol of Git remotes (for the -insecure
flag), we need to recognize and parse the SCP-like remote format.

Fixes golang/go#11457

Change-Id: Ia26132274fafb1cbfefe2475f7ac5f17ccd6da40
Reviewed-on: https://go-review.googlesource.com/12226
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 21:33:57 +00:00
Ian Lance Taylor
2e4b659954 cmd/compile: recognize embedded field in inlined function
There was already special code to recognize "?" in hidden_structdcl,
which is used for inlined types and variables.  This recognizes "?" in
structdcl as well, a case that arises when a struct type appears
within an inlined function body.

Fixes #10219.

Change-Id: Ic5257ae54f817e0d4a189c2294dcd633c9f2101a
Reviewed-on: https://go-review.googlesource.com/12241
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 06:04:51 +00:00
Rob Pike
2d25318f08 asm: fix error messages and comments for "register pair"
The parser treats (R1+R2) on ppc64 the same as (R1,R2) on arm,
but it is not strictly a "register pair". Improve the text.

No semantic change.

Change-Id: Ib8b14881c6467add0d53150a901c01e962afb28b
Reviewed-on: https://go-review.googlesource.com/12212
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 05:45:29 +00:00
Russ Cox
7feb424928 cmd/compile: fix PtrTo(t) for unnamed t with embedded fields
Fixes #8427.

Change-Id: I826a3bc4519845ad30d6dbaf058fe7ed7bee8db0
Reviewed-on: https://go-review.googlesource.com/12233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 05:36:27 +00:00
Russ Cox
307d6919bd cmd/go: print all test flags in "go test -h"
Originally 'go test -h' printed the output of 'go help test'.
Then issue #6576 was filed, because that output didn't list (for example) -bench.
CL 14502065 changed 'go test -h' to print the output of 'go help testflag'.
Then issue #9209 was filed, because that output didn't list (for example) -c.

To print all the relevant flags, parts of both 'go help test' and 'go help testflag'
are needed. Refactor the help messages to make those parts available
and print them.

Fixes #9209.

Change-Id: Ie8205b8fb37d00c10d25b3fc98f14286ec46c4e3
Reviewed-on: https://go-review.googlesource.com/12173
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 05:34:13 +00:00
Russ Cox
ef6d3a94fb cmd/dist: diagnose lack of gcc earlier in build
Fixes #10731.

Change-Id: I105629b03fd3323c0a2ca5b6b0fd35ee92b7fd2e
Reviewed-on: https://go-review.googlesource.com/12146
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 05:33:55 +00:00
Russ Cox
5a4cc600b7 cmd/go: fix nocgo builder
Change-Id: I0f167d9769d9b6b9888c13fcb48e538fc87aa1b7
Reviewed-on: https://go-review.googlesource.com/12240
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 05:23:35 +00:00
Russ Cox
238a39594b cmd/go: add test for issue 3652
Fixes #3652. (Well, already fixed, but tests that it stays fixed.)

Change-Id: I4e17f595ee2ad513de86ac3861e8e66b1230b3be
Reviewed-on: https://go-review.googlesource.com/12195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 05:06:50 +00:00
Russ Cox
7126da2fd5 cmd/go: fix build
Failures noted by dashboard.

Change-Id: I22f90120c6687b64b9efff9df7a7fa8f26d24bac
Reviewed-on: https://go-review.googlesource.com/12207
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 05:05:52 +00:00
Russ Cox
2f54de0df8 cmd/go: accept go get domain.root
Fixes #9357.

Change-Id: I11f0652758c4ea80debec29c3b99a72baca6d745
Reviewed-on: https://go-review.googlesource.com/12193
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 04:44:54 +00:00
Russ Cox
af96030150 cmd/go: fix go get -u handling of changing dependencies
Fixes #9224.

Change-Id: Ie0f4f14407099e4fa7ebe361a95b6492012928a2
Reviewed-on: https://go-review.googlesource.com/12192
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 04:41:08 +00:00
Russ Cox
8df0bcc1fb cmd/go: disable password prompt when running git
This fix only works on Git 2.3.0 and later.

There appears to be no portable way to fix the earlier versions.
We already run git with stdin closed, but on Unix git calls getpass,
which opens /dev/tty itself. We could do package syscall-specific
things to get /dev/tty invalidated during the exec, but I'd really
rather not. And on Windows, Git opens "CONIN$" and "CONOUT$"
itself, and I have no idea how to invalidate those.

Fix the problem for newish Git versions and wait for people to update.
Best we can do.

Fixes #9341.

Change-Id: I576579b106764029853e0f74d411e19108deecf5
Reviewed-on: https://go-review.googlesource.com/12175
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:36:49 +00:00
Russ Cox
505f6e335e cmd/pprof: store temporary files in temporary directory
Fixes #9180.

Change-Id: Id5adaea0ca9005946fb89c88a10c6f59d8c0943c
Reviewed-on: https://go-review.googlesource.com/12202
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-15 04:30:50 +00:00
Russ Cox
2bd1e5e50b cmd/pprof: run $BROWSER and system browser before Chrome
Fixes #10259.

Change-Id: Ica6b8301cc8291785a3c496fb513050813b2d8df
Reviewed-on: https://go-review.googlesource.com/12201
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-15 04:30:35 +00:00
Russ Cox
9adf684686 cmd/go: fix TestVendorRun when $GOROOT is inside a symlinked path
Fixes #11305.

Change-Id: Icaa3a009aa4ab214c9aaf74f52c3e622fa266a9d
Reviewed-on: https://go-review.googlesource.com/12194
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 04:30:13 +00:00
Russ Cox
4325a9ee2a cmd/go: reject missing source code in go get -d, same as go get -d -u
Fixes #11090.

Change-Id: I1518df7a48346b175ec80079a07225901fdd51fb
Reviewed-on: https://go-review.googlesource.com/12177
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:29:10 +00:00
Russ Cox
f849f6b7fd cmd/go: give full import stack for errors in dependencies of test dependencies
Fixes #9558.

Change-Id: I68506af58088155d38d492b49b19c5fc2048b087
Reviewed-on: https://go-review.googlesource.com/12176
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:28:00 +00:00
Russ Cox
6ab582a80d cmd/go: go test -race -i runtime/race must not install race-enabled cmd/cgo
Fix now uses same test as 'go build'.

Fixes #10500.

Change-Id: I2fcf2d95430643370aa29165d89a188988dee446
Reviewed-on: https://go-review.googlesource.com/12174
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:27:17 +00:00
Russ Cox
b2cb3b416c cmd/go: add -pkgdir build flag
Fixes #10210.

Change-Id: I82ddd665bca31773b1fb1b056338c04818ef68f5
Reviewed-on: https://go-review.googlesource.com/12171
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:19:08 +00:00
Russ Cox
b5bc87ce59 cmd/go: remove duplication of build flag info in testflag.go
Also adds to 'go test' all the build flags that were missing
due to inconsistency in the duplication (for example, -toolexec).

Fixes #10504.

Change-Id: I1935b5caa13d5e551a0483904adffa8877087df7
Reviewed-on: https://go-review.googlesource.com/12170
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:18:54 +00:00
Russ Cox
3585f215c8 cmd/go: fix error for go run with files in different directories
Fixes #9853.

Change-Id: Ic4803aa499ca20215085a87bad649014984d84c8
Reviewed-on: https://go-review.googlesource.com/12149
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:18:39 +00:00
Russ Cox
687925ffcf cmd/go: document that <meta> tags should be early in the HTML for go get
While we are here, fix a few things not updated for -insecure.

Fixes #8163.

Change-Id: Ib80c9ac00d6b61cce26c3d20bee3d30ab9af1331
Reviewed-on: https://go-review.googlesource.com/12148
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:13:56 +00:00
Russ Cox
023047d14b cmd/go: diagnose trivial test import cycle
Was detecting only non-trivial ones.

Fixes #9690.

Change-Id: I662d81dd4818ddf29592057c090805772c84287b
Reviewed-on: https://go-review.googlesource.com/12147
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:13:55 +00:00
Russ Cox
ea918ef535 Revert "cmd/compile: define func value symbols at declaration"
This reverts commit 3b411bf1a1bb08d6868083981cecba8088dc7aea.

Change-Id: I321a43fa378a43b3e4d7aa97e0222775640af64b
Reviewed-on: https://go-review.googlesource.com/12205
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 04:11:54 +00:00
Russ Cox
fa1ea497d5 cmd/compile: define func value symbols at declaration
These used to be defined at use, but that breaks when shared libraries
are involved.

For #11480.

Change-Id: I416a848754fb615c0d75f9f0ccc00723d07f7f01
Reviewed-on: https://go-review.googlesource.com/12145
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:11:01 +00:00
Russ Cox
0a3c991fd3 cmd/internal/obj: fix pc/sp information for prologue
When the prologue call to morestack was moved down to the
bottom of the function, the pc/sp tables were not updated.
If a traceback through a call to morestack is needed, it would
get confused at and stop at morestack.

Confirmed the fix by adding //go:systemstack (which calls
morestackc, but same issue) where it did not belong
and inspecting the crash.

Change-Id: Id0294bb9dba51ef1a49154637228fb57f1086a94
Reviewed-on: https://go-review.googlesource.com/12144
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:09:35 +00:00
David Crawshaw
e3c67dda0a cmd/go: do not create subdirs of $GOBIN
Fixes #9769.

Change-Id: I2959906c71d0ce62cdb750dab78eab631a26f229
Reviewed-on: https://go-review.googlesource.com/12080
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14 19:25:40 +00:00
Ian Lance Taylor
a6dc541436 cmd/go: warn on get from code.google.com that it is shutting down
Fixes #10193.

Change-Id: Ibbb747babb697a66b943e5da76b0ada41f1fb14f
Reviewed-on: https://go-review.googlesource.com/12070
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14 18:18:12 +00:00
Ross Light
c218a075be cmd/go: mark ssh:// URLs as secure
Add tests for isSecure function.

Change-Id: I49de9d2846b75d4c7be745484f85d351a6fd851d
Reviewed-on: https://go-review.googlesource.com/11514
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14 05:27:57 +00:00
Rob Pike
1bd1880906 cmd/internal/obj: rename *.out.go to a.out.go
The old numerical names like 6.out.go are a relic from the old tools.
Easier to rename than explain.

The anames.go files were modified by go generate; no changes
beyond the explanatory comment at the top.

Change-Id: I84742c75c60e47724baa9d49a91fef1f8581f021
Reviewed-on: https://go-review.googlesource.com/12069
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-13 23:47:38 +00:00
Russ Cox
d7a8d3eb08 cmd/go: fix go get -u with internal
Fixes #11307.
Fixes #11055.

Change-Id: I8d6b04cb509e62e27d6935b91ffe35fdaea4ebcd
Reviewed-on: https://go-review.googlesource.com/12028
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-13 19:17:17 +00:00
Michael Hudson-Doyle
616cb3c0ea cmd/dist: actually disable testso and testsovar on ppc64
This is clearly what was intended all along. ./all.bash passes with this
change.

Change-Id: I16996da11cf1e4d2dc2a4434b7611a724691e8dc
Reviewed-on: https://go-review.googlesource.com/12068
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-13 04:11:39 +00:00
Alex Brainman
4ef836faf6 cmd/dist: disable misc/scgo/testsovar on netbsd
Update #11654

Change-Id: Ia199b8dd349542ad8b92b463dd2f3734dd7e66a4
Reviewed-on: https://go-review.googlesource.com/12060
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-12 10:23:06 +00:00
Brad Fitzpatrick
783297ad6a all: link to https for golang subdomains too
The previous commit (git 2ae77376) just did golang.org.  This one
includes golang.org subdomains like blog, play, and build.

Change-Id: I4469f7b307ae2a12ea89323422044e604c5133ae
Reviewed-on: https://go-review.googlesource.com/12071
Reviewed-by: Rob Pike <r@golang.org>
2015-07-12 04:42:40 +00:00
Brad Fitzpatrick
2ae77376f7 all: link to https instead of http
The one in misc/makerelease/makerelease.go is particularly bad and
probably warrants rotating our keys.

I didn't update old weekly notes, and reverted some changes involving
test code for now, since we're late in the Go 1.5 freeze. Otherwise,
the rest are all auto-generated changes, and all manually reviewed.

Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d
Reviewed-on: https://go-review.googlesource.com/12048
Reviewed-by: Rob Pike <r@golang.org>
2015-07-11 14:36:33 +00:00
Matthew Dempsky
1082e2390e cmd/link/internal/ld: stricter object file decoding
Instead of silently truncating integers to their expected range, check
that they're within range and emit errors if not.  Intended to help
narrow down the cause of issue #11617.

Change-Id: Ia7b577270f8438ca7479262702371e26277f1ea7
Reviewed-on: https://go-review.googlesource.com/12050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-10 22:01:54 +00:00
Ian Lance Taylor
6a90b1d621 runtime, cmd/go: fix tests to work when GOROOT_FINAL is set
When GOROOT_FINAL is set when running all.bash, the tests are run
before the files are copied to GOROOT_FINAL.  The tests are run with
GOROOT set, so most work fine.  This fixes two cases that do not.

In cmd/go/go_test.go we were explicitly removing GOROOT from the
environment, causing tests that did not themselves explicitly set
GOROOT to fail.  There was no need to explicitly remove GOROOT, so
don't do it.  If people choose to run "go test cmd/go" with a bad
GOROOT, that is their own lookout.

In the runtime GDB test, the linker has told gdb to find the support
script in GOROOT_FINAL, which will fail.  Check for that case, and
skip the test when we see it.

Fixes #11652.

Change-Id: I4d3a32311e3973c30fd8a79551aaeab6789d0451
Reviewed-on: https://go-review.googlesource.com/12021
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-10 21:29:37 +00:00
Rob Pike
a625b91916 cmd/doc: submit to the punched card tyranny
People use 80-column terminals because their grandparents used
punched cards. When I last used a punched card, in 1978, it seemed
antiquated even then. But today, people still set their terminal
widths to 80 to honor the struggles their fallen ancestors made to
endure this painful technology.

We must all stand and salute the 80 column flag, or risk the opprobium
of our peers.

For Pete's sake, I don't even use a fixed-width font. I don't even
believe in columns.

Fixes #11639 with extreme reluctance.

P.S. To avoid the horror of an automatically folded line of text, this commit message has been formatted to fit on an 80-column line, except for this postscript.

Change-Id: Ia2eb2dcf293dabe804c22ee5abb4bbb703f45c33
Reviewed-on: https://go-review.googlesource.com/12011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-10 03:52:48 +00:00
Rob Pike
91976aa676 cmd/doc: suppress symbols for commands when showing package docs
Change the default behavior when showing the package docs
for a command to elide the symbols. This makes

	go doc somecommand

show the top-level package docs only and hide the symbols,
which are probably irrelevant to the user. This has no effect
on explicit requests for internals, such as

	go doc somecommand.sometype

The new -cmd flag restores the old behavior.

Fixes #10733.

Change-Id: I4d363081fe7dabf76ec8e5315770ac3609592f80
Reviewed-on: https://go-review.googlesource.com/11953
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-09 04:09:00 +00:00
Rob Pike
1b74c71da5 cmd/asm: add copyright notices to tests
They were missing from the inputs.
Unfortunately this means the .out files all have wrong line numbers,
but they are easy to update.

Change-Id: I254742f24ab803421f34d52d13b9afa93674edd6
Reviewed-on: https://go-review.googlesource.com/11958
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-09 03:27:48 +00:00
Russ Cox
b6ead9f171 cmd/go: disable vendoredImportPath for code outside $GOPATH
It was crashing.
This fixes the build for
GO15VENDOREXPERIMENT=1 go test -short runtime

Fixes #11416.

Change-Id: I74a9114cdd8ebafcc9d2a6f40bf500db19c6e825
Reviewed-on: https://go-review.googlesource.com/11964
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:53:11 +00:00
Russ Cox
9f90f31c3a cmd/compile: allow static init for unsafe.Pointer(&x) where x is global
This avoids both a write barrier and then dynamic initialization
globals of the form

	var x something
	var xp = unsafe.Pointer(&x)

Using static initialization avoids emitting a relocation for &x,
which helps cgo.

Fixes #9411.

Change-Id: I0dbf480859cce6ab57ab805d1b8609c45b48f156
Reviewed-on: https://go-review.googlesource.com/11693
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-07-07 21:51:57 +00:00
David Chase
7929a0ddfa cmd/compile: initialize line number properly for temporaries
The expansion of structure, array, slice, and map literals
does not use the right line number in its introduced assignments
to temporaries, which leads to incorrect line number attribution
for expressions in those literals.

Inlining also incorrectly replaced the line numbers of args to
inlined functions.

This was revealed in CL 9721 because a now-avoided temporary
assignment introduced the correct line number.
I.e. before CL 9721
  "tmp_wrongline := expr"
was transformed to
  "tmp_rightline := expr; tmp_wrongline := tmp_rightline"

Also includes a repair to CL 10334 involving line numbers
where a spurious -1 remained (should have been 0, now is 0).

Fixes #11400.

Change-Id: I3a4687efe463977fa1e2c996606f4d91aaf22722
Reviewed-on: https://go-review.googlesource.com/11730
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:30:59 +00:00
Daniel Theophanes
0409158cd0 cmd/go: ignore volume name case when checking vendor path
Fixes #11409

Change-Id: Ic1610e124b2d8b2b12310fc9538d5078cc7302a0
Reviewed-on: https://go-review.googlesource.com/11316
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:02:17 +00:00
Ross Light
11a19ae8da cmd/go: create executable when installing to working directory
Fixes #11065.

Change-Id: Idd854facd5fa78c0334f86740f351d404f9a5b2d
Reviewed-on: https://go-review.googlesource.com/11511
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:00:44 +00:00
Daniel Theophanes
06b280214c cmd/go: do not panic on invalid import path containing "/vendor/"
Fixes #11414

Change-Id: I45a41b98554f00362d9222e9c68a441dbfc23cb8
Reviewed-on: https://go-review.googlesource.com/11700
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:00:01 +00:00
Rob Pike
173fa1d809 cmd/go: delete references to old tools (5a etc.) from cmd/go docs
Don't talk about commands that no longer exist.

There are still references throughout the tree, mostly in comments,
but they provide a charming historical backdrop for the idle tourist.

Change-Id: I637ebdce05bbc7df5addcc46cb772d2bb9f3e073
Reviewed-on: https://go-review.googlesource.com/11885
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-05 06:25:51 +00:00
Dmitry Vyukov
11f50f41ee cmd/trace: log errors to console in AJAX handler
Fixes #11508

Change-Id: I72e83893b76f75685d6edfe65ca6691d97539226
Reviewed-on: https://go-review.googlesource.com/11864
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-02 19:10:00 +00:00
Dmitry Vyukov
1cbbd7f545 cmd/trace: fix time scale
Integrate the latest trace-viewer changes.
It now handles nanoseconds without any issues (thanks to @egonelbre!).
So change timestamps from microseconds to nanoseconds.

Change-Id: I010f27effde7e80c9992e6f276f6912354d27df4
Reviewed-on: https://go-review.googlesource.com/11244
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Egon Elbre <egonelbre@gmail.com>
2015-07-01 10:37:10 +00:00
Russ Cox
6f80e5edf4 cmd/link: reject data size > 2 GB
We can't address more than this on amd64 anyway.

Fixes #9862.

Change-Id: Ifb1abae558e2e1ee2dc953a76995f3f08c60b1df
Reviewed-on: https://go-review.googlesource.com/11715
Reviewed-by: Austin Clements <austin@google.com>
2015-06-30 19:40:39 +00:00
Russ Cox
e8f2eb4349 cmd/compile: allow linker to drop string headers when not needed
Compiling a simple file containing a slice of 100,000 strings,
the size of the resulting binary dropped from 5,896,224 bytes
to 3,495,968 bytes, which is the expected 2,400,000 bytes,
give or take.

Fixes #7384.

Change-Id: I3e551b5a1395b523a41b33518d81a1bf28da0906
Reviewed-on: https://go-review.googlesource.com/11698
Reviewed-by: Austin Clements <austin@google.com>
2015-06-30 19:27:52 +00:00
Russ Cox
3b6e86f48a cmd/compile: fix race detector handling of OBLOCK nodes
Fixes #7561 correctly.
Fixes #9137.

Change-Id: I7f27e199d7101b785a7645f789e8fe41a405a86f
Reviewed-on: https://go-review.googlesource.com/11713
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-06-30 19:25:18 +00:00
Dmitry Vyukov
8884fa7476 cmd/trace: sort procs
If you have more than 10 procs, then currently they are sorted alphabetically as
0, 10, 11, ..., 19, 2, 20, ...
Assign explicit order to procs so that they are sorted numerically.

Change-Id: I6d978d2cd439aa2fcbcf147842a643f9073eef75
Reviewed-on: https://go-review.googlesource.com/11750
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-30 16:50:57 +00:00
Dmitry Vyukov
19b8aa3b5d cmd/compile/internal/gc: give OASWB name
Change-Id: Iacb84421215ca80c7add2818118b2af1a650fd58
Reviewed-on: https://go-review.googlesource.com/11639
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-30 15:51:59 +00:00
Andrew Gerrand
ab9c25f2de cmd/go: use GOOS and GOARCH from build context for "go generate"
Fixes #11438

Change-Id: Iedd31918aa5187fc3fdaed71c8dad82075559084
Reviewed-on: https://go-review.googlesource.com/11667
Reviewed-by: Rob Pike <r@golang.org>
2015-06-30 06:52:47 +00:00
Russ Cox
1122836b5f cmd/compile: reject large floating point exponents without math/big
For #11326 (but not a fix).

Change-Id: Ic51814f5cd7357427c3fd990a5522775d05e7987
Reviewed-on: https://go-review.googlesource.com/11673
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-29 21:18:01 +00:00
Russ Cox
69f0d4c6be cmd/link: detect -X setting non-string variable
Fixes #9621.

Change-Id: Ib9c6001378364af899f57fd4b89fb23af2042923
Reviewed-on: https://go-review.googlesource.com/11694
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-06-29 20:28:36 +00:00
Russ Cox
34846aef78 cmd/link: fix -s with external linking
This code used to only be run for ELF, with the predictable
result that using -s with external linking broke on Windows and OS X.
Moving it here should fix Windows and does fix OS X.

CL 10835 also claims to fix the crash on Windows.
I don't know whether it does so correctly, but regardless,
this CL should make that one a no-op.

Fixes #10254.

Change-Id: I2e7b45ab0c28568ddbb1b50581dcc157ae0e7ffe
Reviewed-on: https://go-review.googlesource.com/11695
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 19:49:38 +00:00
Russ Cox
27edd7209e cmd/compile: enable PAUTO capture variables on arch != 6
Fixes #9865.

Change-Id: I8ce5b1708ed938910c59899706e470271c2e7e9d
Reviewed-on: https://go-review.googlesource.com/11699
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-29 19:49:18 +00:00
Tom Heng
162d2c1608 cmd/go: 'go env' print GO15VENDOREXPERIMENT in Go1.5
Fixes #11410

Change-Id: I9d01be3e01f74f4b12a516aba8a5d20d9b277ec6
Reviewed-on: https://go-review.googlesource.com/11539
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-29 19:29:01 +00:00
Russ Cox
5267bf075b cmd/go: disable TestIssue10952 without external network
Should fix arm64 build failure.

Change-Id: Ib35e4a69a1082e461a1eddf3265544a1d2ff98e5
Reviewed-on: https://go-review.googlesource.com/11710
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 18:00:07 +00:00
Russ Cox
55203c7dd5 cmd/compile: allow unnamed constants to set line number
Fixes #8836.

Change-Id: Idda9f4a987e03b3bdf5e8fdb984fe56d6f84aa59
Reviewed-on: https://go-review.googlesource.com/11672
Reviewed-by: David Chase <drchase@google.com>
2015-06-29 17:35:55 +00:00
Russ Cox
434e0bc0a0 cmd/link: record missing pcdata tables correctly
The old code was recording the current table output offset,
so the table from the next function would be used instead of
the runtime realizing that there was no table at all.

Add debug constant in runtime to check this for every function
at startup. It's too expensive to do that by default, but we can
do the last five functions. The end of the table is usually where
the C symbols end up, so that's where the problems typically are.

Fixes #10747.
Fixes #11396.

Change-Id: I13592e78017969fc22979fa902e19e1b151d41b1
Reviewed-on: https://go-review.googlesource.com/11657
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-06-29 16:07:14 +00:00
Russ Cox
4e61c516f4 cmd/cgo: fix a problem with 'go build -compiler gccgo'
Port of https://golang.org/cl/154360045 to Git.
Original author is Xia Bin <snyh@snyh.org> (already a contributor).

Fixes #8945.

Change-Id: I28bcaf3348794202ca59fbc3466bd7b9670030e4
Reviewed-on: https://go-review.googlesource.com/11658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-29 15:15:59 +00:00
Keith Randall
214c7a2c43 cmd/link/internal/ld: exclude only real container symbols from symtab
It looks like the test for whether symbols contain subsymbols is wrong.
In particular, symbols in C libraries are mistakenly considered container
symbols.

Fix the test so only symbols which actually have a subsymbol
are excluded from the symtab.  When linking cgo programs the list
of containers is small, something like:

container _/home/khr/sandbox/symtab/misc/cgo/test(.text)<74>
container _/home/khr/sandbox/symtab/misc/cgo/test/issue8828(.text)<75>
container _/home/khr/sandbox/symtab/misc/cgo/test/issue9026(.text)<76>
container runtime/cgo(.text)<77>

I'm not sure this is the right fix.  In particular I can't reproduce
the original problem.  Anyone have a repro they can try and see if
this fix works?

Fixes #10747
Fixes #11396

Change-Id: Id8b016389d33348b4a791fdcba0f9db8ae71ebf3
Reviewed-on: https://go-review.googlesource.com/11652
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-29 02:54:09 +00:00
Alex Brainman
3b7841b3af cmd/go: reset read-only flag during TestIssue10952
git sets read-only flag on all its repo files on Windows.
os.Remove cannot delete these files.

Fixes windows build

Change-Id: Icaf72470456b88a1c26295caecd4e0d3dc22a1b6
Reviewed-on: https://go-review.googlesource.com/11602
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-06-29 01:49:05 +00:00
David Crawshaw
58578de0dc cmd/link: no dwarf on darwin/arm
Partial revert of cl/10284 to get -buildmode=c-archive working for
darwin/arm.

Manually tested with iostest.bash while builder is offline.

Change-Id: I98e4e209765666e320e680e11151fce59e2afde9
Reviewed-on: https://go-review.googlesource.com/11306
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-06-27 21:32:38 +00:00
Ross Light
64078bf3cf cmd/go: ignore custom import check when there is no import comment
Fixes #10952

Change-Id: I56ab6a806bd3741cffd9d2a53929a6d043626a26
Reviewed-on: https://go-review.googlesource.com/10693
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 19:06:56 +00:00
Tamir Duberstein
a444da033c cmd/go: fetch git submodules in go get
Change createCmd, downloadCmd, tagSyncCmd, tagSyncDefault to allow
multiple commands.

When using the vendoring experiment, fetch git submodules in `go get`,
and update them in `go get -u`.

This is a reincarnation of https://codereview.appspot.com/142180043.

For #7764.

Change-Id: I8248efb851130620ef762a765ab8716af430572a
Reviewed-on: https://go-review.googlesource.com/9815
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 18:52:53 +00:00
Alex Brainman
ebfc5be5b9 cmd/go: adjust TestFileLineInErrorMessages
cmd/go sometimes returns relative path in the error message
(see shortPath function). Account for that during
TestFileLineInErrorMessages.

Fixes #11355

Change-Id: Ica79359eab48d669d307449fdd458764895fab2c
Reviewed-on: https://go-review.googlesource.com/11475
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 18:43:45 +00:00
c9s
29ff86b05b cmd/go: handle error when git remote origin doesn't exist
- Let runOutput return the error message
- When `git config ...` returns empty buffer, it means the config key is
  correct, but there is no corresponding value.
- Return the correct error when the url of remote origin is not found.
- Update error message

Fixes: #10922

Change-Id: I3f8880f6717a4f079b840d1249174378d36bca1b
Reviewed-on: https://go-review.googlesource.com/10475
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 18:43:15 +00:00
Rob Pike
aea348a3af cmd/asm: add tests for erroneous expressions
Also add a couple more errors, such as modulo with a zero divisor.

Change-Id: If24c95477f7ae86cf4aef5b3460e9ec249ea5ae2
Reviewed-on: https://go-review.googlesource.com/11535
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-26 23:33:39 +00:00
Russ Cox
32fddadd98 runtime: reduce slice growth during append to 2x
The new inlined code for append assumed that it could pass the
desired new cap to growslice, not the number of new elements.
But growslice still interpreted the argument as the number of new elements,
making it always grow by >2x (more precisely, 2x+1 rounded up
to the next malloc block size). At the time, I had intended to change
the other callers to use the new cap as well, but it's too late for that.
Instead, introduce growslice_n for the old callers and keep growslice
for the inlined (common case) caller.

Fixes #11403.

Filed #11419 to merge them.

Change-Id: I1338b1e5b352f3be4e43641f44b652ef7195251b
Reviewed-on: https://go-review.googlesource.com/11541
Reviewed-by: Austin Clements <austin@google.com>
2015-06-26 17:49:33 +00:00
Todd Neal
765c0f37ed cmd/compile: fix half multiply issue
In walkdiv, an OMUL node was created and passed to typecheck,
before the op was changed back to OHMUL.  In some instances,
the node that came back was an evaluated literal constant that
occurred with a full multiply.  The end result was a literal node
with a non-shifted value and an OHMUL op. This change causes code
to be generated for the OHMUL.

Fixes #11358
Fixes #11369

Change-Id: If42a98c6830d07fe065d5ca57717704fb8cfbd33
Reviewed-on: https://go-review.googlesource.com/11400
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-26 15:55:22 +00:00
Dmitry Vyukov
cd0a8ed48a cmd/compile: add instrumentation of OKEY
Instrument operands of OKEY.
Also instrument OSLICESTR. Previously it was not needed
because of preceeding bounds checks (which were instrumented).
But the preceeding bounds checks have disappeared.

Change-Id: I3b0de213e23cbcf5b8ef800abeded5eeeb3f8287
Reviewed-on: https://go-review.googlesource.com/11417
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-26 15:54:03 +00:00
Aaron Jacobs
8628688304 Fix several out of date references to 4g/5g/6g/8g/9g.
Change-Id: Ifb8e4e13c7778a7c0113190051415e096f5db94f
Reviewed-on: https://go-review.googlesource.com/11390
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-26 03:38:21 +00:00
Keith Randall
dbe9ab69d9 cmd/compile/internal/gc: make sure nonzero-sized objects have nonzero alignment
See issue #11354.

Change-Id: I6817d499e6c02e4a9c83f80bc66a2bee368a69ec
Reviewed-on: https://go-review.googlesource.com/11406
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-25 02:22:58 +00:00
Russ Cox
66130907d1 cmd/compile: handle copy in escape analysis
Somehow we missed this!
Fixes #11387.

Change-Id: Ida08fe52eff7da2ef7765b4cf35a39a301420c43
Reviewed-on: https://go-review.googlesource.com/11460
Reviewed-by: David Chase <drchase@google.com>
2015-06-24 22:22:55 +00:00
Andrew Gerrand
5bf1853e59 cmd/go: don't fetch from insecure repositories without -insecure
Fixes #9637
Fixes #10120

Change-Id: I3728239089efb94d04cd4115c9f840afd7badeaf
Reviewed-on: https://go-review.googlesource.com/9715
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-24 06:36:07 +00:00
Rob Pike
989b372a5c cmd/asm: fix shifts again, this time for sure
There are two conditions to worry about:

1) The shift count cannot be negative. Since the evaluator uses unsigned
arithmetic throughout, this means checking that the high bit of
the shift count is always off, which is done by converting to int64
and seeing if the result is negative.

2) For right shifts, the value cannot be negative. We don't want a
high bit in the value because right shifting a value depends on the
sign, and for clarity we always want unsigned shifts.

Next step is to build some testing infrastructure for the parser.

Change-Id: I4c46c79989d02c107fc64954403fc18613763f1d
Reviewed-on: https://go-review.googlesource.com/11326
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-23 06:44:54 +00:00
Rob Pike
cb3e2bf0ba cmd/doc: fix copy/paste error in test
Some of those consts were supposed to be vars.

Caught by Ingo Oeser.

Change-Id: Ifc12e4a8ee61ebf5174e4ad923956c546dc096e2
Reviewed-on: https://go-review.googlesource.com/11296
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 22:29:35 +00:00
Rob Pike
58d177c63e cmd/asm: fix handling of negative shifts.
The change that "fixed" LSH was incorrect, and the fix for RSH was poor.
Make both use a correct, simple test: if the 64-bit value as a signed
integer is negative, it's an error.

Really fixes #11278.

Change-Id: I72cca03d7ad0d64fd649fa33a9ead2f31bd2977b
Reviewed-on: https://go-review.googlesource.com/11325
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 20:42:22 +00:00
Rob Pike
98c9e9e74f cmd/vet: refer info about -printfuncs to the -printf flag
And vice versa.

The flags are tightly coupled so make the connection clear.

Change-Id: I505f76be631ffa6e489a441c2f3c717aa09ec802
Reviewed-on: https://go-review.googlesource.com/11324
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 20:42:01 +00:00
Russ Cox
794c01b8b4 cmd/go: fix test for issue 8181
The test was translated from shell incorrectly,
and it depended on having hg installed, which
may not be the case.

Moved repo to GitHub, updated code, and fixed
go list ... command to be expected to succeed.

Fixes test for #8181.

Change-Id: I7f3e8fb20cd16cac5ed24de6fd952003bc5e08d4
Reviewed-on: https://go-review.googlesource.com/11301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-22 16:44:46 +00:00
Rob Pike
71859efceb cmd/asm: remove needless check for negative right shift
In the parser, the shift value is always a uint64.

Change-Id: I9b50295a9f7d174ed1f6f9baf78ec0ed43db417f
Reviewed-on: https://go-review.googlesource.com/11322
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 06:57:19 +00:00
Rob Pike
3cab4760d5 cmd/asm: remove pointless check for negative uint
Fixes #11278.

Change-Id: Ic46fda0f42cefedc3f6085c0e77e67616ce4955e
Reviewed-on: https://go-review.googlesource.com/11297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-21 03:11:01 +00:00
Rob Pike
13c44d27b7 cmd/doc: add test for constructor, fix build
Most important: skip test on darwin/arm64 for unclear reasons.

First cut at the test missed this feature of go doc: when asking for
the docs for a type, include any function that looks like it constructs
a that type as a return value.

Change-Id: I124e7695e5d365e2b12524b541a9a4e6e0300fbc
Reviewed-on: https://go-review.googlesource.com/11295
Reviewed-by: Rob Pike <r@golang.org>
2015-06-20 10:35:38 +00:00
Rob Pike
2f2908bec3 cmd/doc: fix test on nacl
nacl is really giving a hard time. avoid all external dependencies in the test.
Worked with trybots, failed in the build. No explanation, but this should fix it.

TBR=rsc

Change-Id: Icb644286dbce88f17ee3d96ad90efba34a80a92d
Reviewed-on: https://go-review.googlesource.com/11291
Reviewed-by: Rob Pike <r@golang.org>
2015-06-19 22:13:20 +00:00
Rob Pike
d0652e7f82 cmd/doc: add test
Refactor main a bit to make it possible to run tests without an exec every time.
(Makes a huge difference in run time.)

Add a silver test. Not quite golden, since it looks for pieces rather than the
full output, and also includes tests for what should not appear.

Fixes #10920.

Change-Id: I6a4951cc14e61763379754a10b0cc3484d30c267
Reviewed-on: https://go-review.googlesource.com/11272
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
2015-06-19 21:56:59 +00:00
Srdjan Petrovic
cc6554f750 cmd/link/internal/ld, cmd/go: -buildmode=c-shared support for darwin/amd64
All of the heavy-lifting was done by minux@, with his external-linking support
for darwin/arm64: golang.org/cl/8781

Change-Id: I7c9fbc19246f418c065c92fb2c13c00026ff0f82
Reviewed-on: https://go-review.googlesource.com/11127
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 20:28:01 +00:00
Russ Cox
dc89350fed cmd/go: fix build
Change-Id: Ia13d1fa450e88e278b81048b99686395ca474c99
Reviewed-on: https://go-review.googlesource.com/11259
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 20:05:31 +00:00
Russ Cox
183cc0cd41 cmd/go: add preliminary support for vendor directories
When GO15VENDOREXPERIMENT=1 is in the environment,
this CL changes the resolution of import paths according to
the Go 1.5 vendor proposal:

	If there is a source directory d/vendor, then,
	when compiling a source file within the subtree rooted at d,
	import "p" is interpreted as import "d/vendor/p" if that exists.

	When there are multiple possible resolutions,
	the most specific (longest) path wins.

	The short form must always be used: no import path can
	contain “/vendor/” explicitly.

	Import comments are ignored in vendored packages.

The goal of these changes is to allow authors to vendor (copy) external
packages into their source trees without any modifications to the code.
This functionality has been achieved in tools like godep, nut, and gb by
requiring GOPATH manipulation. This alternate directory-based approach
eliminates the need for GOPATH manipulation and in keeping with the
go command's use of directory layout-based configuration.

The flag allows experimentation with these vendoring semantics once
Go 1.5 is released, without forcing them on by default. If the experiment
is deemed a success, the flag will default to true in Go 1.6 and then be
removed in Go 1.7.

For more details, see the original proposal by Keith Rarick at
https://groups.google.com/d/msg/golang-dev/74zjMON9glU/dGhnoi2IMzsJ.

Change-Id: I2c6527e777d14ac6dc43c53e4b3ff24f3279216e
Reviewed-on: https://go-review.googlesource.com/10923
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-19 19:05:01 +00:00
Russ Cox
7bcc6a1615 cmd/compile: add -importmap option
The -importmap option takes an argument of the form old=new
and specifies that import "old" should be interpreted as if it said
import "new". The option may be repeated to specify multiple mappings.

This option is here to support the go command's new -vendor flag.

Change-Id: I31b4ed4249b549982a720bf61bb230462b33c59b
Reviewed-on: https://go-review.googlesource.com/10922
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 18:50:12 +00:00
Alex Brainman
9d968cb47b runtime: rename cgocall_errno and asmcgocall_errno into cgocall and asmcgocall
Change-Id: I5917bea8bb35b0e725dcc56a68f3a70137cfc180
Reviewed-on: https://go-review.googlesource.com/9387
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 01:47:11 +00:00
Ian Lance Taylor
1a040c9230 cmd/cgo: static variables in the preamble may not be referenced
This is a documentation fix that reflects the current reality.

Fixes #9673.

Change-Id: Ie436b277dfd1b68b13c67813d29c238d2c23b820
Reviewed-on: https://go-review.googlesource.com/11221
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 01:08:43 +00:00
Ian Lance Taylor
679fd5b447 cmd/go: do not permit importing a main package
Fixes #4210.

Change-Id: Id981814a6e55a57403ce7a8ac45ab3ba081a3a86
Reviewed-on: https://go-review.googlesource.com/10925
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 01:06:36 +00:00
Ian Lance Taylor
18d9a8d05f cmd/go: format temporary Go files in testsuite
Indent the temporary file source code embedded in go_test.go, so that
we don't have temporary Go code in the first column.

No real changes to the tests, just formatting.

Change-Id: I416b4a812c8db452ea61afe63a00989ec598c228
Reviewed-on: https://go-review.googlesource.com/10926
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 00:53:56 +00:00
Andrey Petrov
9f3a2d5f9a doc: clarify duplicate symbol condition in cgo
Spell out what will happen if a declaration and definition is included
in the same file, should help people who run into duplicate symbol
errors and search for relevant keywords.

This edit is based on opening issue #11263 erroneously.

Change-Id: I0645a9433b8668d2ede9b9a3f6550d802c26388b
Reviewed-on: https://go-review.googlesource.com/11247
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 00:48:42 +00:00
Michael Matloob
32f2f72c47 cmd/compile: provide better error when method called without receiver
When a method is called using the Type.Method(receiver, args...) syntax
without the receiver, or enough arguments, provide the more helpful
error message "not enough arguments in call to method expression
Type.Method" instead of the old message "not enough arguments in call
to Type.Method".

Fixes #8385

Change-Id: Id5037eb1ee5fa93687d4a6557b4a8233b29e9df2
Reviewed-on: https://go-review.googlesource.com/2193
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:37:38 +00:00
Shenghou Ma
3925a7c5db all: switch to the new deprecation convention
While we're at it, move some misplaced comment blocks around.

Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508
Reviewed-on: https://go-review.googlesource.com/10188
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:16:23 +00:00
Egon Elbre
4f4da07ea0 cmd/go: suggest running 'go help gopath' with problematic GOPATH
Suggest running 'go help gopath' when the running 'go install .'
and the folder is outside of GOPATH.

Added link to 'https://golang.org/doc/code.html' in gopath help
for more information.

Example output:

% go install .
go install: no install location for directory f:\x\badmessage outside GOPATH
        please run 'go help gopath' for more information

% go help gopath
... SNIP ...
See https://golang.org/doc/code.html for an example.

Fixes #8457

Change-Id: I0ef6ee3c65bb12af2168eafeb757258aa3835664
Reviewed-on: https://go-review.googlesource.com/9258
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 17:34:26 +00:00
Dmitry Vyukov
1b269463a5 cmd/trace: gracefully handle empty profiles
Return a meaningful message when a profile is empty.
Also rename "IO blocking" to "Network blocking",
currently only network blocking is captured.

Fixes #11098

Change-Id: Ib6f1292b8ade4805756fcb6696ba1fca8f9f39a9
Reviewed-on: https://go-review.googlesource.com/11243
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-18 14:46:49 +00:00
Russ Cox
1fc114c797 cmd/addr2line: simplify windows test
Change-Id: I0fcc35f43bc6059e6203af6134319cfc060c4b9a
Reviewed-on: https://go-review.googlesource.com/11085
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 14:23:20 +00:00
Russ Cox
08e25fc1ba cmd/compile: introduce //go:systemstack annotation
//go:systemstack means that the function must run on the system stack.

Add one use in runtime as a demonstration.

Fixes #9174.

Change-Id: I8d4a509cb313541426157da703f1c022e964ace4
Reviewed-on: https://go-review.googlesource.com/10840
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2015-06-17 14:23:00 +00:00
Jeremy Jackins
7354978950 doc: replace references to {5..9}{g,l} with go tool compile and go tool link
I updated some references to 6g, 6l and friends that I came across, as those
programs don't exist anymore. I also fixed some echos in make.rc to match other make.* scripts while I was there.

Change-Id: Ib84532cd4688cf65174dd9869e5d42af98a20a48
Reviewed-on: https://go-review.googlesource.com/11162
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 04:05:50 +00:00
David Chase
5be61b18d4 cmd/compile: run escape analysis after method wrapper generation
Also modified test/run.go to ignore messages prefixed <autogenerated>
because those cannot be described with "// ERROR ...", and backed out
patch from issue #9537 because it is no longer necessary.  The reasons
described in the 9537 discussion for why escape analysis cannot run
late no longer hold, happily.

Fixes #11053.

Change-Id: Icb14eccdf2e8cde3d0f8fb8a216b765400a96385
Reviewed-on: https://go-review.googlesource.com/11088
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2015-06-17 02:36:45 +00:00
Alex Brainman
6428a8b437 cmd/dist: add new misc/cgo/testsovar test
This change reintroduces CL 8523. CL 8523 was reverted because
it broke darwin and netbsd builds. Now that this test is part
of "go tool dist test" command we could skip OSes that fail.

Updates #10360

Change-Id: Iaaeb5b800126492f36415a439c333a218fe4ab67
Reviewed-on: https://go-review.googlesource.com/11119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-17 02:33:40 +00:00
Alex Brainman
8e723109de cmd/go: vary executable names in tests
So the tests don't interfere with each other on windows.

Fixes #11217

Change-Id: I4b3936bc64c95c7274298d6f137b24a28876b625
Reviewed-on: https://go-review.googlesource.com/11138
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 01:26:40 +00:00
Michael Hudson-Doyle
a5f57d7950 cmd/link: when reading symbols from a shared library, allow duplicates when they are both in bss
This makes the behaviour match what happens when duplicate symbols are read
from regular object files and fixes errors about cgoAlwaysFalse when linking
an executable that uses cgo against a shared library.

Change-Id: Ibb8cd8fe3f7813cde504b7483f1e857868d7e063
Reviewed-on: https://go-review.googlesource.com/11117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 22:33:36 +00:00
Mikio Hara
0266bc8494 cmd/go: fix build
Change-Id: I2cd58a665d9df26583128c633c443325dcc3f288
Reviewed-on: https://go-review.googlesource.com/11131
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-16 19:26:07 +00:00
Russ Cox
7bc3e58806 all: extract "can I exec?" check from tests into internal/testenv
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d
Reviewed-on: https://go-review.googlesource.com/10753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 18:07:36 +00:00
Shenghou Ma
d00e7ad640 cmd/compile: show compiler panics when -d panic=1
Fixes #10683.

Change-Id: I4cce3f298b787c736dbabe544a11a9215bcd3671
Reviewed-on: https://go-review.googlesource.com/10336
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-16 16:50:21 +00:00
Michael Hudson-Doyle
12b05bf8fd cmd/go: support -buildmode=shared with gccgo
Change-Id: Id93b8ab42fa311ce32209734ec9a0813f8736e25
Reviewed-on: https://go-review.googlesource.com/9914
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-06-16 01:43:29 +00:00
Robert Griesemer
d63c42df25 go/types: port recent x/tools/go/types fixes
The main change is:

golang.org/cl/10800  add pos parameter to Eval; remove New, EvalNode

followed by several cleanups/follow-up fixes:

golang.org/cl/10992  remove global vars in test
golang.org/cl/10994  remove unused scope parameter from NewSignature
golang.org/cl/10995  provide full source file extent to file scope
golang.org/cl/10996  comment fix in resolver.go
golang.org/cl/11004  updated cmd/vet
golang.org/cl/11042  be robust in the presence of incorrect/missing position info

Fixes #9980.

Change-Id: Id4aff688f6a399f76bf92b84c7e793b8da8baa48
Reviewed-on: https://go-review.googlesource.com/11122
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-15 20:11:37 +00:00
Brad Fitzpatrick
4965a77f1d cmd/go: fix typo
Change-Id: I171a1125e25b13c934c2cd545bd03f49f642910d
Reviewed-on: https://go-review.googlesource.com/11113
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 20:08:24 +00:00
Russ Cox
4dab6d01f1 cmd/go: make -a apply to the standard library, like in Go 1.3
This CL adds a very long comment explaining how isStale and
the new build IDs work. As part of writing the comment I realized:

// When the go command makes the wrong build decision and does not
// rebuild something it should, users fall back to adding the -a flag.
// Any common use of the -a flag should be considered prima facie evidence
// that isStale is returning an incorrect false result in some important case.
// Bugs reported in the behavior of -a itself should prompt the question
// ``Why is -a being used at all? What bug does that indicate?''

The two uses of -a that are most commonly mentioned in bugs filed
against the go command are:

	go install -a ./...
	go build -tags netgo -a myprog

Both of these commands now do the right thing without needing -a.

The -a exception we introduced in Go 1.4 was for the first form, and
it broke the second form. Again, neither needs -a anymore, so restore
the old, simpler, easier to explain, less surprising meaning used in Go 1.3:
if -a is given, rebuild EVERYTHING.

See the comment for more justification and history.

Summary of recent CLs (to link bugs to this one):

Fixes #3036. Now 'go install ./...' works.
Fixes #6534. Now 'go install ./...' works.
Fixes #8290. Now 'go install ./...' works.
Fixes #9369. Now 'go build -tags netgo myprog' works.
Fixes #10702. Now using one GOPATH with Go 1.5 and Go 1.6 works.
  (Each time you switch, everything needed gets rebuilt.
  Switching from Go 1.4 to Go 1.5 will rebuild properly.
  Switching from Go 1.5 back to Go 1.4 still needs -a when
  invoking the Go 1.4 go command.)

Change-Id: I19f9eb5286efaa50de7c8326602e94604ab572eb
Reviewed-on: https://go-review.googlesource.com/10761
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 19:38:11 +00:00
Russ Cox
3ab9ff1107 cmd/go: include Go toolchain information in build ID
This causes packages and binaries built by Go 1.5 to look
out of date to Go 1.6 and vice versa, so that when you flip
between different Go versions but keep the same GOPATH,
the right rebuilding happens at each flip.

Go 1.4 binaries will also look out of date to Go 1.5,
but Go 1.5 binaries will not look out of date to Go 1.4
(since Go 1.4 doesn't have anything like this).
People flipping between Go 1.4 and Go 1.5 will still
need to use go install -a every time to flip to Go 1.4,
but not when they flip back to Go 1.5.

Fixes #6534.
Fixes #10702.

Change-Id: I0ae7f268f822d483059a938a4f22846ff9275b4c
Reviewed-on: https://go-review.googlesource.com/10760
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-15 18:57:35 +00:00
Srdjan Petrovic
85b333dbf8 cmd/go: force-overwrite destination files when installing cgo headers
Fixes #11131

When running 'go install -buildmode=c-shared', under the circumstances
described in issue #11131, the install command would fail trying to
install cgo headers if they have already been installed (by a previous
call to 'go install -buildmode=c-shared').

Since it's safe to overwrite said headers (according to iant@), this CL
introduces a parameter to builder's 'copy' and 'move' functions that,
if set to 'true', would force the overwriting of already installed
files.

This parameter value is set to 'true' only when installing cgo headers,
for now.

Change-Id: I5bda17ee757066a8e5d2b39f2e8f3a389eb1e4a2
Reviewed-on: https://go-review.googlesource.com/10870
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 18:29:39 +00:00
Russ Cox
2c2770c3d4 cmd/cgo: make sure pointers passed to C escape to heap
Fixes #10303.

Change-Id: Ia68d3566ba3ebeea6e18e388446bd9b8c431e156
Reviewed-on: https://go-review.googlesource.com/10814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 17:39:53 +00:00
Russ Cox
80ec711755 runtime: use type-based write barrier for remote stack write during chansend
A send on an unbuffered channel to a blocked receiver is the only
case in the runtime where one goroutine writes directly to the stack
of another. The garbage collector assumes that if a goroutine is
blocked, its stack contains no new pointers since the last time it ran.
The send on an unbuffered channel violates this, so it needs an
explicit write barrier. It has an explicit write barrier, but not one that
can handle a write to another stack. Use one that can (based on type bitmap
instead of heap bitmap).

To make this work, raise the limit for type bitmaps so that they are
used for all types up to 64 kB in size (256 bytes of bitmap).
(The runtime already imposes a limit of 64 kB for a channel element size.)

I have been unable to reproduce this problem in a simple test program.

Could help #11035.

Change-Id: I06ad994032d8cff3438c9b3eaa8d853915128af5
Reviewed-on: https://go-review.googlesource.com/10815
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 16:50:30 +00:00
Andrew Gerrand
d14e9e6323 cmd/go: stop early in disallowInternal on erroneous packages
Fixes #11201

Change-Id: I80d8fcfcb5c856aaf9d0e73d756d86018e2bec3b
Reviewed-on: https://go-review.googlesource.com/11110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-15 04:27:27 +00:00
Dmitry Vyukov
202de394f2 cmd/trace: fix panic in goroutine profile
In generateTrace we check that event timestamp is within the interesting range.
Then later in traceContext.time we double check event time.
However, for some events (e.g. emitSlice) we convert time of ev.Link (slice end) rather than ev itself (slice begin).
Slice end can be outside of the interesting time range, and so traceContext.time crashes.
Remove the check in traceContext.time, check in generateTrace loop is sufficient.

Change-Id: If94e93b5653c5816c0a8dcdd920f15df97616835
Reviewed-on: https://go-review.googlesource.com/11100
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 21:57:24 +00:00
Dmitry Vyukov
9a8750b276 misc/trace: update trace viewer
Update to tip to fix #11003 (not possible to select events in chromium).
Fixed #11003

Change-Id: Ibba5d39ca809cfd5cb79c9e6d152b00899d49e08
Reviewed-on: https://go-review.googlesource.com/11062
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 20:58:23 +00:00
Josh Bleecher Snyder
ff8f3f0fa1 cmd/vet: extend copylocks to anonymous functions
Running -copylocks over a large corpus generates 1507 warnings.
Of those, only 3 are from the new anonymous function check,
but they are all bugs.

Fixes #10927.

Change-Id: I2672f6871036bed711beec5f88bc39aa8b3b6a94
Reviewed-on: https://go-review.googlesource.com/11051
Reviewed-by: Rob Pike <r@golang.org>
2015-06-13 03:07:43 +00:00
Alexandre Cesaro
0d0ce8a2af cmd/go: fix documentation
The command "go tool pprof help" does not work:

    $ go tool pprof help
    open help: no such file or directory

The right command is "go tool pprof -h".

Change-Id: Icef5d4ab76774905854e46665ac1166d26d35f46
Reviewed-on: https://go-review.googlesource.com/10970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 13:23:14 +00:00
Alex Brainman
202ef487fe cmd/dist: convert testso test into Go
I would like to re-apply reverted http://golang.org/cl/8523.
Reverted tests still fail in some environments (see issue #10360).
It is easier to run tests selectively when in Go.
This CL prepares for the changes.

Updates #10360

Change-Id: Iefeb1d71cb3d1cfa653a6ccd9f6e35686c0c5b24
Reviewed-on: https://go-review.googlesource.com/10608
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-12 04:33:50 +00:00
Alex Brainman
117506aab6 cmd/go: clean up after 'go build' even on windows
This CL makes CL 10682 work on windows.

Fixes #9645 (again)

Change-Id: Ie9b9af8b041c483a236b46adad4a50aa6e598c92
Reviewed-on: https://go-review.googlesource.com/10930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 02:15:43 +00:00
Ian Lance Taylor
06ef022ba3 cmd/go: add some parallelism to the testsuite
As these tests were originally in bash, they are not designed to be
particularly hermetic.  This CL adds various protective mechanisms to
try to catch cases where the tests can not run in parallel.

Change-Id: I983bf7b6ffba04eda58b4939eb89b0bdfcda8eff
Reviewed-on: https://go-review.googlesource.com/10911
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-11 18:39:14 +00:00
Ian Lance Taylor
9850886fe9 cmd/go: in testsuite, sleep for less than one second if possible
Examine the mtime of an existing file to guess a length of time to
sleep to ensure a different mtime.

Change-Id: I9e8b5c9486f5c3c8bd63125e3ed4763ce1ba767d
Reviewed-on: https://go-review.googlesource.com/10932
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 18:36:37 +00:00
Brad Fitzpatrick
a788c913fa cmd/vet: skip another test on Android
Forgot this one in my previous commit.

Change-Id: Ief089e99bdad24b3bcfb075497dc259d06cc727c
Reviewed-on: https://go-review.googlesource.com/10913
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-11 16:30:56 +00:00
Chris Broadfoot
239ec73e66 cmd/go: reject relative paths that don't start with a dot (.)
Change-Id: Idc4a7fdb561ba5b3b52094d895deaf3fcdf475bf
Reviewed-on: https://go-review.googlesource.com/10716
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-11 16:13:37 +00:00
Brad Fitzpatrick
0beb931c76 cmd/go, cmd/vet: skip tests on Android
Might get the Android build passing, or at least going further.

Change-Id: I08f97156a687abe5a3d95203922f4ffd84fbb212
Reviewed-on: https://go-review.googlesource.com/10924
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-11 14:33:40 +00:00
Ainar Garipov
7f9f70e5b6 all: fix misprints in comments
These were found by grepping the comments from the go code and feeding
the output to aspell.

Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 14:18:57 +00:00
David du Colombier
15c8ab00e8 cmd/go: remove Stat workaround for Plan 9
This issue was fixed in CL 10900.

Change-Id: I88f107cb73c8a515f39e02506ddd2ad1e286b1fb
Reviewed-on: https://go-review.googlesource.com/10940
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 14:03:14 +00:00
Ian Lance Taylor
dc32b7f0fd cmd/go: rewrite testsuite from bash to Go
Change-Id: I8473e3f7653d5389d5fcd94862f0831049b8266e
Reviewed-on: https://go-review.googlesource.com/10809
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-10 20:34:56 +00:00
Alex Brainman
ab08f79af3 cmd/link: stop linker crashing with -s flag on windows
Update #10254

Change-Id: I3ddd26607813ca629e3ab62abf87dc5ab453e36f
Reviewed-on: https://go-review.googlesource.com/10835
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-10 06:49:23 +00:00
Josh Bleecher Snyder
442959ec47 cmd/compile: fix builtin generation
This was a refactoring bug during
'go tool compile', CL 10289.

Change-Id: Ibfd333be39ec72bba331fdf352df619cc21851a9
Reviewed-on: https://go-review.googlesource.com/10849
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-09 21:26:39 +00:00
Josh Bleecher Snyder
a44becef4a cmd/compile: use generated temps in bool codegen
Bool codegen was generating a temp for function calls
and other complex expressions, but was not using it.

This was a refactoring bug introduced by CL 7853.
The cmp code used to do (in short):

	l, r := &n1, &n2

It was changed to:

	l, r := nl, nr

But the requisite assignments:

	nl, nr = &n1, &n2

were only introduced on one of two code paths.

Fixes #10654.

Change-Id: Ie8de0b3a333842a048d4308e02911bb10c6915ce
Reviewed-on: https://go-review.googlesource.com/10844
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-09 17:38:26 +00:00
Brad Fitzpatrick
10425507fd cmd/dist: move guts of race.bash into dist
After a little build coordinator change, this will get us sharding of
the race builder.

Update #11074

Change-Id: I4c55267563b6f5e213def7dd6707c837ae2106bf
Reviewed-on: https://go-review.googlesource.com/10845
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-09 05:22:37 +00:00
Hyang-Ah (Hana) Kim
c9778ec302 cmd/link/internal/ld: include table of contents of c-archive output.
Change-Id: If11621985c0a5a1f2133cdc974f37fd944b93e5e
Reviewed-on: https://go-review.googlesource.com/10808
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-09 00:55:11 +00:00
Josh Bleecher Snyder
494ff188f8 cmd/compile: early typecheck top level OAS2 nodes
Fixes #10977.

Change-Id: I706c953c16daad48595c7fae2d82124614dfc3ad
Reviewed-on: https://go-review.googlesource.com/10780
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-09 00:25:02 +00:00
Robert Griesemer
13e2412876 cmd/vet: remove dependency on types.New
- remove TODO on non-existing fmt.Formatter type
  (type exists now)
- guard uses of imported types against nil

Change-Id: I9ae8e5a448e73c84dec1606ea9d9ed5ddeee8dc6
Reviewed-on: https://go-review.googlesource.com/10777
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-08 20:52:07 +00:00
Alex Brainman
a58e731287 cmd/vet: fix tests on windows
Add .exe to exectable name, so it can be executed on windows.
Use proper windows paths when searching vet output.
Replace Skip with Skipf.

Fixes build

Change-Id: Ife40d8f5ab9d7093ca61c50683a358d4d6a3ba34
Reviewed-on: https://go-review.googlesource.com/10742
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Patrick Mézard <patrick@mezard.eu>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-08 15:14:39 +00:00
Austin Clements
16310571d1 cmd/asm: drop legacy RETURN mnemonic on ppc64
Change-Id: I999b57ef5535c18e02cc27c9bc9f896d73126b50
Reviewed-on: https://go-review.googlesource.com/10674
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-06 00:11:13 +00:00
Austin Clements
9389a86b01 cmd/compile: use obj.ARET instead of ppc64.ARETURN
obj.ARET is the portable return mnemonic. ppc64.ARETURN is a legacy
alias.

This was done with
    sed -i s/ppc64\.ARETURN/obj.ARET/ cmd/compile/**/*.go
    sed -i s/ARETURN/obj.ARET/ cmd/internal/obj/ppc64/obj9.go

Change-Id: I4d8e83ff411cee764774a40ef4c7c34dcbca4e43
Reviewed-on: https://go-review.googlesource.com/10673
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-06 00:07:31 +00:00
Robert Griesemer
11b9928185 cmd/go: update documentation: use 'go doc' rather than 'godoc'
Change-Id: I318c1ef75b18d4687f13499ac225dde2d053505e
Reviewed-on: https://go-review.googlesource.com/10776
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 21:33:52 +00:00
Robert Griesemer
a544a3a6f7 cmd/go: use new vet location
Change-Id: I7d96ebcca5954152edb821bb41b6047a1c622949
Reviewed-on: https://go-review.googlesource.com/10731
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 20:09:36 +00:00
Brad Fitzpatrick
24de40a846 cmd/dist: add more logging details when go list std cmd fails
Change-Id: I12e6990b46ea9c733a5718dc5ca67f1fcd2dec66
Reviewed-on: https://go-review.googlesource.com/10754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 15:19:29 +00:00
Russ Cox
95919328ac cmd/vet: skip exec tests on systems that can't exec
Change-Id: I09257b8f5482cba10b5f4d3813c778d6e9e74d40
Reviewed-on: https://go-review.googlesource.com/10752
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-05 14:35:13 +00:00
Russ Cox
48f2d30d43 cmd/go: fix detection of ELF binaries
Change-Id: I0e6f1a39b3d6b15d05891c8b25ab6644356bde5f
Reviewed-on: https://go-review.googlesource.com/10751
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-05 13:59:30 +00:00
Rob Pike
bbc4351eca cmd/go: add -tags option to go vet
Actually add all build flags, so we also get things like -race.

Fixes #10228.

Change-Id: I5f77dda9d1ee3208e1833702f12f68c2731c4b22
Reviewed-on: https://go-review.googlesource.com/10697
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-05 05:39:36 +00:00
Russ Cox
cd9f417dbb cmd/compile: document Node fields used by each Op
Change-Id: If969d7a06c83447ee38da30f1477a6cf4bfa1a03
Reviewed-on: https://go-review.googlesource.com/10691
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-05 05:01:24 +00:00
Russ Cox
aefa6cd1f9 cmd/link: delete dead flags
Also fix the interaction between -buildmode and -shared.
It's okay for -shared to change the default build mode,
but it's not okay for it to silently override an explicit -buildmode=exe.

Change-Id: Id40f93d140cddf75b19e262b3ba4856ee09a07ba
Reviewed-on: https://go-review.googlesource.com/10315
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-05 04:55:53 +00:00
Russ Cox
12795c02f3 cmd/link: deprecate -X name value in favor of -X name=value
People invoking the linker directly already have to change their scripts
to use the new "go tool link", so this is a good time to make the -X flag
behave like all other Go flags and take just a single argument.

The old syntax will continue to be accepted (it is rewritten into the new
syntax before flag parsing). Maybe some day we will be able to retire it.

Even if we never retire the old syntax, having the new syntax at least
makes the rewriting much less of a kludge.

Change-Id: I91e8df94f4c22b2186e81d7f1016b8767d777eac
Reviewed-on: https://go-review.googlesource.com/10310
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 04:55:41 +00:00
Russ Cox
630930c35e cmd/compile, cmd/link: add docs
These are the Go 1.4 docs but refreshed for Go 1.5.
The most sigificant change is that all references to the Plan 9 toolchain are gone.
The tools no longer bear any meaningful resemblance.

Change-Id: I44f5cadb832a982323d7fee0b77673e55d761b35
Reviewed-on: https://go-review.googlesource.com/10298
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 04:42:35 +00:00
Russ Cox
14da5bef5f cmd/pprof: use copy of svgpan library instead of link to remote site
Fixes #10375.

Change-Id: I78dc3e12035d130c405bdb284b0cceea19f084f6
Reviewed-on: https://go-review.googlesource.com/10690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-05 04:36:00 +00:00
Russ Cox
fddc3ca11c testing: add -test.count flag to run tests and benchmarks multiple times
The flag is available from the go test command as -count:

% go test -run XXX -bench . -count 3
PASS
BenchmarkSprintfEmpty      	30000000	        54.0 ns/op
BenchmarkSprintfEmpty      	30000000	        51.9 ns/op
BenchmarkSprintfEmpty      	30000000	        53.8 ns/op
BenchmarkSprintfString     	10000000	       238 ns/op
BenchmarkSprintfString     	10000000	       239 ns/op
BenchmarkSprintfString     	10000000	       234 ns/op
BenchmarkSprintfInt        	10000000	       232 ns/op
BenchmarkSprintfInt        	10000000	       226 ns/op
BenchmarkSprintfInt        	10000000	       225 ns/op
...

If -cpu is set, each test is run n times for each cpu value.

Original by r (CL 10663).

Change-Id: If3dfbdf21698952daac9249b5dbca66f5301e91b
Reviewed-on: https://go-review.googlesource.com/10669
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-05 04:31:10 +00:00
Russ Cox
de305a197f cmd/go: read new non-ELF build ID in binaries
Fixes #11048.
Fixes #11075.

Change-Id: I81f5ef1e1944056ce5494c91aa4a4a63c758f566
Reviewed-on: https://go-review.googlesource.com/10709
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:08:51 +00:00
Russ Cox
9ae3c560b9 cmd/link: implement -buildid for non-ELF binaries
Non-ELF binary formats are much less flexible and typically do not
have a good place to store the build ID.

We store it as raw bytes at the beginning of the text segment.

The only system I know of that will be upset about this is NaCl,
and NaCl is an ELF system and does not use this.

For #11048.

Change-Id: Iaa7ace703c4cf36392e752eea9b55e2ce49e9826
Reviewed-on: https://go-review.googlesource.com/10708
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:06:46 +00:00
Russ Cox
16ebe9f72e cmd/go: use ELF note instead of binary stamp on ELF systems
Other binary formats to follow.

For #11048.

Change-Id: Ia2d8b47c99c99d171c014b7cfd23c1c7ada5231c
Reviewed-on: https://go-review.googlesource.com/10707
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:06:08 +00:00
Russ Cox
ac1f48e2f6 cmd/link: add -buildid flag to write Go build ID to ELF output, same as cmd/compile
Other binary formats to follow.

Using our own note instead of the GNU build ID note because
we are not the GNU project, and I can't guarantee that the semantics
of our note and the semantics of the GNU note will match forever.
(Also they don't match today.)

For #11048.

Change-Id: Iec7e5a2e49d52b6d3a51b0aface2de7c77a45491
Reviewed-on: https://go-review.googlesource.com/10706
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:02:26 +00:00
Russ Cox
a2c50ece2b cmd/link: add -h flag, for debugging, same as cmd/compile
Change-Id: I3c9b05879fe0b6e94b63e9b65e4411ba2a917134
Reviewed-on: https://go-review.googlesource.com/10705
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:00:11 +00:00
Russ Cox
7e27625e25 cmd/go, cmd/link: use "Go" not "GO" as ELF note identifier
Change-Id: I038e892725836ab7718f7638e8ad5712953f2cb5
Reviewed-on: https://go-review.googlesource.com/10704
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 03:59:46 +00:00
Russ Cox
a9267db56a cmd/go: simplify ELF note reading and enable during bootstrap
The bootstrap restriction is to avoid needing cgo for package net.
There's no problem with building debug/elf and debug/dwarf,
so do that.

An upcoming CL is going to add more note processing code,
and it simplifies things not to have to think about the code being
missing half the time.

Change-Id: I0e2f120ac23f14db6ecfcec7bfe254a69abcf7b6
Reviewed-on: https://go-review.googlesource.com/10703
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 03:53:14 +00:00
Robert Griesemer
09a3a092af cmd/go: fix fmt.Errorf call sites (latent bug)
Change-Id: I4ff42113c5dda553d6f3d58f0e4836dce7c84710
Reviewed-on: https://go-review.googlesource.com/10730
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 23:06:13 +00:00
Rob Pike
ea92f42cc8 cmd/doc: do not show unexported constants
The go/doc package doesn't remove unexported entries from const
and var blocks, so we must trim them ourselves.

Fixes #11008

Change-Id: Ibd60d87e09333964e2588340a2ca2b8804bbaa28
Reviewed-on: https://go-review.googlesource.com/10643
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-04 21:51:49 +00:00
Robert Griesemer
a7d2d4835b cmd/vet: adjust vet to use go/types and friends from std repo
- s|"golang.org/x/tools/go/exact"|"go/constant"|
- s|"golang.org/x/tools/go/types"|"go/types"|
- removed import of gcimporter
- import "go/importer" instead
- trivial adjustments to make use of go/importer
- adjusted import paths for whitelist.go

Change-Id: I43488ff44c329cd869c92dcc31193fb31bebfd29
Reviewed-on: https://go-review.googlesource.com/10695
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 21:24:52 +00:00
Robert Griesemer
1b8b2c1551 cmd/vet: move cmd/vet into std repo
cp -r x/tools/cmd/vet cmd/vet without any changes.
The next change will adjust the source to use std
repo go/types and friends.

This may (temporarily) break the build; the next
commit (immediately following) will fix it. We do
it in two commits so that we can see the manual
changes.

Change-Id: Ic45dab7066f13923e21f8c61200c8c3fd447b171
Reviewed-on: https://go-review.googlesource.com/10694
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 21:22:13 +00:00
David Crawshaw
ebcc7ec148 cmd/dist: use -tags=lldb for iOS tests
As of golang.org/cl/9154, running go test will override a previous
go install -a -tags=lldb std with the tag-less version of stdlib. So
we pass -tags=lldb into the relevant go test commands.

Change-Id: I1c718289d7212373a9383eff53a643f06598f5ed
Reviewed-on: https://go-review.googlesource.com/10701
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-04 20:56:48 +00:00
Brad Fitzpatrick
ec745fc4cb test: make test/run.go support sharding
Also modifies 'dist test' to use that sharding, and removes some old
temporary stuff from dist test which are no longer required.

'dist test' now also supports running a list of tests given in
arguments, mutually exclusive with the existing -run=REGEXP flag. The
hacky fast paths for avoiding the 1 second "go list" latency are now
removed and only apply to the case where partial tests are run via
args, instead of regex.  The build coordinator will use both styles
for awhile. (the statically-sharded ARM builders on scaleway will
continue to use regexps, but the dynamically-shared builders on GCE
will use the list of tests)

Updates #10029

Change-Id: I557800a54dfa6f3b5100ef4c26fe397ba5189813
Reviewed-on: https://go-review.googlesource.com/10688
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-06-04 19:45:29 +00:00
Josh Bleecher Snyder
54789eff38 cmd/internal/obj/arm64: make function prologue more predictable
Static branch prediction guesses that forward branches aren't taken.
Since stacks are rarely grown, make the forward branch mean grow.

While we're here, remove the debug-only instruction
saving the frame size in the temp register.

Sample disassembly for

func f() {
	_ = [128]byte{}
}

Before:

0x4008248         ldr        x1, [x28, #0x10]
0x400824c         sub        x2, sp, #0x90
0x4008250         cmp        x2, x1
0x4008254         b.hi       0x4008268
0x4008258         mov        x3, x30
0x400825c         movz       x27, #0x90
0x4008260         bl         runtime.morestack_noctxt
0x4008264         b          main.f
0x4008268         sub        sp, sp, #0x90
0x400826c         add        x16, sp, #0x10
0x4008270         str        xzr, [x16]
0x4008274         str        xzr, [x16, #0x8]
0x4008278         str        xzr, [x16, #0x10]
0x400827c         str        xzr, [x16, #0x18]
0x4008280         str        xzr, [x16, #0x20]
0x4008284         str        xzr, [x16, #0x28]
0x4008288         str        xzr, [x16, #0x30]
0x400828c         str        xzr, [x16, #0x38]
0x4008290         str        xzr, [x16, #0x40]
0x4008294         str        xzr, [x16, #0x48]
0x4008298         str        xzr, [x16, #0x50]
0x400829c         str        xzr, [x16, #0x58]
0x40082a0         str        xzr, [x16, #0x60]
0x40082a4         str        xzr, [x16, #0x68]
0x40082a8         str        xzr, [x16, #0x70]
0x40082ac         str        xzr, [x16, #0x78]
0x40082b0         add        sp, sp, #0x90
0x40082b4         ret

After:

0x4004bc8         ldr        x1, [x28, #0x10]
0x4004bcc         sub        x2, sp, #0x90
0x4004bd0         cmp        x2, x1
0x4004bd4         b.ls       0x4004c28
0x4004bd8         sub        sp, sp, #0x90
0x4004bdc         add        x16, sp, #0x10
0x4004be0         str        xzr, [x16]
0x4004be4         str        xzr, [x16, #0x8]
0x4004be8         str        xzr, [x16, #0x10]
0x4004bec         str        xzr, [x16, #0x18]
0x4004bf0         str        xzr, [x16, #0x20]
0x4004bf4         str        xzr, [x16, #0x28]
0x4004bf8         str        xzr, [x16, #0x30]
0x4004bfc         str        xzr, [x16, #0x38]
0x4004c00         str        xzr, [x16, #0x40]
0x4004c04         str        xzr, [x16, #0x48]
0x4004c08         str        xzr, [x16, #0x50]
0x4004c0c         str        xzr, [x16, #0x58]
0x4004c10         str        xzr, [x16, #0x60]
0x4004c14         str        xzr, [x16, #0x68]
0x4004c18         str        xzr, [x16, #0x70]
0x4004c1c         str        xzr, [x16, #0x78]
0x4004c20         add        sp, sp, #0x90
0x4004c24         ret
0x4004c28         mov        x3, x30
0x4004c2c         bl         runtime.morestack_noctxt
0x4004c30         b          main.f

Updates #10587.

Package sort benchmarks using an iPhone 6:

name            old time/op  new time/op  delta
SearchWrappers   355ns ± 1%   328ns ± 1%  -7.57%  (p=0.000 n=25+19)
SortString1K     580µs ± 1%   577µs ± 1%  -0.48%  (p=0.000 n=25+25)
StableString1K  1.04ms ± 0%  1.04ms ± 0%    ~     (p=0.851 n=24+25)
SortInt1K        251µs ± 1%   247µs ± 1%  -1.52%  (p=0.000 n=23+25)
StableInt1K      267µs ± 2%   261µs ± 2%  -2.02%  (p=0.000 n=25+25)
SortInt64K      23.8ms ± 1%  23.6ms ± 0%  -0.97%  (p=0.000 n=25+23)
StableInt64K    22.8ms ± 0%  22.4ms ± 1%  -1.76%  (p=0.000 n=24+25)
Sort1e2          123µs ± 1%   124µs ± 1%    ~     (p=0.256 n=23+23)
Stable1e2        248µs ± 1%   247µs ± 1%  -0.69%  (p=0.000 n=23+25)
Sort1e4         24.3ms ± 2%  24.6ms ± 5%  +1.36%  (p=0.017 n=22+25)
Stable1e4       77.2ms ± 6%  76.2ms ± 5%  -1.36%  (p=0.020 n=25+25)
Sort1e6          3.95s ± 8%   3.95s ± 8%    ~     (p=0.863 n=25+25)
Stable1e6        15.7s ± 1%   15.5s ± 1%  -1.11%  (p=0.000 n=22+23)

Change-Id: I377b3817af2ed27ddeecf24edef97fad91fc1afc
Reviewed-on: https://go-review.googlesource.com/10500
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-06-04 16:54:22 +00:00