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

15825 Commits

Author SHA1 Message Date
Russ Cox
65ed3f1073 math/big: fix comment
The variable is named b not bit.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/7699043
2013-03-11 10:20:33 -04: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
761c386770 build: enable host linking test for all BSDs
Let's just see what breaks.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/7693043
2013-03-11 01:12:18 -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
Rick Arnold
cea78cb58e doc/contribute: add instructions to fix codereview on windows
Tell Windows users how to update Mercurial's library.zip to add some missing dependencies.

Fixes #4745.

R=golang-dev, patrick.allen.higgins, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7558043
2013-03-11 12:14:42 +11: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
Andrew Gerrand
77d6cf1cd5 misc/dashboard: add go.blog sub-repo to dashboard
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7690043
2013-03-11 11:06:21 +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
85d83c2e51 libmach: fix build
I guess it would be too much to ask for gcc on my machine to give
the same errors as gcc on the builder machines.

R=ken2
CC=golang-dev
https://golang.org/cl/7686044
2013-03-10 14:45:57 -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
Dmitriy Vyukov
433824d808 runtime: fix misaligned 64-bit atomic
Fixes #4869.
Fixes #5007.
Update #5005.

R=golang-dev, 0xe2.0x9a.0x9b, bradfitz
CC=golang-dev
https://golang.org/cl/7534044
2013-03-10 20:46:11 +04:00
Brad Fitzpatrick
8d51c33012 net: evaluate the timeout dial opt's deadline at dial time
Previously it was evaluated once, so re-using the timeout option
repeatedly would always generate the same deadine.

Also switch to doing just one pass over the options, making
the private interface actually useful.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7608045
2013-03-09 18:14:00 -08: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
ccec3c764b A+C: Steve McCoy (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7608044
2013-03-09 17:50:31 -05:00
Dave Cheney
9dd92d522f syscall: add PROT_* and MAP_* constants to freebsd
Update #4929

Regenerated from FreeBSD-9.1 for amd64 and 386, FreeBSD-CURRENT for arm.

R=devon.odell, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7438053
2013-03-09 16:25:30 +11:00
Ian Lance Taylor
30b89a84ac net: if accept4 returns EINVAL fall back to accept
R=golang-dev, andybalholm, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7485045
2013-03-08 21:18:06 -08:00
Akshat Kumar
ef7705f6dd runtime: Plan 9: fix errstr
The call to the C function runtime.findnull() requires
that we provide the argument at 0(SP).

R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7559047
2013-03-09 05:39:15 +01: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
Rob Pike
0406c63ea3 text/template: revert minor change to Name method
For  better printing, I recently changed Name to return "<unnamed>" for templates
with empty names, but this causes trouble for the many packages that used "" as
the template name, so restore the old behavior.
It's usually printed as a quoted string anyway, so it should be fine.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7577044
2013-03-08 16:39:54 -08:00
Rémy Oudompheng
1b8f51c917 runtime: fix integer overflow in amd64 memmove.
Fixes #4981.

R=bradfitz, fullung, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7474047
2013-03-09 00:41:03 +01:00
Rob Pike
33e8ca4d67 effective_go.html: add a section on type assertions
The information was missing, oddly enough.

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/7636044
2013-03-08 13:53:17 -08:00
Rob Pike
9e329a0d16 effective_go.html: move and rework the blank identifier section
Also rename the relevant examples and make sure the working one compiles.

R=golang-dev, bradfitz, adg, iant, rsc
CC=golang-dev
https://golang.org/cl/7597043
2013-03-08 10:41:20 -08:00
Brad Fitzpatrick
3cdf8bae1a database/sql: fix Conn leak
Fixes #4902

R=golang-dev, alex.brainman, r, google
CC=golang-dev
https://golang.org/cl/7579045
2013-03-08 10:04:17 -08:00
Russ Cox
1a4599b41a runtime: clear locked bit when goroutine exits
Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.

While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.

Fixes #4971.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/7627043
2013-03-08 11:26:00 -05:00
Russ Cox
091d7210c7 runtime: make TestStackMem a little less flaky
Have seen failures with GOMAXPROCS=4 on Windows.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7626043
2013-03-08 11:25:21 -05:00
Russ Cox
e0c430d5b7 cmd/6l, cmd/8l: fix BSD builds
Before this CL, running

        cd misc/cgo/test
        go test -c
        readelf --dyn-syms test.test | grep cgoexp

turned up many UNDEF symbols corresponding to symbols actually
in the binary but marked only cgo_export_static. Only symbols
marked cgo_export_dynamic should be listed in this mode.
And if the symbol is going to be listed, it should be listed with its
actual address instead of UNDEF.

The Linux dynamic linker didn't care about the seemingly missing
symbols, but the BSD one did.

This CL eliminates the symbols from the dyn-syms table.

R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7624043
2013-03-07 21:23:59 -08:00
Robert Griesemer
51338095eb spec: clarify unsafe.Offsetof
Fixes #4905.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/7583043
2013-03-07 20:11:37 -08:00
Russ Cox
7663ffcae6 cmd/ld: steps toward 386 host linking
- Introduce MaxAlign constant and use in data layout
and ELF section header.

- Allow up to 16-byte alignment for large objects
(will help Keith's hash changes).

- Emit ELF symbol for .rathole (global /dev/null used by 8c).

- Invoke gcc with -m32/-m64 as appropriate.

- Don't invoke gcc if writing the .o file failed.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7563045
2013-03-07 19:57:25 -08:00
Russ Cox
dfc22e29ec runtime: change 386 startup convention
Now the default startup is that the program begins at _rt0_386_$GOOS,
which behaves as if calling main(argc, argv). Main jumps to _rt0_386.

This makes the _rt0_386 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.

386 analogue of https://golang.org/cl/7525043

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7551045
2013-03-07 19:57:10 -08:00
Brad Fitzpatrick
b6e0d39a34 net/http: Transport socket late binding
Implement what Chrome calls socket "late binding". See:
https://insouciant.org/tech/connection-management-in-chromium/

In a nutshell, if our HTTP client needs a TCP connection to a
remote host and there's not an idle one available, rather than
kick off a dial and wait for that specific dial, we instead
kick off a dial and wait for either our own dial to finish, or
any other TCP connection to that same host to become
available.

The implementation looks like a classic "Learning Go
Concurrency" slide.

Chrome's commit and numbers:
http://src.chromium.org/viewvc/chrome?view=rev&revision=36230

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/7587043
2013-03-07 17:56:00 -08:00
Akshat Kumar
a566deace1 syscall: Plan 9: use lightweight errstr in entersyscall mode
Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.

Fixes #4994.

R=rsc, rminnich, ality, dvyukov, rminnich, r
CC=golang-dev
https://golang.org/cl/7567043
2013-03-08 00:54:44 +01:00
Mikio Hara
2ac799cfbc net: fix multicast listener tests
This CL splits multicast listener tests into two; for IPv4 and
for IPv6. It also removes redundant test inputs and makes sure
that assignment of multicast interface to stablize the tests.

Fixes #4059.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7565043
2013-03-08 06:51:06 +09:00
Keith Randall
297bb12809 cmd/6a, cmd/8a, cmd/6l, cmd/8l: add AES instructions
Instructions for use in AES hashing.  See CL#7543043

R=rsc
CC=golang-dev
https://golang.org/cl/7548043
2013-03-07 12:54:00 -08:00
Rémy Oudompheng
4c203172a2 cmd/8g: fix code generation of int64(0) == int64(0).
The code would violate the contract of cmp64.

Fixes #5002.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/7593043
2013-03-07 21:47:45 +01:00
Brad Fitzpatrick
43ee80997a C: add Keith Randall (Google CLA)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7595043
2013-03-07 12:46:44 -08:00
Russ Cox
5641a09171 lib9: fix windows build (don't use runesmprint)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7575046
2013-03-07 14:38:49 -05:00
Robert Griesemer
6ee75663c9 go/types: more internal cleanups
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/7492045
2013-03-07 11:17:30 -08:00
Dominik Honnef
77ddbf1ff0 misc/emacs: Rewrite gofmt to use own function for applying patch instead of using diff-mode.
Instead of relying on gofmt's diff output (which is a unified
    diff), we manually invoke diff -n and produce an RCS format diff,
    which can easily be parsed in Emacs, with the go--apply-rcs-patch
    function.

    This fixes undocumented issues with the old implementation such as
    skipping over hunks of changes, and it fixes the documented issue
    of not being able to handle file names that include whitespace.

    It can also apply the patch on a buffer that has no file name
    attached at all.

    Last but not least, it greatly simplifies the gofmt function
    itself.

Fixes #4766.
Fixes #4475.

R=adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7516046
2013-03-07 13:12:37 -05:00
Dmitriy Vyukov
b000f2286c net: more refactoring in preparation for runtime integrated pollster
Move pollServer from fd_unix.go to fd_poll_unix.go.
Add pollServerInit(*NetFD) to allow custom initialization.
Add pollServer.Close(*NetFD) to allow custom finalization.
Move setDeadline() to fd_poll_unix.go to allow custom handling of deadlines.
Move newPollServer() to fd_poll_unix.go to allow custom initialization.
No logical code changes.
The next step will be to turn off fd_poll_unix.go for some platform
(I have changes for darwin/linux) and redirect it into runtime. See:
https://golang.org/cl/7569043/diff/2001/src/pkg/net/fd_poll_runtime.go

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7513045
2013-03-07 21:44:24 +04:00
Dmitriy Vyukov
cb945ba6ba runtime: fix deadlock
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
        runtime·atomicload(&runtime·sched.nmspinning) +
        runtime·atomicload(&runtime·sched.npidle) > 0)
        continue;

R=rsc
CC=golang-dev
https://golang.org/cl/7424054
2013-03-07 21:39:59 +04:00
Russ Cox
60f783d92b cmd/ld: host linking support for linux/amd64
Still to do: non-linux and non-amd64.
It may work on other ELF-based amd64 systems too, but untested.

"go test -ldflags -hostobj $GOROOT/misc/cgo/test" passes.

Much may yet change, but this seems a reasonable checkpoint.

R=iant
CC=golang-dev
https://golang.org/cl/7369057
2013-03-07 09:19:02 -05:00
Russ Cox
8aafb44b0b runtime: fix cgo callbacks on windows
Fixes #4955.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/7563043
2013-03-07 09:18:48 -05:00
Dmitriy Vyukov
0f136f2c05 net: fix accept/connect deadline handling
Ensure that accept/connect respect deadline,
even if the operation can be executed w/o blocking.
Note this changes external behavior, but it makes
it consistent with read/write.
Factor out deadline check into pollServer.PrepareRead/Write,
in preparation for edge triggered pollServer.
Ensure that pollServer.WaitRead/Write are not called concurrently
by adding rio/wio locks around connect/accept.

R=golang-dev, mikioh.mikioh, bradfitz, iant
CC=golang-dev
https://golang.org/cl/7436048
2013-03-07 17:03:40 +04:00
Mikio Hara
48fa4a10fb net: fix typo in skip message
R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7523044
2013-03-07 19:17:18 +09:00