1
0
mirror of https://github.com/golang/go synced 2024-10-02 22:21:20 -06:00
Commit Graph

4200 Commits

Author SHA1 Message Date
Russ Cox
ed9644fc39 cmd/go: undo CL 8119049
Manual undo due to later changes in doc/go1.1.html; cmd/go/test.bash still passes.

Rationale, from CL 8119049 review log:

This makes the 'go run' command different from every other command.
For example, 'go test' does not mean 'go test *.go'.

If we were going to handle the no arguments case in 'go run', I would hope that
it would scan the current directory to find a package just like 'go build' or
'go test' would, and then it would require that package to be 'package main',
and then it would run that package. This would make it match 'go test' and 'go
build' and 'go install' and so on. It would mean that if you are working on a
command in a directory that is 'go install'able, then 'go run' will run the
binary for you. The current CL does not accomplish that when build constraints
or file name constraints are involved.

For example, if I am working on a program like:

$ ls
main.go
main_386.s
main_arm.s
main_amd64.s
$

Then 'go run' will fail here because the .s files are ignored.

If instead I am working on a program like:

$ ls
main.go
main_386.go
main_arm.go
main_amd64.go
$

then 'go run' will fail because too many files are included.

I would like to see this command implemented so that it is compatible with the
other go subcommands. Since it is too late to do that for Go 1.1, I would like
to see this CL reverted, to preserve the option to do it better later.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8797049
2013-04-30 17:04:58 -04:00
Ian Lance Taylor
825b1e1591 cmd/ld: emit relocs for DWARF info when doing an external link
I would like opinions on whether this is a good idea for 1.1.
On the one hand it's a moderately important issue.  On the
other hand this introduces at least the possibility of
external linker errors due to the additional relocations and
it may be better to wait.

I'm fairly confident that the behaviour is unchanged when not
using an external linker.

Update #5221

This CL is tested lightly on 386 and amd64 and fixes the cases
I tested.  I have not tested it on Darwin or Windows.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/8858047
2013-04-30 14:01:05 -07:00
Rob Pike
5c0d782ab8 cmd/ld: another attempt at the relocation overflow fix
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9036046
2013-04-30 09:49:36 -07:00
Rob Pike
700a126c64 cmd/ld: fix check for address wrap in relocation
PC-relative needs a signed offset; others need unsigned.
Also fix signedness of 32-bit relocation on Windows.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9039045
2013-04-30 09:10:10 -07:00
Rob Pike
396d3af8d0 cmd/ld: disable relocation range check so build can go green while we debug the issue.
R=golang-dev, dsymonds, dave
CC=golang-dev
https://golang.org/cl/9038043
2013-04-30 00:19:21 -07:00
Rob Pike
4dcb13bb44 cmd/gc: fix some overflows in the compiler
Some 64-bit fields were run through 32-bit words, some counts were
not checked for overflow, and relocations must fit in 32 bits.
Tests to follow.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9033043
2013-04-29 22:44:40 -07:00
Rob Pike
e4c4edf681 cmd/ld: fix some 64-bit issues
A few places in the linker pushed 64-bit values through 32-bit holes,
including in relocation.
Clean them up, and check for a few other overflows as well.
Tests to follow.

R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/9032043
2013-04-29 22:44:20 -07:00
Jan Ziak
13cbf41a7f cmd/gc: initialize t->width in dgcsym() if required
Update #5291.

R=golang-dev, daniel.morsing, iant, r
CC=golang-dev
https://golang.org/cl/8663052
2013-04-25 18:47:12 +02:00
Rob Pike
2c5e477f48 cmd/vet: clean up the test
- clean up the notypes version of the test so it's quiet
- change the package in the buildtag test to avoid confusing godoc

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/8671049
2013-04-24 10:40:29 -07:00
Ian Lance Taylor
578dc3a96c cmd/5g, cmd/6g, cmd/8g: more nil ptr to large struct checks
R=r, ken, khr, daniel.morsing
CC=dsymonds, golang-dev, rickyz
https://golang.org/cl/8925043
2013-04-24 08:13:01 -07:00
Anthony Martin
d33f09bcc0 cmd/dist: fix line numbers in goc2c generated files
We have to reset the global lineno variable before
processing each file otherwise line numbers will be
offset by the number of lines in the previous file.

The following examples are from the beginning of the
ztime_linux_amd64.c file which is generated from
time.goc in the runtime package.

Before:
    #line 2483 "/home/apm/src/go/src/pkg/runtime/time.goc"
    static Timers timers;
    static void addtimer ( Timer* ) ;
    void
    time·Sleep(int64 ns)
    {
    #line 2492 "/home/apm/src/go/src/pkg/runtime/time.goc"

After:
    #line 16 "/home/apm/src/go/src/pkg/runtime/time.goc"
    static Timers timers;
    static void addtimer ( Timer* ) ;
    void
    time·Sleep(int64 ns)
    {
    #line 25 "/home/apm/src/go/src/pkg/runtime/time.goc"

R=golang-dev, minux.ma, iant, r, adg
CC=golang-dev
https://golang.org/cl/8653045
2013-04-23 16:02:50 -07:00
Alex Brainman
782a57811f cmd/ld: do not relocate ignored PE sections
This should have been part of CL8715043.

Update #5106

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/8676050
2013-04-20 17:42:14 +10:00
Shenghou Ma
0c2b980c49 cmd/ld: don't show cursym in gcc invocation failure message
before:
fmt.statictmp_0731:/usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100
now:
/usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8827045
2013-04-20 02:44:16 +08:00
Shenghou Ma
a5fe79ef78 cmd/dist, make.bash: pass -mmacosx-version-min=10.6 to gcc on Darwin
Fixes #5261.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8798044
2013-04-16 13:30:52 -07:00
Ian Lance Taylor
9ca4a25f4b cmd/ld: ignore PE sections that are not code or data
Update #5106
Update #5273

R=minux.ma, r
CC=golang-dev
https://golang.org/cl/8715043
2013-04-15 10:35:37 -07:00
Daniel Morsing
7b8e08617e cmd/gc: disable inlining of method values
They caused internal compiler errors and they're expensive enough that inlining them doesn't make sense.

Fixes #5259.

R=golang-dev, r, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/8636043
2013-04-13 08:22:16 +02:00
Volker Dobler
18ff727487 cmd/go: quote command line arguments in debug output
Debug output from go test -x may contain empty arguments.
This CL quotes arguments if needed. E.g. the output of
go test -x is now
  .../6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
which is easier to grasp.

R=golang-dev, bradfitz, minux.ma, r
CC=golang-dev
https://golang.org/cl/8633043
2013-04-12 14:05:14 -07:00
Volker Dobler
ce64f7365f cmd/go: quote command line arguments in debug output
Debug output from go test -x may contain empty arguments.
This CL quotes arguments if needed. E.g. the output of
go test -x is now
  .../6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
which is easier to grasp.

R=golang-dev, bradfitz, minux.ma, r
CC=golang-dev
https://golang.org/cl/8633043
2013-04-12 14:04:00 -07:00
Ian Lance Taylor
696901204f cmd/ld: always do external link for -linkmode=external
There are tests in run.bash for -linkmode=external.

Fixes #5238.

R=golang-dev, bradfitz, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/8716044
2013-04-12 13:21:17 -07:00
Ian Lance Taylor
813590b145 cmd/ld: if we fail from an unexpected PE flags value, print it
R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/8709043
2013-04-12 07:58:50 -07:00
Volker Dobler
a9f1569e7b gc: escape unicode BOM in exported string literals
Fixes #5260.

R=golang-dev, minux.ma, 0xjnml, r
CC=golang-dev
https://golang.org/cl/8658043
2013-04-11 11:45:18 -07:00
Andrew Wilkins
d06be395cc cmd/cgo, cmd/go: remove #cgo directive parsing from cmd/cgo
This change removes processing of #cgo directives from cmd/cgo,
pushing the onus back on cmd/go to pass all necessary flags.

Fixes #5224. See comments for rationale.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8610044
2013-04-10 21:41:54 -07:00
Anthony Martin
7ac20853fc cmd/ld: fix scope of static objects in symbol table
All symbols are currently marked with global scope.
The correct behavior was lost when the symbol table
format was changed.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8625043
2013-04-10 18:47:58 -07:00
Shenghou Ma
f0fc16abd7 cmd/ld: fix argument passing in doc.go
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8622043
2013-04-11 04:04:02 +08:00
Rémy Oudompheng
0e76a943c9 cmd/ld: fix inconsistency in internal linking of common symbols.
Some variables declared in C could end up as undefined symbols
in the final binary and have null address.

Fixes #5114.
Fixes #5227.

R=golang-dev, iant, ajstarks, dave, r
CC=golang-dev
https://golang.org/cl/8602044
2013-04-10 07:15:49 +02:00
Andrew Wilkins
afb49aada5 cmd/cgo: record CGO_LDFLAGS env var in _cgo_flags
cgo stores cgo LDFLAGS in _cgo_flags and _cgo_defun.c.
The _cgo_defun.c records the flags via
"#pragma cgo_ldflag <flag>", which external linking
relies upon for passing libraries (and search paths)
to the host linker.

The go command will allow LDFLAGS for cgo to be passed
through the environment (CGO_LDFLAGS); cgo ignores
this environment variable, and so its value doesn't
make it into the above mentioned files. This CL changes
cgo to record CGO_LDFLAGS also.

Fixes #5205.

R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/8465043
2013-04-09 07:35:06 +08:00
Rémy Oudompheng
20e05303fe cmd/gc: properly set variadic flag on method values.
Fixes #5231.

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/8275044
2013-04-08 08:59:33 +02:00
Rob Pike
18ca86ebb3 cmd/go: fix a misleading sentence
Apologies for not reviewing the previous CL; I was on the road.
The text was misleading; execution is no more separate than with
any other test. Rewritten. Dropped the odd adverb.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8439045
2013-04-07 23:27:26 -07:00
Andrew Gerrand
212cb0375a cmd/go: clarify what "pkg.test" means wrt the -c flag
Fixes #5230.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8507043
2013-04-08 16:03:19 +10:00
Kamil Kisiel
091970c551 cmd/go: document usage of external test packages
Fixes #5144

R=golang-dev, r, dave, adg
CC=golang-dev
https://golang.org/cl/8171044
2013-04-08 14:42:06 +10:00
John Howard Palevich
1142c2f418 cmd/go: fix capitalization of Bitbucket, document Git support
Fixes #5226.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/8320044
2013-04-07 04:06:11 +08:00
Rémy Oudompheng
2d3216f4a8 cmd/gc: fix Offsetof computation.
The offset of an embedded field s.X must be relative to s
and not to the implicit s.Field of which X is a direct field.
Moreover, no indirections may happen on the path.

Fixes #4909.

R=nigeltao, ality, daniel.morsing, iant, gri, r
CC=golang-dev
https://golang.org/cl/8287043
2013-04-05 21:24:07 +02:00
Carl Shapiro
bcc30aa9e1 cmd/gc: fix a typo
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8379043
2013-04-04 11:42:01 -07:00
Anthony Martin
272687ec24 cmd/nm: don't add filename elements for m symbols
The compilers used to generate only one 'm' symbol
to record the stack frame size for each function.

In cmd/nm, the 'm' and 'f' symbols are handled in
the same switch case with a special exception for
the symbol described above called ".frame".

Now that the compilers emit additional 'm' symbols
for precise garbage collection of the stack, the
current logic is incorrect. cmd/nm will attempt to
interpret these new 'm' symbols as 'f' symbols and
add them to the file name index table.

This fails with an out-of-memory condition when
zenter encounters an 'm' symbol with a very large
value (usually the .args symbol indicating a
variadic NOSPLIT function).

R=iant
CC=dave, gobot, golang-dev, rsc
https://golang.org/cl/7962045
2013-04-03 18:23:43 -07:00
Jonathan Rudenberg
2a99f2fb2a cmd/go: run main package when no files are listed
Fixes 5164.

R=golang-dev, iant, adg
CC=golang-dev
https://golang.org/cl/8119049
2013-04-04 12:04:35 +11:00
Rob Pike
c4e82bb923 doc: link the race detector document into the release notes
Also:
- put GORACE into the go env command
- do minor housekeeping on the race detector article

Fixes #4995.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8319044
2013-04-03 13:56:24 -07:00
Robert Griesemer
2ba6ecb3e2 go/parser: ParseExpr must accept type expressions
My old code was trying to be too smart.
Also: Slightly better error message format
for gofmt -r pattern errors.

Fixes #4406.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8267045
2013-04-03 07:41:26 -07:00
Rémy Oudompheng
4b6ca21271 cmd/gc: be more tolerant with recursive types when checking map types.
A nested TFORW type would push algtype1 into an impossible case.

Fixes #5125.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8213043
2013-04-03 08:18:30 +02:00
David Symonds
389093feec cmd/gc: preserve safe annotation of package def.
A package file may begin as either "package foo" or
"package foo safe". The latter is relevant when using -u.
https://golang.org/cl/6903059 resulted in the distinction
being dropped when a package was read for the second or later time.
This CL records whether that "safe" tag was present,
and includes it in the dummy statement generated for the lexer.

R=golang-dev, r, minux.ma, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/8255044
2013-04-03 08:26:08 +11:00
Robert Griesemer
9115e411f5 cmd/gofmt: handle ... in rewrite of calls
Fixes #5059.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8284043
2013-04-02 13:18:32 -07:00
Shenghou Ma
c5d4196834 cmd/go: fix typo in docs
Fixes #5181.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8277043
2013-04-03 03:34:04 +08:00
Robert Griesemer
79682199ce cmd/godoc: don't linkify index entries
Fixes #5186.

R=bradfitz
CC=golang-dev
https://golang.org/cl/8267044
2013-04-02 12:05:14 -07:00
Nigel Tao
4de6687554 cmd/gc: recognize (a.b[0]<<1 | a.b[0]>>31) as a rotate, not just
(x<<1 | x>>31).

Fixes #5084.

On the SHA3 benchmark proposals at
https://golang.org/cl/7760044/

benchmark                       old ns/op    new ns/op    delta
BenchmarkPermutationFunction         1288         1191   -7.53%
BenchmarkSingleByteWrite             5795         5811   +0.28%
BenchmarkBlockWrite512                178          179   +0.56%
BenchmarkBlockWrite384                230          233   +1.30%
BenchmarkBlockWrite256                282          286   +1.42%
BenchmarkBlockWrite224                301          306   +1.66%
BenchmarkBulkHashSHA3_512          326885       304548   -6.83%
BenchmarkBulkHashSHA3_384          234839       220074   -6.29%
BenchmarkBulkHashSHA3_256          186969       175790   -5.98%
BenchmarkBulkHashSHA3_224          178133       167489   -5.98%

For a function like

func g() {
        x = a[3]<<20 | a[3]>>12
}

the asm goes from

0006 (main.go:10) TEXT    g+0(SB),$0-0
0007 (main.go:10) MOVL    a+12(SB),BP
0008 (main.go:10) LOCALS  ,$0
0009 (main.go:11) MOVL    BP,BX
0010 (main.go:11) SHLL    $20,BX
0011 (main.go:11) SHRL    $12,BP
0012 (main.go:11) ORL     BP,BX
0013 (main.go:11) MOVL    BX,x+0(SB)
0014 (main.go:12) RET     ,

to

0006 (main.go:10) TEXT    g+0(SB),$0-0
0007 (main.go:10) LOCALS  ,$0
0008 (main.go:11) MOVL    a+12(SB),BX
0009 (main.go:11) ROLL    $20,BX
0010 (main.go:11) MOVL    BX,x+0(SB)
0011 (main.go:12) RET     ,

R=rsc, iant, remyoudompheng
CC=golang-dev, jcb
https://golang.org/cl/7944043
2013-04-02 21:14:34 +11:00
Keith Randall
0e7144a875 runtime: make map reads multithreaded safe.
Doing grow work on reads is not multithreaded safe.
Changed code to do grow work only on inserts & deletes.

This is a short-term fix, eventually we'll want to do
grow work in parallel to recover the space of the old
table.

Fixes #5120.

R=bradfitz, khr
CC=golang-dev
https://golang.org/cl/8242043
2013-04-01 18:59:58 -07:00
Rob Pike
144dd2b21c testing: document that Log and Logf do not usually produce output
The text is printed only if the test fails or -test.v is set.
Document this behavior in the testing package and 'go help test'.
Also put a 'go install' into mkdoc.sh so I don't get tricked by the
process of updating the documentation ever again.

Fixes #5174.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8118047
2013-04-01 15:17:00 -07:00
Robert Griesemer
a23dd4fe4e cmd/godoc: better error message for missing index files
Fixes #5024.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8222045
2013-04-01 15:15:02 -07:00
Rémy Oudompheng
119189c459 cmd/gc: use appropriate verb to print array type length.
Fixes #4730.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8229043
2013-04-02 00:00:16 +02:00
Lucio De Re
3467068ef4 cmd/cc/cc.h: Add a #pragma for %S used (only) in cmd/cc/sub.c.
Eliminates a format consistency warning.

R=gloang-dev, r
CC=golang-dev
https://golang.org/cl/8217043
2013-04-01 14:21:15 -07:00
Ian Lance Taylor
9182c364aa cmd/ld: add -extld and -extldflags options
Permits specifying the linker to use, and trailing flags to
pass to that linker, when linking in external mode.  External
mode linking is used when building a package that uses cgo, as
described in the cgo docs.

Also document -linkmode and -tmpdir.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8225043
2013-04-01 12:56:18 -07:00
Rémy Oudompheng
df9f4f14b9 cmd/gc: do not reuse bool temporaries for composite equality.
Reusing it when multiple comparisons occurred in the same
function call led to bad overwriting.

Fixes #5162.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8174047
2013-04-01 21:01:50 +02:00
Lucio De Re
79a0c17012 cmd/go: prevent packages from being cleaned more than once
If a package was listed as a dependency from multiple places, it
could have been cleaned repeatedly.

R=golang-dev, dave, rsc, seed, bradfitz
CC=golang-dev, minux.ma
https://golang.org/cl/7482043
2013-04-01 10:01:12 -07:00
David du Colombier
c2e06e0188 cmd/gc, cmd/ld: fix warnings on Plan 9
src/cmd/gc/closure.c:133 param declared and not used: nowrap
src/cmd/gc/const.c:1139 set and not used: t1
src/cmd/ld/data.c:652 format mismatch #llx INT, arg 7
src/cmd/ld/data.c:652 format mismatch #llx INT, arg 8
src/cmd/ld/data.c:1230 set and not used: datsize

R=dave, golang-dev, lucio.dere, remyoudompheng, bradfitz
CC=golang-dev
https://golang.org/cl/8182043
2013-03-30 09:44:52 -07:00
David du Colombier
3a14b42edf cmd/6g: fix warnings on Plan 9
src/cmd/6g/peep.c:471 set and not used: r
src/cmd/6g/peep.c:560 overspecified class: regconsttyp GLOBL STATIC
src/cmd/6g/peep.c:761 more arguments than format IND STRUCT Prog
src/cmd/6g/reg.c:185 set and not used: r1
src/cmd/6g/reg.c:786 format mismatch d VLONG, arg 3
src/cmd/6g/reg.c:1064 format mismatch d VLONG, arg 5

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8197044
2013-03-30 09:31:49 -07:00
Ian Lance Taylor
3197be4807 cmd/dist, cmd/ld: GO_EXTLINK_ENABLED=0 defaults to -linkmode=internal
Change build system to set GO_EXTLINK_ENABLED=0 by default for
OS X 10.6, since the system linker has a bug and can not
handle the object files generated by 6l.

Fixes #5130.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8183043
2013-03-29 16:33:35 -07:00
Keith Randall
fb3ed166e3 runtime: fix gdb printing of maps
Fixes #5098

R=minux.ma, bradfitz, khr, rsc
CC=golang-dev
https://golang.org/cl/7746045
2013-03-29 11:04:07 -07:00
Keith Randall
871177df6a 8a/8l: add PCMPEQB and PMOVMSKB to 386.
Used by CL 8056043 for fast string equals.

R=bradfitz
CC=golang-dev
https://golang.org/cl/8102044
2013-03-29 00:34:03 -07:00
Ian Lance Taylor
47ec6e23d2 cmd/ld: only pass -rdynamic to host linker on ELF target
Fixes #5150.

R=golang-dev, franciscossouza
CC=golang-dev
https://golang.org/cl/8120043
2013-03-28 15:04:25 -07:00
Robert Griesemer
f1b7c140ff cmd/godoc: provide a link from notes to source location
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8122043
2013-03-28 14:40:59 -07:00
Carl Shapiro
c676b8b27b cmd/ld, runtime: restrict stack root scan to locals and arguments
Updates #5134

R=golang-dev, bradfitz, cshapiro, daniel.morsing, ality, iant
CC=golang-dev
https://golang.org/cl/8022044
2013-03-28 14:36:23 -07:00
Robert Griesemer
04341b246e cmd/godoc: cleanups
- removed gratuitous empty lines that creeped into command line output
- changed comment color to a dark green so that links don't visually melt into them
- removed some TODOs
- updated doc.go

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8108044
2013-03-28 13:05:30 -07:00
Ian Lance Taylor
8877a2dfee cmd/ld: when using host linker pass -r option as -rpath
R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8070043
2013-03-28 09:37:32 -07:00
Robert Griesemer
1a427a697e cmd/godoc: don't crash if there's no documentation
Fixes regression introduced by CL 7860049.

R=golang-dev, kamil.kisiel, dave
CC=golang-dev
https://golang.org/cl/8069044
2013-03-28 08:46:17 -07:00
Rob Pike
ab962c8da2 vet: add a progress message to asmdecl.go
Analogous to the one for .go files, it's for .s only and is protected
by the verbose flag.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8030046
2013-03-27 16:55:16 -07:00
Rob Pike
b06b77b8cf vet: fix test_deadcode.go's tests
This is a totally mechanical change.
Errors are reported for the beginning of the statement, not the end,
so the errchk markers need to be on the opening brace, not the closing
one. It seems this test was never run.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7746050
2013-03-27 16:30:20 -07:00
Rob Pike
f3eaaa62a1 cmd/vet: fix assembly test files
They should be build-tagged for vet_test not ignore,
and not have a Go package clause.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8016047
2013-03-27 16:29:12 -07:00
Ian Lance Taylor
b735eeb323 cmd/ld: fix OpenBSD (third try)
On OpenBSD don't mark runtime.{g,m} as STT_TLS symbols.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7867046
2013-03-27 16:00:58 -07:00
Robert Griesemer
611e8dbf52 cmd/godoc: emit id's for constants and variables
Fixes #5077.

R=r
CC=golang-dev
https://golang.org/cl/8021044
2013-03-27 15:14:28 -07:00
Ian Lance Taylor
8d4f381f5c cmd/ld, cmd/8l: Fix OpenBSD build.
Don't generate TLS sections on OpenBSD.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8059043
2013-03-27 15:00:11 -07:00
Ian Lance Taylor
e7fc9a5c57 cmd/6l: fix OpenBSD build
Avoid generating TLS relocations on OpenBSD.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7641055
2013-03-27 14:32:51 -07:00
Rémy Oudompheng
e3b767a5a1 cmd/gc: update runtime.go for new map implementation.
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8051044
2013-03-27 21:51:07 +01:00
Ian Lance Taylor
30e29ee9b6 cmd/ld: emit TLS relocations during external linking
This CL was written by rsc.  I just tweaked 8l.

This CL adds TLS relocation to the ELF .o file we write during external linking,
so that the host linker (gcc) can decide the final location of m and g.

Similar relocations are not necessary on OS X because we use an alternate
program start-time mechanism to acquire thread-local storage.

Similar relocations are not necessary on ARM or Plan 9 or Windows
because external linking mode is not yet supported on those systems.

On almost all ELF systems, the references we use are like %fs:-0x4 or %gs:-0x4,
which we write in 6a/8a as -0x4(FS) or -0x4(GS). On Linux/ELF, however,
Xen's lack of support for this mode forced us long ago to use a two-instruction
sequence: first we load %gs:0x0 into a register r, and then we use -0x4(r).
(The ELF program loader arranges that %gs:0x0 contains a regular pointer to
that same memory location.) In order to relocate those -0x4(r) references,
the linker must know where they are. This CL adds the equivalent notation
-0x4(r)(GS*1) for this purpose: it assembles to the same encoding as -0x4(r)
but the (GS*1) indicates to the linker that this is one of those thread-local
references that needs relocation.

Thanks to Elias Naur for reminding me about this missing piece and
also for writing the test.

R=r
CC=golang-dev
https://golang.org/cl/7891047
2013-03-27 13:27:35 -07:00
Rémy Oudompheng
7c79910cb9 cmd/gc: fix race instrumentation of append and type switches.
The remaining issues are about runtime and sync package
instrumentation.

Update #4228

R=dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/8041043
2013-03-27 20:33:17 +01:00
Robert Griesemer
12cf2ff00b godoc: pass *PageInfos instead of *token.FileSets in templates
- convert all formatters that require a *token.FileSet to
  consistenly use a *PageInfo as first argument instead
- adjust templates correspondingly
- fix outstanding bug from previous CL 8005044

Going forward, with this change the affected functions have
access to the full page "context" (PageInfo), not just the
respective file set. This will permit better context-dependent
formatting in the future.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7860049
2013-03-26 18:28:16 -07:00
Rémy Oudompheng
5f9a9433ea cmd/gc: enable racewalk of HMUL nodes.
A HMUL node appears in some constant divisions, but
to observe a false negative in race detector the divisor must be
suitably chosen to make sure the only memory access is
done for HMUL.

R=dvyukov
CC=golang-dev
https://golang.org/cl/7935045
2013-03-26 23:35:42 +01:00
Robert Griesemer
2180506169 godoc: internal cleanup: remove a TODO
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8005044
2013-03-26 13:12:38 -07:00
Russ Cox
3660b532ac reflect: add garbage collection info in ChanOf, MapOf, PtrTo, SliceOf
ArrayOf will remain unexported (and therefore unused) for Go 1.1.

Fixes #4375.

R=0xe2.0x9a.0x9b, r, iant
CC=golang-dev
https://golang.org/cl/7716048
2013-03-26 11:50:29 -07:00
Robert Griesemer
7cfebf7b1d godoc: link identifiers to declarations
The changes are almost completely self-contained
in the new file linkify.go. The other changes are
minimal and should not disturb the currently
working godoc, in anticipation of Go 1.1.

To disable the feature in case of problems, set
-links=false.

Fixes #2063.

R=adg, r
CC=golang-dev
https://golang.org/cl/7883044
2013-03-26 11:14:30 -07:00
Rémy Oudompheng
eb7c51c148 cmd/gc: more race instrumentation.
Handle interface comparison correctly,
add a few more tests, mark more nodes as impossible.

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7942045
2013-03-26 08:27:18 +01:00
Rémy Oudompheng
ce99bb2caf cmd/gc: fix nil pointer dereferences.
Fixes #5119.

R=golang-dev, dvyukov, dave, rsc
CC=golang-dev
https://golang.org/cl/7838050
2013-03-26 08:20:10 +01:00
Ian Lance Taylor
5a529b61aa cmd/ld: permit sym to be both cgo_export_static and cgo_export_dynamic
Fixes SWIG callbacks.  Previously crosscall2 was only
cgo_export_static, despite the use of two #pragma declarations
in runtime/cgo/callbacks.c.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7817048
2013-03-25 15:37:54 -07:00
Rémy Oudompheng
c0b3c17184 cmd/gc: instrument logical && and ||.
The right operand of a && and || is only executed conditionnally,
so the instrumentation must be more careful. In particular
it should not turn nodes assumed to be cheap after walk into
expensive ones.

Update #4228

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7986043
2013-03-25 22:12:47 +01:00
Rémy Oudompheng
d815a14718 cmd/5l, cmd/6l, cmd/8l: fix segfault on reading LOCALS for a duplicate definition.
Fixes #5105.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7965043
2013-03-25 22:09:55 +01:00
Rémy Oudompheng
77e7e4c329 cmd/cc, cmd/ld: do not overflow strings in symbol lookup.
R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7876044
2013-03-25 08:20:22 +01:00
Shenghou Ma
976d99b9a8 build, cmd/5l: actually report failures for -linkmode tests
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7938046
2013-03-25 03:18:05 +08:00
Rémy Oudompheng
a909e4ba1e cmd/cc: fix typo leading to index out of range.
Detected by GCC static analysis.

Fixes #5117.

R=golang-dev, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7665047
2013-03-24 11:38:57 +01:00
Rémy Oudompheng
a3c2d62a9a cmd/5l, cmd/6l, cmd/8l: remove declaration on non-existent variables.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7985043
2013-03-24 08:55:08 +01:00
Russ Cox
ba0dd1f139 cmd/gc: fix line number for 'missing return' in closure
R=ken2
CC=golang-dev
https://golang.org/cl/7838048
2013-03-22 17:50:29 -04:00
Russ Cox
228fe9d057 cmd/vet: diagnose unreachable code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7493048
2013-03-22 17:46:45 -04:00
Russ Cox
f6d0adedb6 build: remove dead code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7877045
2013-03-22 17:28:22 -04:00
Russ Cox
b5cfbda212 cmd/vet: add assembly checker
Fixes #5036.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7531045
2013-03-22 15:14:40 -04:00
Miki Tebeka
0ffdfe42d1 cmd/cgo: fix the cgo example on multiple assignment context.
Change from atoi to strtol since atoi does not set errno.

R=golang-dev, minux.ma, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7888047
2013-03-21 20:06:25 -07:00
Rémy Oudompheng
88b98ff791 cmd/gc: accept ideal float as indices.
Fixes #4813.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7625050
2013-03-22 00:38:23 +01:00
Robert Griesemer
5e6a1a3f48 go/doc: use regexp for -notes instead of comma-sep. list
-notes="BUG|TODO" instead of -notes="BUG,TODO".
Permits -notes=".*" to see all notes.

R=cnicolaou
CC=golang-dev
https://golang.org/cl/7951043
2013-03-21 15:56:15 -07:00
Russ Cox
b505ff6279 crypto/rc4: faster amd64 implementation
XOR key into data 128 bits at a time instead of 64 bits
and pipeline half of state loads. Rotate loop to allow
single-register indexing for state[i].

On a MacBookPro10,2 (Core i5):

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128          412          224  -45.63%
BenchmarkRC4_1K          3179         1613  -49.26%
BenchmarkRC4_8K         25223        12545  -50.26%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128       310.51       570.42    1.84x
BenchmarkRC4_1K        322.09       634.48    1.97x
BenchmarkRC4_8K        320.97       645.32    2.01x

For comparison, on the same machine, openssl 0.9.8r reports
its rc4 speed as somewhat under 350 MB/s for both 1K and 8K
(it is operating 64 bits at a time).

On an Intel Xeon E5520:

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128          418          259  -38.04%
BenchmarkRC4_1K          3200         1884  -41.12%
BenchmarkRC4_8K         25173        14529  -42.28%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128       306.04       492.48    1.61x
BenchmarkRC4_1K        319.93       543.26    1.70x
BenchmarkRC4_8K        321.61       557.20    1.73x

For comparison, on the same machine, openssl 1.0.1
reports its rc4 speed as 587 MB/s for 1K and 601 MB/s for 8K.

R=agl
CC=golang-dev
https://golang.org/cl/7865046
2013-03-21 16:38:57 -04:00
Shenghou Ma
d04ac4b0b7 cmd/ld: portability fixes
fix code that implicitly assumes little-endian machines.

R=golang-dev, bradfitz, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/6792043
2013-03-22 04:00:54 +08:00
Shenghou Ma
a891b916bd cmd/ld: don't generate DW_AT_type attr for unsafe.Pointer to match gcc behavior
gcc generates only attr DW_AT_byte_size for DW_TAG_pointer_type of "void *",
but we used to also generate DW_AT_type pointing to imaginary unspecified
type "void", which confuses some gdb.
This change makes old Apple gdb 6.x (specifically, Apple version gdb-1515)
accepts our binary without issue like this:
(gdb) b 'main.main'
Die: DW_TAG_unspecified_type (abbrev = 10, offset = 47079)
    has children: FALSE
    attributes:
        DW_AT_name (DW_FORM_string) string: "void"
Dwarf Error: Cannot find type of die [in module /Users/minux/go/go2.hg/bin/go]

Special thanks to Russ Cox for pointing out the problem in comment #6 of
CL 7891044.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7744051
2013-03-22 03:58:35 +08:00
Shenghou Ma
f74b4d3de3 cmd/ld: fix bad merge
CL 7504044 accidentally reverted part of CL 7891044 and 7552045, this CL
bring those part back.

R=golang-dev
TBR=rsc
CC=golang-dev
https://golang.org/cl/7950045
2013-03-22 03:54:14 +08:00
Rémy Oudompheng
656bc3eb96 cmd/gc: implement more cases in racewalk.
Add missing CLOSUREVAR in switch.
Mark MAKE, string conversion nodes as impossible.
Control statements do not need instrumentation.
Instrument COM and LROT nodes.
Instrument map length.

Update #4228

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7504047
2013-03-21 08:53:52 +01:00
Russ Cox
38e9b0773d cmd/gc: fix escape analysis of method values
R=ken2
CC=golang-dev
https://golang.org/cl/7518050
2013-03-20 23:53:27 -04:00
Russ Cox
a63d5dd118 cmd/gc: add OCHECKNOTNIL to race walker (fix build)
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/7635046
2013-03-20 17:20:32 -04:00
Daniel Morsing
7c3694c4de cmd/gc: reject methods on non-locals, even if symbol exists
Fixes #5089.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7767044
2013-03-20 22:18:20 +01:00
Russ Cox
d3c758d7d2 cmd/gc: implement method values
R=ken2, ken
CC=golang-dev
https://golang.org/cl/7546052
2013-03-20 17:11:09 -04:00
Keith Randall
00224a356a runtime: faster hashmap implementation.
Hashtable is arranged as an array of
8-entry buckets with chained overflow.
Each bucket has 8 extra hash bits
per key to provide quick lookup within
a bucket.  Table is grown incrementally.

Update #3885
Go time drops from 0.51s to 0.34s.

R=r, rsc, m3b, dave, bradfitz, khr, ugorji, remyoudompheng
CC=golang-dev
https://golang.org/cl/7504044
2013-03-20 13:51:29 -07:00
Dave Cheney
f701e1c320 cmd/6c, cmd/8c: fix stack allocated Biobuf leaking at exit
Fixes #5085.

{6,8}c/swt.c allocates a third Biobuf in automatic memory which is not terminated at the end of the function. This causes the buffer to be 'in use' when the batexit handler fires, confusing valgrind.

Huge thanks to DMorsing for the diagnosis.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7844044
2013-03-20 23:42:00 +11:00
Rémy Oudompheng
b35019fe9a cmd/ld: remove remaining occurrence of isobj.
Fixes cgo builds.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7784044
2013-03-20 08:32:11 +01:00
Dave Cheney
85773e6bc2 cmd/5l: fix arm build
Fixes build. One part of ../misc/cgo/test appears to be unhappy but this does not cause the build to fail.

R=rsc, r
CC=golang-dev
https://golang.org/cl/7769047
2013-03-20 12:05:52 +11:00
Rémy Oudompheng
465ff4cfc0 cmd/gc: implement revised rule for shifts in equality.
R=rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/7613046
2013-03-20 00:19:11 +01:00
Russ Cox
47ce4bd353 cmd/ld: fix typo
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7552045
2013-03-19 16:53:07 -04:00
Russ Cox
40d356e9ab cmd/ld: generate relocated DWARF in hostobj mode
While we're here, downgrade DWARF to version 2.
We're not using any version 3 features, and OS X gdb
only supports version 2.

Fixes #3436.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7891044
2013-03-19 16:31:52 -04:00
Russ Cox
b4f3533c92 cmd/ld: replace -hostobj with -linkmode
Still disabled. Need to fix TLS.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7783044
2013-03-19 15:45:42 -04:00
Jan Ziak
6e69df6102 cmd/gc: support channel types in the garbage collector
R=golang-dev, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/7473044
2013-03-19 19:51:03 +01:00
Robert Griesemer
5268119f26 go/doc, godoc: improved note reading
- A note doesn't have to be in the first
comment of a comment group anymore, and
several notes may appear in the same comment
group (e.g., it is fairly common to have a
TODO(uid) note immediately following another
comment).

- Define a doc.Note type which also contains
note uid and position info.

- Better formatting in godoc output. The position
information is not yet used, but could be used to
locate the note in the source text if desired.

Fixes #4843.

R=r, cnicolaou
CC=gobot, golang-dev
https://golang.org/cl/7496048
2013-03-19 11:14:35 -07:00
Mikio Hara
5ccb769112 cmd/fix: revert IPv6 scoped address zone support of IPNet
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7554051
2013-03-20 01:05:16 +09:00
Daniel Morsing
2667dcd113 cmd/gc: steal escape analysis info when inlining
Usually, there is no esc info when inlining, but there will be when generating inlined wrapper functions.

If we don't use this information, we get invalid addresses on the stack.

Fixes #5056.

R=golang-dev, rsc
CC=golang-dev, remyoudompheng
https://golang.org/cl/7850045
2013-03-18 22:22:35 +01:00
Rémy Oudompheng
861aa4698a cmd/gc: missing type inference for untyped complex() calls.
Fixes #5014.

R=golang-dev, r, rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/7664043
2013-03-16 00:37:28 +01:00
Russ Cox
615f289209 cmd/gc: ensure unique parameter and result names in function types
In addition to fixing the bug, the check is now linear instead of quadratic.

Fixes #4469.

R=ken2
CC=golang-dev
https://golang.org/cl/7773047
2013-03-15 15:24:13 -04:00
Rémy Oudompheng
20c7e41555 cmd/gc: fix escape analysis bug.
It used to not mark parameters as escaping if only one of the
fields it points to leaks out of the function. This causes
problems when importing from another package.

Fixes #4964.

R=rsc, lvd, dvyukov, daniel.morsing
CC=golang-dev
https://golang.org/cl/7648045
2013-03-15 09:03:45 +01:00
Jan Ziak
175c401523 cmd/gc: unroll small array types
R=golang-dev, rsc
CC=golang-dev, nigeltao
https://golang.org/cl/7812044
2013-03-15 06:57:50 +01:00
Tyler Bunnell
f6a952599e cmd/gc: disallow fallthrough in final case of switch
Small change to cmd/gc to catch a "fallthrough" in the final case of a switch.

R=golang-dev, rsc, mtj
CC=golang-dev
https://golang.org/cl/7841043
2013-03-15 00:35:09 -04:00
Anthony Martin
d94da6fab5 cmd/dist: instruct the user to bind $GOBIN on Plan 9
R=seed, rminnich, bradfitz, r
CC=golang-dev
https://golang.org/cl/7395059
2013-03-15 05:04:19 +01:00
Russ Cox
8bbb6d3ed0 cmd/ld: another use-after-free
This only shows up in the duplicate symbol error message.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7486053
2013-03-14 14:35:47 -04:00
Russ Cox
e9d62a6d81 runtime: refactor os-specific code
thread_GOOS.c becomes os_GOOS.c.

signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c,
but with non-GOARCH-specific code moved into os_GOOS.c.

The actual arch-specific signal handler moves into signal_GOARCH.c
to avoid per-GOOS duplication.

New files signal_GOOS_GOARCH.h provide macros for
accessing fields of the very system-specific signal info structs.

Lots moving, but nothing changing.
This is a preliminarly cleanup so I can work on the signal
handling code to fix some open issues without having to
make each change 13 times.

Tested on Linux and OS X, 386 and amd64.
Will fix Plan 9, Windows, and ARM after the fact if necessary.
(Plan 9 and Windows should be fine; ARM will probably have some typos.)

Net effect: -1081 lines of code.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7565048
2013-03-14 11:35:13 -07:00
Dmitriy Vyukov
4dd1b8999a cmd/dist: support goos,goarch build tags
This is necessary to submit netpoll for linux,386 linux,amd64

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7470050
2013-03-14 19:04:47 +04:00
Russ Cox
ffbcd89f62 cmd/go: allow ~ in middle of path, just not at beginning
An earlier CL disallowed ~ anywhere in GOPATH, to avoid
problems with GOPATH='~/home' instead of GOPATH=~/home.
But ~ is only special in the shell at the beginning of each of
the paths in the list, and some paths do have ~ in the middle.
So relax the requirement slightly.

Fixes #4140.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7799045
2013-03-13 23:32:12 -04:00
Russ Cox
e778f93022 cmd/go: add go1.1 build tag, add -installsuffix flag
The new build tag "go1.1" will be satisfied by any Go 1.z release >= 1.1.
In general, the build tag "go1.x" will be satisfied by any Go 1.z release >= 1.x.
What happens when we reach Go 2 is yet to be decided.

The tags "go1" or "go1.0" are missing, because +build tags did not exist
before then, and also because the Go 1.0 releases do not recognize them.

The new -installsuffix flag gives access to the build context's InstallSuffix
(formerly named InstallTag, but not part of Go 1.0), for use in isolating
builds to custom directories. For example -race implies -installsuffix race,
and an AppEngine-specific build might use -tags appengine -installsuffix appengine.

Fixes #4116.
Fixes #4443.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/7794043
2013-03-13 17:37:49 -04:00
Russ Cox
3048a4c7b3 cmd/vet: make struct tag literal test work better with no go/types
Eliminate false positives when you can tell even without
type information that the literal does not need field tags.

Far too noisy otherwise.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7797043
2013-03-13 17:37:37 -04:00
Rob Pike
2211634113 cmd/go: better documentation about profiling
Point the user to "go tool pprof" and mention some
important flags.

Fixes #4990.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7657045
2013-03-13 13:56:51 -07:00
Dave Cheney
8883c484cf cmd/gc: silence valgrind error
valgrind complained that under some circumstances,

    *nr = *nc

was being called when nr and nc were the same *Node. The suggestion my Rémy was to introduce a tmp node to avoid the potential for aliasing in subnode.

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7780044
2013-03-13 16:12:38 -04:00
Russ Cox
f7ad816c5c cmd/ld: fix 'use after free' error in new obj code
Many thanks to Elias Naur for finding this with Valgrind on Linux.
Perhaps this is what is breaking the windows/amd64 builder.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7595044
2013-03-12 17:57:13 -04:00
Rob Pike
4ce79096b6 go/types: delete from main repo; part of move to go.exp
See also https://golang.org/cl/7656044

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/7625048
2013-03-12 13:55:58 -07:00
Russ Cox
d2be8f2948 cmd/addr2line: exit 0 for --help
This is what pprof expects, or else it won't use the program.
And if it doesn't use the program, it gets very bad results.

Fixes #4818.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7728043
2013-03-11 18:12:07 -04:00
Rémy Oudompheng
401e0fea3a cmd/gc: reject complex calls with mismatched argument types.
The specification says "the two arguments must be of the same
floating-point type."

R=rsc, gri
CC=golang-dev
https://golang.org/cl/7671045
2013-03-11 22:55:14 +01:00
Brad Fitzpatrick
e15c0ac693 all: remove now-unnecessary unreachable panics
Take advantage of the new terminating statement rule.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/7712044
2013-03-11 14:16:55 -07:00
Rob Pike
5f91a62a3c cmd/go: fix description of -o flag to build
Fixes #5003.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7476047
2013-03-11 14:07:47 -07:00
Russ Cox
7b4ac31cab cmd/dist: make cc rule match what cmd/go uses
We added -I$GOROOT/pkg/$GOOS_$GOARCH in cmd/go
(I think for use by cgo and swig, primarily) but didn't
update cmd/dist. I was testing some other code and
found that my changes built with cmd/go but failed
during the initial bootstrap. Make them match again.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7707044
2013-03-11 16:50:44 -04:00
Akshat Kumar
76374412c3 lib9, cmd/dist, cmd/ld: Plan 9: fix build
lib9: fix runcmd, removeall, and tempdir functions

cmd/dist: Include run_plan9.c and tempdir_plan9.c
        from lib9 for build, and in general consider
        file names containing "plan9" for building.

cmd/ld: provide function args for the new functions
        from lib9.

R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7666043
2013-03-11 13:34:57 -07:00
Rémy Oudompheng
386ad0ab90 cmd/gc: enable inlining in generated method wrappers.
Method calls on interfaces with large stored values
will call the pointer receiver method which may be
a wrapper over a method with value receiver.

This is particularly inefficient for very small bodies.
Inlining the wrapped method body saves a potentially expensive
function call.

benchmark                old ns/op    new ns/op    delta
BenchmarkSortString1K       802295       641387  -20.06%
BenchmarkSortInt1K          359914       238234  -33.81%
BenchmarkSortInt64K       35764226     22803078  -36.24%

Fixes #4707.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7214044
2013-03-11 21:24:51 +01:00
Shenghou Ma
960d7082ee cmd/ld, runtime/cgo: allow a symbol to be both cgo_export and cgo_import.
Fixes #4878.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7420052
2013-03-11 14:24:51 +08:00
Russ Cox
72dd01451f cmd/5l: fix build (define stub machoreloc1)
R=ken2
CC=golang-dev
https://golang.org/cl/7694043
2013-03-11 01:27:03 -04:00
Russ Cox
3b85b724c5 cmd/ld: darwin support for host linking
R=ken2
CC=golang-dev
https://golang.org/cl/7626045
2013-03-11 00:51:42 -04:00
Russ Cox
9e13803ae1 cmd/ld: avoid redundant external relocation calculations
R=ken2, ken
CC=golang-dev
https://golang.org/cl/7483045
2013-03-10 19:07:16 -07:00
Jeff R. Allen
53f034c7a8 cmd/go: send output of build and install to stderr
"go build" and "go install" were mixing stdout and stderr
from the toolchain, then putting it all on stdout. With this
change, it stays mixed, and is sent to stderr. Because
the toolchain does not create output in a clean compile/install,
sending all output to stderr makese more sense.

Also fix test.bash because of "mktemp: too few X's
in template `testgo'" on Linux.

Fixes #4917.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7393073
2013-03-11 11:31:14 +11:00
Russ Cox
96b243fa47 cmd/ld: replace dynimpname with extname
Dynimpname was getting too confusing.
Replace flag-like checks with tests of s->type.

R=ken2
CC=golang-dev
https://golang.org/cl/7594046
2013-03-10 18:19:53 -04:00
Russ Cox
4c40e5ae51 cmd/ld: wrap long data lines in -a output
Also move symbol names onto lines by themselves: some are very long.
Show relocations.

R=ken2
CC=golang-dev
https://golang.org/cl/7689043
2013-03-10 16:32:00 -04:00
Russ Cox
df6072b41c cmd/ld: include full symbol table in Mach-O output
This makes binaries work with OS X nm.

R=ken2
CC=golang-dev
https://golang.org/cl/7558044
2013-03-10 16:24:01 -04:00
Russ Cox
b83d4af330 cmd/ld: make mach-o sections match internal sections
This brings Mach-O generation more in line with ELF generation.

Having separate sections for the symtab and pclntab mean that we
can find them that way, instead of using the deprecated debug segments.
(And the host linker will keep separate sections for us, but probably
not the debug segments.)

R=ken2
CC=golang-dev
https://golang.org/cl/7688043
2013-03-10 14:17:04 -04:00
Russ Cox
e982ecacd1 cmd/ld: add tmpdir flag to preserve temp files
R=ken2
CC=golang-dev
https://golang.org/cl/7497044
2013-03-10 12:50:44 -04:00
Lucio De Re
a8e55f8858 cmd/8l/obj.c: NetBSD passes the test, Hnetbsd added.
myrtle$ go version
go version devel +d533352b414d Sat Mar 09 05:39:15 2013 +0100 netbsd/386
myrtle$ time go test -ldflags -hostobj ../misc/cgo/test
ok      _/var/project/GoLang/misc/cgo/test      10.962s
   68.63s real    49.60s user    19.06s system
myrtle$ uname -a
NetBSD myrtle.plan9.local 6.0_BETA2 NetBSD 6.0_BETA2 (GENERIC) i386

R=rsc
CC=golang-dev
https://golang.org/cl/7641047
2013-03-09 14:54:56 -08:00
Steve McCoy
18f926aab3 cgo: enable external linking mode on FreeBSD amd64.
Tested on FreeBSD 9.1 amd64, per rsc's instructions at
https://groups.google.com/d/topic/golang-dev/HjRTLvRsJXo/discussion .

R=golang-dev, lucio.dere, devon.odell, rsc
CC=golang-dev
https://golang.org/cl/7664044
2013-03-09 14:51:57 -08:00
Russ Cox
cd94cabad6 cmd/ld: external linking fixes for linux/386
The sticking point on 386 has been the "PC relative" relocations
used to point the garbage collection metadata at the type info.
These aren't in the code segment, and I don't trust that the linker
isn't doing something special that would be okay in code but
not when interpreting the pointers as data (for example, a PLT
jump table would be terrible).

Solve the problem in two steps:

1. Handle "PC relative" relocations within a section internally,
so that the external linker never sees them.

2. Move the gcdata and gcbss tables into the rodata section,
where the type information lives, so that the relocations can
be handled internally.

(To answer the obvious question, we make the gc->type
references relative so that they need not be relocated
individually when generating a shared object file.)

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7629043
2013-03-08 20:22:38 -08:00