1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:00:25 -07:00
Commit Graph

19991 Commits

Author SHA1 Message Date
Russ Cox
9abf0b6e9f cmd/ld: handle large link base addresses
codeblk and datblk were truncating their
arguments to int32. Don't do that.

LGTM=dvyukov, rminnich
R=iant, dvyukov, rminnich
CC=golang-codereviews
https://golang.org/cl/126050043
2014-08-12 17:41:16 -04:00
Russ Cox
0c6146711c cmd/go, go/build: implement import comment checking
See golang.org/s/go14customimport for design.

Added case to deps_test to allow go/build to import regexp.
Not a new dependency, because go/build already imports go/doc
which imports regexp.

Fixes #7453.

LGTM=r
R=r, josharian
CC=golang-codereviews
https://golang.org/cl/124940043
2014-08-12 17:41:03 -04:00
Andrew Gerrand
f497885c63 doc: document go1.3.1
LGTM=r
R=r, rsc
CC=golang-codereviews
https://golang.org/cl/126060043
2014-08-13 07:39:52 +10:00
Brad Fitzpatrick
67e1d40031 crypto/rand: use getrandom system call on Linux
Adds internal/syscall package.

Fixes #8520

LGTM=r, agl
R=agl, rsc, r
CC=golang-codereviews, iant
https://golang.org/cl/123260044
2014-08-12 14:35:27 -07:00
Dmitriy Vyukov
1837419f30 runtime: remove FlagNoProfile
Turns out to be unused as well.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, khr
https://golang.org/cl/127170044
2014-08-13 01:03:32 +04:00
Dmitriy Vyukov
fe7b29f5fd runtime/pprof: fix data race
It's unclear why we do this broken double-checked locking.
The mutex is not held for the whole duration of CPU profiling.
Fixes #8365.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/116290043
2014-08-13 01:02:01 +04:00
Matthew Dempsky
11016f62d8 cmd/cgo: make C function pointers non-assignable
Fixes #7757.
Fixes #8488.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/118690044
2014-08-12 12:55:12 -07:00
Thiago Fransosi Farina
e4d4787581 dist: Make vaddn private to buf.c
This function does not have a declaration/prototype in a.h, and it is used only
in buf.c, so it is local to it and thus can be marked as private by adding
'static' to it.

LGTM=iant
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/122300043
2014-08-12 07:49:10 -07:00
Ian Lance Taylor
881fbf9a7d A+C: Thiago Fransosi Farina (individual CLA)
Generated by a+c.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/125960043
2014-08-12 07:48:34 -07:00
Matthew Dempsky
444b928405 run.bash: run misc/cgo/testgodefs/test.bash
misc/cgo/testgodefs was added by revision d1cf884a594f, but not
add to run.bash.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/129760044
2014-08-12 07:13:52 -07:00
Matthew Dempsky
31a996edb6 cmd/cgo: fix default alignment for empty structs
Fixes #5242.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/125120043
2014-08-11 22:10:17 -07:00
Matthew Dempsky
03e6a88ef0 cmd/cgo: iterate over names in deterministic order
This makes GCC behavior (and cgo build failures) deterministic.

Fixes #8487.

Ran this shell command on linux/amd64 (Ubuntu 12.04) before and
after this change:

    for x in `seq 100`; do
      go tool cgo -debug-gcc=true issue8441.go 2>&1 | md5sum
    done | sort | uniq -c

Before:
    67 2cdcb8c7c4e290f7d9009abc581b83dd  -
    10 9a55390df94f7cec6d810f3e20590789  -
    10 acfad22140d43d9b9517bbc5dfc3c0df  -
    13 c337f8fee2304b3a8e3158a4362d8698  -

After:
    100 785c316cbcbcd50896695050e2fa23c1  -

LGTM=minux, iant
R=golang-codereviews, bradfitz, minux, iant
CC=golang-codereviews
https://golang.org/cl/126990043
2014-08-11 16:49:13 -07:00
Andres Erbsen
fce63888ce crypto/tls: implement tls-unique channel binding (RFC 5929 section 3).
Tested against GnuTLS and Python.

LGTM=agl
R=golang-codereviews, agl, ashankar
CC=agl, golang-codereviews
https://golang.org/cl/117100043
2014-08-11 16:40:42 -07:00
Andrew Gerrand
f46f3432a6 compress/{gzip,zlib}: mention that Close flushes
Our other CloseFlushers (archive/tar, compress/flate) do mention this.

The original change was accidentally submitted to the release branch:
        https://golang.org/cl/117430043/

TBR=rsc
R=r, rsc
CC=golang-codereviews
https://golang.org/cl/124130043
2014-08-12 09:27:39 +10:00
Chris Manghane
897f7a31fa cmd/gc: comma-ok assignments produce untyped bool as 2nd result
LGTM=rsc
R=gri, rsc
CC=golang-codereviews
https://golang.org/cl/127950043
2014-08-11 16:11:55 -07:00
Shenghou Ma
b5674a2b72 cmd/8g: fix build
Fixes #8510.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/129720043
2014-08-11 17:11:31 -04:00
Shenghou Ma
4769f87e0d runtime: no need to set R9 to m for runtime.sigpanic anymore
Replaces CL 123980043 which I created on the dev.power64 branch.

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/123120043
2014-08-11 17:10:23 -04:00
Shenghou Ma
2a37efbe1e misc/nacl/testzip.proto: add fewer files to the zip
LGTM=bradfitz, rsc
R=rsc, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/126940043
2014-08-11 16:56:36 -04:00
Russ Cox
988516ec46 A+C: Andrew Bursavich (individual CLA)
Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/124120043
2014-08-11 16:54:34 -04:00
Russ Cox
5b63ce4e19 cmd/6g, cmd/8g: fix, test byte-sized magic multiply
Credit to Rémy for finding and writing test case.

Fixes #8325.

LGTM=r
R=golang-codereviews, r
CC=dave, golang-codereviews, iant, remyoudompheng
https://golang.org/cl/124950043
2014-08-11 15:24:36 -04:00
Matthew Dempsky
eae9fee3bf cmd/link: fix zig-zag decoding
The >>1 shift needs to happen before converting to int32, otherwise
large values will decode with an incorrect sign bit.

The <<31 shift can happen before or after, but before is consistent
with liblink and the go12symtab doc.

Bug demo at http://play.golang.org/p/jLrhPUakIu

LGTM=rsc
R=golang-codereviews, minux, rsc
CC=golang-codereviews
https://golang.org/cl/119630043
2014-08-11 13:53:38 -04:00
Rob Pike
5a17aaa830 doc/go1.4.txt: go.sys subrepo created
CC=golang-codereviews
https://golang.org/cl/124050043
2014-08-08 14:54:04 -07:00
Rob Pike
f0bfd7b037 A+C: Joel Stemmer (individual CLA)
Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/127800043
2014-08-08 12:42:36 -07:00
Joel Stemmer
298c623e8c time: Fix missing colon when formatting time zone offsets with seconds
When formatting time zone offsets with seconds using the stdISO8601Colon
and stdNumColon layouts, the colon was missing between the hour and minute
parts.

Fixes #8497.

LGTM=r
R=golang-codereviews, iant, gobot, r
CC=golang-codereviews
https://golang.org/cl/126840043
2014-08-08 12:42:20 -07:00
Ian Lance Taylor
f69f45c538 test: add another test case that gccgo crashed on
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/124020044
2014-08-08 10:43:44 -07:00
Dmitriy Vyukov
44106a0880 runtime: bump MaxGcprocs to 32
There was a number of improvements related to GC parallelization:
1. Parallel roots/stacks scanning.
2. Parallel stack shrinking.
3. Per-thread workbuf caches.
4. Workset reduction.
Currently 32 threads work well.
go.benchmarks:garbage benchmark on 2 x Intel Xeon E5-2690 (16 HT cores)

1 thread/1 processor:
time=16405255
cputime=16386223
gc-pause-one=546793975
gc-pause-total=3280763

2 threads/1 processor:
time=9043497
cputime=18075822
gc-pause-one=331116489
gc-pause-total=2152257

4 threads/1 processor:
time=4882030
cputime=19421337
gc-pause-one=174543105
gc-pause-total=1134530

8 threads/1 processor:
time=4134757
cputime=20097075
gc-pause-one=158680588
gc-pause-total=1015555

16 threads/1 processor + HT:
time=2006706
cputime=31960509
gc-pause-one=75425744
gc-pause-total=460097

16 threads/2 processors:
time=1513373
cputime=23805571
gc-pause-one=56630946
gc-pause-total=345448

32 threads/2 processors + HT:
time=1199312
cputime=37592764
gc-pause-one=48945064
gc-pause-total=278986

LGTM=rlh
R=golang-codereviews, tracey.brendan, rlh
CC=golang-codereviews, khr, rsc
https://golang.org/cl/123920043
2014-08-08 20:52:11 +04:00
Matthew Dempsky
28cf62ed85 runtime: mark functions as static where possible
Update #8092

LGTM=dvyukov
R=golang-codereviews, minux, dvyukov
CC=golang-codereviews
https://golang.org/cl/122250043
2014-08-08 20:15:52 +04:00
Dmitriy Vyukov
d6d7170de4 runtime: fix data race in stackalloc
Stack shrinking happens during mark phase,
and it assumes that it owns stackcache in mcache.
Stack cache flushing also happens during mark phase,
and it accesses stackcache's w/o any synchronization.
This leads to stackcache corruption:
http://goperfd.appspot.com/log/309af5571dfd7e1817259b9c9cf9bcf9b2c27610

LGTM=khr
R=khr
CC=golang-codereviews, rsc
https://golang.org/cl/126870043
2014-08-08 20:13:57 +04:00
Russ Cox
a83bbc9c48 syscall: ignore EINVAL/ENOENT from readdirent on OS X 10.10
On OS X 10.10 Yosemite, if you have a directory that can be returned
in a single getdirentries64 call (for example, a directory with one file),
and you read from the directory at EOF twice, you get EOF both times:
        fd = open("dir")
        getdirentries64(fd) returns data
        getdirentries64(fd) returns 0 (EOF)
        getdirentries64(fd) returns 0 (EOF)

But if you remove the file in the middle between the two calls, the
second call returns an error instead.
        fd = open("dir")
        getdirentries64(fd) returns data
        getdirentries64(fd) returns 0 (EOF)
        remove("dir/file")
        getdirentries64(fd) returns ENOENT/EINVAL

Whether you get ENOENT or EINVAL depends on exactly what was
in the directory. It is deterministic, just data-dependent.

This only happens in small directories. A directory containing more data
than fits in a 4k getdirentries64 call will return EOF correctly.
(It's not clear if the criteria is that the directory be split across multiple
getdirentries64 calls or that it be split across multiple file system blocks.)

We could change package os to avoid the second read at EOF,
and maybe we should, but that's a bit involved.
For now, treat the EINVAL/ENOENT as EOF.

With this CL, all.bash passes on my MacBook Air running
OS X 10.10 (14A299l) and Xcode 6 beta 5 (6A279r).

I tried filing an issue with Apple using "Feedback Assistant", but it was
unable to send the report and lost it.

C program reproducing the issue, also at http://swtch.com/~rsc/readdirbug.c:

#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

static void test(int);

int
main(void)
{
        int fd, n;
        DIR *dir;
        struct dirent *dp;
        struct stat st;
        char buf[10000];
        long basep;
        int saw;

        if(stat("/tmp/readdirbug", &st) >= 0) {
                fprintf(stderr, "please rm -r /tmp/readdirbug and run again\n");
                exit(1);
        }

        fprintf(stderr, "mkdir /tmp/readdirbug\n");
        if(mkdir("/tmp/readdirbug", 0777) < 0) {
                perror("mkdir /tmp/readdirbug");
                exit(1);
        }

        fprintf(stderr, "create /tmp/readdirbug/file1\n");
        if((fd = creat("/tmp/readdirbug/file1", 0666)) < 0) {
                perror("create /tmp/readdirbug/file1");
                exit(1);
        }
        close(fd);

        test(0);
        test(1);

        fprintf(stderr, "ok - everything worked\n");
}

static void
test(int doremove)
{
        DIR *dir;
        struct dirent *dp;
        int numeof;

        fprintf(stderr, "\n");
        fprintf(stderr, "opendir /tmp/readdirbug\n");
        dir = opendir("/tmp/readdirbug");
        if(dir == 0) {
                perror("open /tmp/readdirbug");
                exit(1);
        }

        numeof = 0;
        for(;;) {
                errno = 0;
                dp = readdir(dir);
                if(dp != 0) {
                        fprintf(stderr, "readdir: found %s\n", dp->d_name);
                        continue;
                }
                if(errno != 0) {
                        perror("readdir");
                        exit(1);
                }
                fprintf(stderr, "readdir: EOF\n");
                if(++numeof == 3)
                        break;
                if(doremove) {
                        fprintf(stderr, "rm /tmp/readdirbug/file1\n");
                        if(remove("/tmp/readdirbug/file1") < 0) {
                                perror("remove");
                                exit(1);
                        }
                }
        }
        fprintf(stderr, "closedir\n");
        closedir(dir);
}

Fixes #8423.

LGTM=bradfitz, r
R=golang-codereviews, bradfitz, dsymonds, dave, r
CC=golang-codereviews, iant
https://golang.org/cl/119530044
2014-08-08 11:20:45 -04:00
Dmitriy Vyukov
f7832df769 encoding/gob: fix data races in benchmarks
All goroutines decode into the same value.

LGTM=r
R=r, abursavich
CC=golang-codereviews
https://golang.org/cl/123930043
2014-08-08 12:48:34 +04:00
Mikio Hara
21f7d83ffd cmd/go: fix build in airplane mode
LGTM=iant
R=golang-codereviews, adg, iant
CC=golang-codereviews
https://golang.org/cl/122190043
2014-08-08 16:20:20 +09:00
Alex Brainman
40b9440546 debug/pe/testdata: make sure gcc-amd64-mingw-exec has symbols
as per rsc request

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/123970043
2014-08-08 16:19:45 +10:00
Shenghou Ma
be96e52cce misc/nacl/testzip.proto: include cmd/internal/* to fix build
LGTM=adg, dave
R=golang-codereviews, adg, dave
CC=golang-codereviews
https://golang.org/cl/123050043
2014-08-07 21:48:34 -04:00
Alex Brainman
6fb2a05ac9 os: simplify windows Getwd (fixes build)
Current version of Getwd calls Stat that
calls Getwd therefore infinite recursion.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/119600043
2014-08-08 10:09:31 +10:00
Andrew Gerrand
77a8dcab03 encoding/json: document coercion of invalid UTF-8 characters
Fixes #8342.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/122180043
2014-08-08 08:57:41 +10:00
Andrew Gerrand
f3fa0bbd1f flag: mention -h in docs
Fixes #8314.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/125820043
2014-08-08 08:57:18 +10:00
Andrew Gerrand
10c2f56bf9 cmd/go: download test dependencies of all named packages
Fixes #8181.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/123870043
2014-08-08 08:56:40 +10:00
Ian Lance Taylor
750bf48a5a cmd/go: don't pass --buildid=none on OpenBSD
According to the OpenBSD builder, it doesn't work.

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/126830043
2014-08-07 15:05:20 -07:00
Keith Randall
7aa4e5ac5f runtime: convert equality functions to Go
LGTM=rsc
R=rsc, khr
CC=golang-codereviews
https://golang.org/cl/121330043
2014-08-07 14:52:55 -07:00
Adam Langley
12666cb91d doc: add note about crypto/tls cert selection callback.
CC=golang-codereviews
https://golang.org/cl/123950043
2014-08-07 14:22:15 -07:00
Keith Randall
483cb61921 runtime: convert interface routines from C to Go.
LGTM=dvyukov
R=golang-codereviews, dave, bradfitz, dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/98510044
2014-08-07 13:58:42 -07:00
Ian Lance Taylor
5ecbdb049b cmd/go: don't pass --buildid=none on FreeBSD
According to the FreeBSD builder, it doesn't work.

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/121400043
2014-08-07 13:51:29 -07:00
Dmitriy Vyukov
3a3f8993ce runtime: fix nacl/amd64p32 build
C compiler does not support unnamed fields.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/124870043
2014-08-07 23:47:01 +04:00
Robert Griesemer
a3c0ca54b0 go/parser: don't do method receiver checks at parse-time
The ast and printer don't care, and go/types can provide
a better error message.

This change requires an update to the tests for go/types
(go.tools repo). CL forthcoming.

Fixes #8493.

LGTM=adonovan
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/123010044
2014-08-07 12:45:01 -07:00
Ian Lance Taylor
7fdb0292a5 cmd/go: pass --build-id=none when generating a cgo .o
Some systems, like Ubuntu, pass --build-id when linking.  The
effect is to put a note in the output file.  This is not
useful when generating an object file with the -r option, as
it eventually causes multiple build ID notes in the final
executable, all but one of which are for tiny portions of the
file and are therefore useless.

Disable that by passing an explicit --build-id=none when
linking with -r on systems that might do this.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119460043
2014-08-07 12:38:39 -07:00
Keith Randall
3d7e369120 runtime: test distribution of interface hashes.
LGTM=dvyukov
R=dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/121030043
2014-08-07 12:33:20 -07:00
Dmitriy Vyukov
cc063592b0 encoding/gob: make benchmarks parallel
There are lots of internal synchronization in gob,
so it makes sense to have parallel benchmarks.
Also add a benchmark with slices and interfaces.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/115960043
2014-08-07 21:39:32 +04:00
Russ Cox
d078d483ce go/build: look in $GOROOT/src/cmd/foo/bar for import cmd/foo/bar
This lets us have non-main packages like cmd/internal or cmd/nm/internal/whatever.

The src/pkg migration (see golang.org/s/go14mainrepo) will allow this
as a natural side effect. The explicit change here just allows use of the
effect a little sooner.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/117630043
2014-08-07 12:33:19 -04:00
Russ Cox
08033f9816 cmd/addr2line, cmd/nm: factor object reading into cmd/internal/objfile
To do in another CL: make cmd/objdump use cmd/internal/objfile too.

There is a package placement decision in this CL:
cmd/internal/objfile instead of internal/objfile.
I chose to put internal under cmd to make clear (and enforce)
that no standard library packages should use this
(it's a bit dependency-heavy).

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/123910043
2014-08-07 12:33:06 -04:00
Andrew Gerrand
fad69a7b77 cmd/fix: mention -help instead of the non-existent -? flag
Update #8314

TBR=r
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/123890043
2014-08-07 23:24:32 +10:00