]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocrypto/tls: disable RC4 by default.
Adam Langley [Tue, 17 Mar 2015 00:13:10 +0000 (17:13 -0700)]
crypto/tls: disable RC4 by default.

RC4 is frowned upon[1] at this point and major providers are disabling it
by default[2].

Those who still need RC4 support in crypto/tls can enable it by
specifying the CipherSuites slice in crypto/tls.Config explicitly.

Fixes #10094.

[1] https://tools.ietf.org/html/rfc7465
[2] https://blog.cloudflare.com/killing-rc4-the-long-goodbye/

Change-Id: Ia03a456f7e7a4362b706392b0e3c4cc93ce06f9f
Reviewed-on: https://go-review.googlesource.com/7647
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agocrypto/tls: panic with unknown hash functions.
Adam Langley [Mon, 16 Mar 2015 23:45:29 +0000 (16:45 -0700)]
crypto/tls: panic with unknown hash functions.

Just so that we notice in the future if another hash function is added
without updating this utility function, make it panic when passed an
unknown handshake hash function. (Which should never happen.)

Change-Id: I60a6fc01669441523d8c44e8fbe7ed435e7f04c8
Reviewed-on: https://go-review.googlesource.com/7646
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Joël Stemmer <stemmertech@gmail.com>
10 years agocrypto/{ecdsa,rsa}: always use io.ReadFull with crypto/rand.Reader.
Adam Langley [Mon, 16 Mar 2015 23:42:12 +0000 (16:42 -0700)]
crypto/{ecdsa,rsa}: always use io.ReadFull with crypto/rand.Reader.

crypto/rand.Reader doesn't ensure that short reads don't happen. This
change contains a couple of fixups where io.ReadFull wasn't being used
with it.

Change-Id: I3855b81f5890f2e703112eeea804aeba07b6a6b8
Reviewed-on: https://go-review.googlesource.com/7645
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agocmd/go: don't crash on unknown GOARCH unless we actually care
Ian Lance Taylor [Tue, 17 Mar 2015 19:58:10 +0000 (12:58 -0700)]
cmd/go: don't crash on unknown GOARCH unless we actually care

For example, "GOARCH=sparc go build -compiler=gccgo" should not crash
merely because the architecture character for sparc is not known.

Change-Id: I18912c7f5d90ef8f586592235ec9d6e5053e4bef
Reviewed-on: https://go-review.googlesource.com/7695
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath/big: clearer semantics for Float.Scan
Robert Griesemer [Tue, 17 Mar 2015 18:15:30 +0000 (11:15 -0700)]
math/big: clearer semantics for Float.Scan

Change-Id: I72e8389ec080be8a0119f98df898de6f5510fa4d
Reviewed-on: https://go-review.googlesource.com/7693
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agocmd/internal/gc: add a comment to esc.go
David Chase [Tue, 17 Mar 2015 19:48:06 +0000 (15:48 -0400)]
cmd/internal/gc: add a comment to esc.go

Change-Id: I19e6542e7d79d60e39d62339da51a827c5aa6d3b
Reviewed-on: https://go-review.googlesource.com/7668
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: fix writebarrier throw in lock_sema
Russ Cox [Tue, 17 Mar 2015 19:07:05 +0000 (15:07 -0400)]
runtime: fix writebarrier throw in lock_sema

The value in question is really a bit pattern
(a pointer with extra bits thrown in),
so treat it as a uintptr instead, avoiding the
generation of a write barrier when there
might not be a p.

Also add the obligatory //go:nowritebarrier.

Change-Id: I4ea097945dd7093a140f4740bcadca3ce7191971
Reviewed-on: https://go-review.googlesource.com/7667
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: Remove write barriers during STW.
Rick Hudson [Thu, 12 Mar 2015 18:19:21 +0000 (14:19 -0400)]
runtime: Remove write barriers during STW.

The GC assumes that there will be no asynchronous write barriers when
the world is stopped. This keeps the synchronization between write
barriers and the GC simple. However, currently, there are a few places
in runtime code where this assumption does not hold.
The GC stops the world by collecting all Ps, which stops all user Go
code, but small parts of the runtime can run without a P. For example,
the code that releases a P must still deschedule its G onto a runnable
queue before stopping. Similarly, when a G returns from a long-running
syscall, it must run code to reacquire a P.
Currently, this code can contain write barriers. This can lead to the
GC collecting reachable objects if something like the following
sequence of events happens:
1. GC stops the world by collecting all Ps.
2. G #1 returns from a syscall (for example), tries to install a
pointer to object X, and calls greyobject on X.
3. greyobject on G #1 marks X, but does not yet add it to a write
buffer. At this point, X is effectively black, not grey, even though
it may point to white objects.
4. GC reaches X through some other path and calls greyobject on X, but
greyobject does nothing because X is already marked.
5. GC completes.
6. greyobject on G #1 adds X to a work buffer, but it's too late.
7. Objects that were reachable only through X are incorrectly collected.
To fix this, we check the invariant that no asynchronous write
barriers happen when the world is stopped by checking that write
barriers always have a P, and modify all currently known sources of
these writes to disable the write barrier. In all modified cases this
is safe because the object in question will always be reachable via
some other path.

Some of the trace code was turned off, in particular the
code that traces returning from a syscall. The GC assumes
that as far as the heap is concerned the thread is stopped
when it is in a syscall. Upon returning the trace code
must not do any heap writes for the same reasons discussed
above.

Fixes #10098
Fixes #9953
Fixes #9951
Fixes #9884

May relate to #9610 #9771

Change-Id: Ic2e70b7caffa053e56156838eb8d89503e3c0c8a
Reviewed-on: https://go-review.googlesource.com/7504
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: copy env strings on startup
David Crawshaw [Tue, 17 Mar 2015 14:18:30 +0000 (10:18 -0400)]
runtime: copy env strings on startup

Some versions of libc, in this case Android's bionic, point environ
directly at the envp memory.

https://android.googlesource.com/platform/bionic/+/master/libc/bionic/libc_init_common.cpp#104

The Go runtime does something surprisingly similar, building the
runtime's envs []string using gostringnocopy. Both libc and the Go
runtime reusing memory interacts badly. When syscall.Setenv uses cgo
to call setenv(3), C modifies the underlying memory of a Go string.

This manifests on android/arm. With GOROOT=/data/local/tmp, a
runtime test calls syscall.Setenv("/os"), resulting in
runtime.GOROOT()=="/os\x00a/local/tmp/goroot".

Avoid this by copying environment string memory into Go.

Covered by runtime.TestFixedGOROOT on android/arm.

Change-Id: Id0cf9553969f587addd462f2239dafca1cf371fa
Reviewed-on: https://go-review.googlesource.com/7663
Reviewed-by: Keith Randall <khr@golang.org>
10 years agomath/big: cleaner handling of exponent under/overflow
Robert Griesemer [Fri, 6 Mar 2015 01:32:57 +0000 (17:32 -0800)]
math/big: cleaner handling of exponent under/overflow

Fixed several corner-case bugs and added corresponding tests.

Change-Id: I23096b9caeeff0956f65ab59fa91e168d0e47bb8
Reviewed-on: https://go-review.googlesource.com/7001
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime: fix comment
Dmitry Vyukov [Fri, 13 Mar 2015 13:02:47 +0000 (16:02 +0300)]
runtime: fix comment

IRIW requires 4 threads: first writes x, second writes y,
third reads x and y, fourth reads y and x.
This is Peterson/Dekker mutual exclusion algorithm based on
critical store-load sequences:
http://en.wikipedia.org/wiki/Dekker's_algorithm
http://en.wikipedia.org/wiki/Peterson%27s_algorithm

Change-Id: I30a00865afbe895f7617feed4559018f81ff4528
Reviewed-on: https://go-review.googlesource.com/7561
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: remove futile wakeups from trace
Dmitry Vyukov [Wed, 11 Mar 2015 15:29:12 +0000 (18:29 +0300)]
runtime: remove futile wakeups from trace

Channels and sync.Mutex'es allow another goroutine to acquire resource
ahead of an unblocked goroutine. This is good for performance, but
leads to futile wakeups (the unblocked goroutine needs to block again).
Futile wakeups caused user confusion during the very first evaluation
of tracing functionality on a real server (a goroutine as if acquires a mutex
in a loop, while there is no loop in user code).

This change detects futile wakeups on channels and emits a special event
to denote the fact. Later parser finds entire wakeup sequences
(unblock->start->block) and removes them.

sync.Mutex will be supported in a separate change.

Change-Id: Iaaaee9d5c0921afc62b449a97447445030ac19d3
Reviewed-on: https://go-review.googlesource.com/7380
Reviewed-by: Keith Randall <khr@golang.org>
10 years agoruntime/cgo: catch EXC_BAD_ACCESS on darwin/arm
David Crawshaw [Sun, 8 Mar 2015 15:37:02 +0000 (11:37 -0400)]
runtime/cgo: catch EXC_BAD_ACCESS on darwin/arm

The Go builders (and standard development cycle) for programs on iOS
require running the programs under lldb. Unfortunately lldb intercepts
SIGSEGV and will not give it back.

https://llvm.org/bugs/show_bug.cgi?id=22868

We get around this by never letting lldb see the SIGSEGV. On darwin,
Unix signals are emulated on top of mach exceptions. The debugger
registers a task-level mach exception handler. We register a
thread-level exception handler which acts as a faux signal handler.
The thread-level handler gets precedence over the task-level handler,
so we can turn the exception EXC_BAD_ACCESS into a panic before lldb
can see it.

Fixes #10043

Change-Id: I64d7c310dfa7ecf60eb1e59f094966520d473335
Reviewed-on: https://go-review.googlesource.com/7072
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

10 years agotest: fix recover4 test on 64kb systems
Dave Cheney [Tue, 17 Mar 2015 03:56:04 +0000 (14:56 +1100)]
test: fix recover4 test on 64kb systems

Fix recover4.go to work on 64kb systems.

Change-Id: I211cb048de1268a8bbac77c6f3a1e0b8c8277594
Reviewed-on: https://go-review.googlesource.com/7673
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/yacc: fix path in documentation
Jeremy Jackins [Tue, 17 Mar 2015 04:00:31 +0000 (13:00 +0900)]
cmd/yacc: fix path in documentation

Change-Id: I367b5a837844e3bee1576c59497d37f5e67c761d
Reviewed-on: https://go-review.googlesource.com/7674
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoRevert "test: disable recover4 test to fix ppc64 builds"
Dave Cheney [Tue, 17 Mar 2015 03:37:31 +0000 (03:37 +0000)]
Revert "test: disable recover4 test to fix ppc64 builds"

This reverts commit 1313e7982f44c24948e73c4795d9606265d36871.

Change-Id: I96cc58baf71156fdfbf8fd61332744bcc3ea52e5
Reviewed-on: https://go-review.googlesource.com/7670
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agotest: disable recover4 test to fix ppc64 builds
Dave Cheney [Tue, 17 Mar 2015 01:38:53 +0000 (12:38 +1100)]
test: disable recover4 test to fix ppc64 builds

Updates #10180

Temporarily disable this test on ppc64 systems as all our builders use 64k page size.

We need a portable way to get the page size of the host so we can correctly size the mmap hole.

Change-Id: Ibd36ebe2f54cf75a44667e2070c385f0daaca481
Reviewed-on: https://go-review.googlesource.com/7652
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoruntime: factor object dumping code out of greyobject
Austin Clements [Thu, 12 Mar 2015 18:26:04 +0000 (14:26 -0400)]
runtime: factor object dumping code out of greyobject

When checkmark fails, greyobject dumps both the object that pointed to
the unmarked object and the unmarked object. This code cluttered up
greyobject, was copy-pasted for the two objects, and the copy for
dumping the unmarked object was not entirely correct.

Extract object dumping out to a new function. This declutters
greyobject and fixes the bugs in dumping the unmarked object. The new
function is slightly cleaned up from the original code to have more
natural control flow and shows a marker on the field in the base
object that points to the unmarked object to make it easy to find.

Change-Id: Ib51318a943f50b0b99995f0941d03ee8876b9fcf
Reviewed-on: https://go-review.googlesource.com/7506
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: fix out of date comment
Austin Clements [Thu, 12 Mar 2015 15:20:02 +0000 (11:20 -0400)]
runtime: fix out of date comment

scanobject no longer returns the new wbuf.

Change-Id: I0da335ae5cd7ef7ea0e0fa965cf0e9f3a650d0e6
Reviewed-on: https://go-review.googlesource.com/7505
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agocmd/internal/gc: mv builtins builtin
Russ Cox [Mon, 16 Mar 2015 23:03:09 +0000 (19:03 -0400)]
cmd/internal/gc: mv builtins builtin

This directory is processed by mkbuiltin.go and generates builtin.go.
It should be named builtin too, not builtins, both for consistency
and because file and directory names in general are singular unless
forced otherwise.

Commented on CL 6233 too.

Change-Id: Ic5d3671443ae9292b69fda118f61a11c88d823fa
Reviewed-on: https://go-review.googlesource.com/7660
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/6g: make proginfo register bits constants
Russ Cox [Tue, 10 Mar 2015 19:18:10 +0000 (15:18 -0400)]
cmd/6g: make proginfo register bits constants

Also replace proginfo call with cheaper calls where only flags are needed.

Change-Id: Ib6e5c12bd8752b87c0d8bcf22fa9e25e04a7941f
Reviewed-on: https://go-review.googlesource.com/7630
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj/x86: minor optimization
Russ Cox [Fri, 13 Mar 2015 15:58:13 +0000 (11:58 -0400)]
cmd/internal/obj/x86: minor optimization

- avoid copy in range ytab
- add fast path to prefixof

Change-Id: I88aa9d91a0abe80d253f7c3bca950b4613297499
Reviewed-on: https://go-review.googlesource.com/7628
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: fmt.Sprintf elimination and minor cleanup
Russ Cox [Thu, 12 Mar 2015 22:45:30 +0000 (18:45 -0400)]
cmd/internal/gc: fmt.Sprintf elimination and minor cleanup

Change-Id: Iaf5a7d25e6308b32c17a38afbbd46befa17aa3a4
Reviewed-on: https://go-review.googlesource.com/7629
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/...: remove use of func() { ... }() in loop increment
Russ Cox [Mon, 9 Mar 2015 04:31:13 +0000 (00:31 -0400)]
cmd/...: remove use of func() { ... }() in loop increment

These were introduced during C -> Go translation when the loop increment
contained multiple statements.

Change-Id: Ic8abd8dcb3308851a1f7024de00711f0f984e684
Reviewed-on: https://go-review.googlesource.com/7627
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: add -d disablenil debug option to turn off nil checks
Russ Cox [Sun, 8 Mar 2015 22:46:28 +0000 (18:46 -0400)]
cmd/internal/gc: add -d disablenil debug option to turn off nil checks

Change-Id: I18f2e2ee141ebb65a8579ee1e440cb9c2069ef86
Reviewed-on: https://go-review.googlesource.com/7626
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/gc: rewrite argtype to substitute in a single pass
Russ Cox [Sun, 8 Mar 2015 17:33:49 +0000 (13:33 -0400)]
cmd/gc: rewrite argtype to substitute in a single pass

Substituting in multiple passes meant walking the type
multiple times, and worse, if a complex type was substituted
in an early pass, later passes would follow it, possibly recursively,
until hitting the depth 10 limit.

Change-Id: Ie61d6ec08438e297baabe932afe33d08f358e55f
Reviewed-on: https://go-review.googlesource.com/7625
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/dist: show reason for command failure
Russ Cox [Sun, 8 Mar 2015 17:33:39 +0000 (13:33 -0400)]
cmd/dist: show reason for command failure

Change-Id: I9fb5c1c11a750766ae2d9532869d5ab26f1cf9cf
Reviewed-on: https://go-review.googlesource.com/7624
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocmd/internal/obj: reimplement line history
Russ Cox [Mon, 9 Mar 2015 02:41:48 +0000 (22:41 -0400)]
cmd/internal/obj: reimplement line history

In addition to possibly being clearer code,
this replaces an O(n) lookup with an O(log n) lookup.

Change-Id: I0a574c536a965a87f7ad6dcdcc30f737bc771cd5
Reviewed-on: https://go-review.googlesource.com/7623
Reviewed-by: Rob Pike <r@golang.org>
10 years agocrypto/tls: return correct hash function when using client certificates in handshake
Joël Stemmer [Fri, 6 Mar 2015 13:08:55 +0000 (14:08 +0100)]
crypto/tls: return correct hash function when using client certificates in handshake

Commit f1d669aee994b28e1afcfe974680565932d25b70 added support for
AES_256_GCM_SHA384 cipher suites as specified in RFC5289. However, it
did not take the arbitrary hash function into account in the TLS client
handshake when using client certificates.

The hashForClientCertificate method always returned SHA256 as its
hashing function, even if it actually used a different one to calculate
its digest. Setting up the connection would eventually fail with the
error "tls: failed to sign handshake with client certificate:
crypto/rsa: input must be hashed message".

Included is an additional test for this specific situation that uses the
SHA384 hash.

Fixes #9808

Change-Id: Iccbf4ab225633471ef897907c208ad31f92855a3
Reviewed-on: https://go-review.googlesource.com/7040
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

10 years agocrypto/rsa: implement crypto.Decrypter
Nick Sullivan [Wed, 25 Feb 2015 01:55:25 +0000 (17:55 -0800)]
crypto/rsa: implement crypto.Decrypter

Decrypter is an interface to support opaque private keys that perform
decryption operations. This interface is analogous to the crypto.Signer
interface.

This change introduces the crypto.Decrypter interface and implements
the crypto.Decrypter interface for rsa.PrivateKey with both OAEP and
PKCS#1 v1.5 padding modes.

Change-Id: I433f649f84ed3c2148337d735cafd75f1d94a904
Reviewed-on: https://go-review.googlesource.com/3900
Reviewed-by: Adam Langley <agl@golang.org>
10 years agocmd/internal/obj: add basic test of line history
Russ Cox [Sat, 14 Mar 2015 22:50:18 +0000 (18:50 -0400)]
cmd/internal/obj: add basic test of line history

Change-Id: Ic22e004b43bd98e712befb30684be16d8214c94a
Reviewed-on: https://go-review.googlesource.com/7622
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj: use map for symbol table
Russ Cox [Mon, 9 Mar 2015 02:45:13 +0000 (22:45 -0400)]
cmd/internal/obj: use map for symbol table

Change-Id: I105c1e7730c1e7ccf36297b9cbf96dc0a4868013
Reviewed-on: https://go-review.googlesource.com/7621
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/pprof/internal/profile: insert blank line after non-doc comment
Russ Cox [Thu, 12 Mar 2015 18:26:05 +0000 (14:26 -0400)]
cmd/pprof/internal/profile: insert blank line after non-doc comment

Change-Id: I91fe72c60d6c41644780474620e05380e9af2a3d
Reviewed-on: https://go-review.googlesource.com/7620
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agotest: add test that variables captured by deferred funcs are current on fault
Russ Cox [Wed, 11 Mar 2015 15:52:19 +0000 (11:52 -0400)]
test: add test that variables captured by deferred funcs are current on fault

This came up in private mail.
It works today and I want to make sure it stays working.

Change-Id: I13ebdc2dfadb3c72d7f179be89883137320c05d0
Reviewed-on: https://go-review.googlesource.com/7390
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agotext/template: protect against explicit nil in field chains
Rob Pike [Tue, 13 Jan 2015 22:13:42 +0000 (09:13 +1100)]
text/template: protect against explicit nil in field chains

An explicit nil in an expression like nil.Foo caused a panic
because the evaluator attempted to reflect on the nil.
A typeless nil like this cannot be used to do anything, so
just error out.

Fixes #9426

Change-Id: Icd2c9c7533dda742748bf161eced163991a12f54
Reviewed-on: https://go-review.googlesource.com/7643
Reviewed-by: David Symonds <dsymonds@golang.org>
10 years agodoc/go_mem.html: correct the channel example
Shenghou Ma [Sun, 15 Mar 2015 22:21:08 +0000 (18:21 -0400)]
doc/go_mem.html: correct the channel example

While we're here, also fix two HTML issues.

Fixes #9235.

Change-Id: I6e2f50931c0f387881271484a726ac2308518cf4
Reviewed-on: https://go-review.googlesource.com/7602
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/gc: remove dead code
Josh Bleecher Snyder [Mon, 16 Mar 2015 19:24:51 +0000 (12:24 -0700)]
cmd/internal/gc: remove dead code

Change-Id: Id5ce859bd4b6318dc9104f7377ae23d7f0bc30cd
Reviewed-on: https://go-review.googlesource.com/7640
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/objdump: disable TestDisasm.* on arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:29:44 +0000 (14:29 +0100)]
cmd/objdump: disable TestDisasm.* on arm64

ARM64 doesn't have disassembler yet.

Change-Id: I016fa013b5ff50dc49d38ade42351b79be023d80
Reviewed-on: https://go-review.googlesource.com/7149
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoos/signal, hash/crc32: add arm64 build tags
Aram Hăvărneanu [Sun, 8 Mar 2015 13:28:35 +0000 (14:28 +0100)]
os/signal, hash/crc32: add arm64 build tags

Change-Id: I6ca9caec8ccf12618e56dcf6b83328e7acf8b1ec
Reviewed-on: https://go-review.googlesource.com/7148
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agotest: fix nosplit test, and disable nilptr3 test on arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:27:51 +0000 (14:27 +0100)]
test: fix nosplit test, and disable nilptr3 test on arm64

Change-Id: I5d40e04395de743a8fdcfa8bdc0e580729bc66a3
Reviewed-on: https://go-review.googlesource.com/7147
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoreflect: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:26:40 +0000 (14:26 +0100)]
reflect: add support for GOARCH=arm64

Change-Id: I033eecff5e5838ba677378ac884bf5f29267e880
Reviewed-on: https://go-review.googlesource.com/7146
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosync/atomic: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:26:18 +0000 (14:26 +0100)]
sync/atomic: add support for GOARCH=arm64

Change-Id: I11cd4b5e8daf3805af0eaa83b55b20da889702f4
Reviewed-on: https://go-review.googlesource.com/7145
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agomath, math/big: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:25:50 +0000 (14:25 +0100)]
math, math/big: add support for GOARCH=arm64

Change-Id: Ief12e1435a40dd2eaddc3f97f63be44c4dd2e050
Reviewed-on: https://go-review.googlesource.com/7144
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agosyscall: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:21:00 +0000 (14:21 +0100)]
syscall: add support for GOARCH=arm64

Change-Id: Ia817e78d9678a365a76fea5e4dbe8f8a5aab0bac
Reviewed-on: https://go-review.googlesource.com/7143
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: add support for linux/arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:20:20 +0000 (14:20 +0100)]
runtime: add support for linux/arm64

Change-Id: Ibda6a5bedaff57fd161d63fc04ad260931d34413
Reviewed-on: https://go-review.googlesource.com/7142
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/dist: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:18:23 +0000 (14:18 +0100)]
cmd/dist: add support for GOARCH=arm64

Change-Id: I92b4301b64054272d78dd15c16bf6ff592acad26
Reviewed-on: https://go-review.googlesource.com/7141
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/cgo: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:17:46 +0000 (14:17 +0100)]
cmd/cgo: add support for GOARCH=arm64

Change-Id: Ia6c3d5e7a32b20e3c45d9485e66b48cd02644280
Reviewed-on: https://go-review.googlesource.com/7140
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/7g: add ARM64 Go compiler, based on 9g
Aram Hăvărneanu [Sun, 8 Mar 2015 13:16:29 +0000 (14:16 +0100)]
cmd/7g: add ARM64 Go compiler, based on 9g

No peep optimizer yet.

Change-Id: Ifa5f993cd6ac5e34783c0df41faf772fbce96ae2
Reviewed-on: https://go-review.googlesource.com/7049
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/7l: add the ARM64 linker
Aram Hăvărneanu [Sun, 8 Mar 2015 13:14:53 +0000 (14:14 +0100)]
cmd/7l: add the ARM64 linker

Only internal linking without cgo is supported for now.

Change-Id: I91eb1572c1ccc805db62fc4c29080df98797d51a
Reviewed-on: https://go-review.googlesource.com/7048
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/asm: add support for ARM64
Aram Hăvărneanu [Sun, 8 Mar 2015 13:11:41 +0000 (14:11 +0100)]
cmd/asm: add support for ARM64

Pre/post-index addressing modes with writeback use .W and .P
instruction suffixes, like on ARM.

Complex addressing modes are not supported yet.

Change-Id: I537a1c3fe5b057c0812662677d0010bc8c468ffb
Reviewed-on: https://go-review.googlesource.com/7047
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj, cmd/internal/obj/arm64: add support for GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 12:58:16 +0000 (13:58 +0100)]
cmd/internal/obj, cmd/internal/obj/arm64: add support for GOARCH=arm64

ARM64 (ARMv8) has 32 general purpose, 64-bit integer registers
(R0-R31), 32 64-bit scalar floating point registers (F0-F31), and
32 128-bit vector registers (unused, V0-V31).

R31 is either the stack pointer (RSP), or the zero register (ZR),
depending on the instruction. Note the distinction between the
hardware stack pointer, RSP, and the virtual stack pointer SP.

The (hardware) stack pointer must be 16-byte aligned at all times;
the RSP register itself must be aligned, offset(RSP) only has to
have natural alignment.

Instructions are fixed-width, and are 32-bit wide. ARM64 supports
ARMv7 too (32-bit ARM), but not in the same process. In general,
there is not much in common between 32-bit ARM and ARM64, it's a
new architecture.

All implementations have floating point instructions.

This change adds a Prog.To3 field analogous to Prog.To. It is used
by exclusive load/store instructions such as STLXR which read from
one register, and write to both a register and a memory address.

STLXRW R1, (R0), R3

This will store the word contained in R1 to the memory address
pointed by R0. R3 will be updated with the status result of the
store. It is used to implement atomic operations.

No other changes are made to the portable Prog and Addr structures.

Change-Id: Ie839029aa5265bbad35769d9689eca11e1c48c47
Reviewed-on: https://go-review.googlesource.com/7046
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/go: disable verifyAsm for arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 12:56:41 +0000 (13:56 +0100)]
cmd/go: disable verifyAsm for arm64

ARM64 doesn't have the old assembler.

Change-Id: I9253271029440e2b7f2813d3e98a7d2e7a65bfbc
Reviewed-on: https://go-review.googlesource.com/7045
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agogo/build: add GOARCH=arm64
Aram Hăvărneanu [Sun, 8 Mar 2015 12:55:49 +0000 (13:55 +0100)]
go/build: add GOARCH=arm64

Change-Id: I51db032e3dc2762d94e4000914b30813946250f7
Reviewed-on: https://go-review.googlesource.com/7044
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years ago.gitignore: ignore ARM64 build products
Aram Hăvărneanu [Fri, 13 Mar 2015 10:54:25 +0000 (11:54 +0100)]
.gitignore: ignore ARM64 build products

Change-Id: I56297aac4ee282fd117ec525b88dee4769477111
Reviewed-on: https://go-review.googlesource.com/7560
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agodoc/go1.5: correct archive/zip change
Shenghou Ma [Sun, 15 Mar 2015 21:23:02 +0000 (17:23 -0400)]
doc/go1.5: correct archive/zip change

Change-Id: I7bac7b659b7ff425c6f896c286d0f89f05eff6bd
Reviewed-on: https://go-review.googlesource.com/7601
Reviewed-by: Minux Ma <minux@golang.org>
10 years agosync/atomic: add support for openbsd/arm
Joel Sing [Sun, 15 Mar 2015 06:32:20 +0000 (17:32 +1100)]
sync/atomic: add support for openbsd/arm

Change-Id: I45383de6d627be35f40e07a9008b6773f5c2b0d0
Reviewed-on: https://go-review.googlesource.com/7613
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/dist: use GOARM=5 for openbsd/arm
Joel Sing [Sun, 15 Mar 2015 06:38:05 +0000 (17:38 +1100)]
cmd/dist: use GOARM=5 for openbsd/arm

OpenBSD/arm only currently supports softfloat, hence make the default GOARM=5.

Change-Id: Ie3e8f457f001b3803d17ad9bc4ab957b2da18c6a
Reviewed-on: https://go-review.googlesource.com/7614
Reviewed-by: Minux Ma <minux@golang.org>
10 years agosyscall: add support for openbsd/arm
Joel Sing [Sun, 15 Feb 2015 15:28:39 +0000 (02:28 +1100)]
syscall: add support for openbsd/arm

Change-Id: I9fe15781f52e0d16707a9c021cf800319721a606
Reviewed-on: https://go-review.googlesource.com/4913
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: add support for openbsd/arm
Joel Sing [Sun, 15 Feb 2015 15:03:53 +0000 (02:03 +1100)]
runtime: add support for openbsd/arm

Change-Id: I2bc101aa19172e705ee4de5f3c73a8b4bbf4fa6f
Reviewed-on: https://go-review.googlesource.com/4912
Reviewed-by: Minux Ma <minux@golang.org>
10 years agodoc: note removal of dragonfly/386 port
Joel Sing [Sat, 14 Mar 2015 12:53:31 +0000 (23:53 +1100)]
doc: note removal of dragonfly/386 port

Change-Id: Ibb7e4f6b95b7a9782a47221cafbe4f20dd77fd38
Reviewed-on: https://go-review.googlesource.com/7583
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: skip TestStdcallAndCDeclCallbacks when gcc is missing
Shenghou Ma [Sat, 14 Mar 2015 22:26:39 +0000 (18:26 -0400)]
runtime: skip TestStdcallAndCDeclCallbacks when gcc is missing

Fixes #10167.

Change-Id: Ib6c6b2b5dde47744b69f65482a21964fa3c12090
Reviewed-on: https://go-review.googlesource.com/7600
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agoall: remove dragonfly/386 port
Joel Sing [Sun, 18 Jan 2015 10:02:58 +0000 (21:02 +1100)]
all: remove dragonfly/386 port

DragonFlyBSD dropped support for i386 in 4.0 and there is no longer a
dragonfly/386 - as such, remove the Go port.

Fixes #8951
Fixes #7580
Fixes #7421

Change-Id: I69022ab2262132e8f97153f14dc8c37c98527008
Reviewed-on: https://go-review.googlesource.com/7543
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Joel Sing <jsing@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agoencoding/binary: cull dead code
Josh Bleecher Snyder [Sat, 14 Mar 2015 02:36:09 +0000 (19:36 -0700)]
encoding/binary: cull dead code

Change-Id: I91f9b5280e08e005f5a891aaa249267c211d814b
Reviewed-on: https://go-review.googlesource.com/7592
Reviewed-by: Minux Ma <minux@golang.org>
10 years agodebug/elf: support reading debug info from 32-bit PPC objects
Ian Lance Taylor [Sat, 14 Mar 2015 01:08:33 +0000 (18:08 -0700)]
debug/elf: support reading debug info from 32-bit PPC objects

Fixes #10118.

Change-Id: I4a2e6748db609c6eed1d68c824b81c59bd7b875c
Reviewed-on: https://go-review.googlesource.com/7590
Reviewed-by: Minux Ma <minux@golang.org>
10 years agodebug/gosym: fix typo in comment
Ian Lance Taylor [Sat, 14 Mar 2015 01:16:21 +0000 (18:16 -0700)]
debug/gosym: fix typo in comment

Change-Id: Ieb13359c5bbe26bbf7baaaa8eb63d5e90bdefdd8
Reviewed-on: https://go-review.googlesource.com/7591
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/ld: remove some dead code
Michael Hudson-Doyle [Sat, 7 Mar 2015 03:28:07 +0000 (16:28 +1300)]
cmd/internal/ld: remove some dead code

Just little bits and pieces I noticed were unused in passing, and
some more found with https://github.com/opennota/check.

Change-Id: I199fecdbf8dc2ff9076cf4ea81395275c7f171c3
Reviewed-on: https://go-review.googlesource.com/7033
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: remove unused fields
Matthew Dempsky [Mon, 9 Mar 2015 18:14:35 +0000 (11:14 -0700)]
cmd/internal/gc: remove unused fields

Change-Id: I3096a7497955bc475739739ee23be387e9162867
Reviewed-on: https://go-review.googlesource.com/7210
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agomath/big: wrap Float.Cmp result in struct to prevent wrong use
Robert Griesemer [Sat, 14 Mar 2015 00:24:30 +0000 (17:24 -0700)]
math/big: wrap Float.Cmp result in struct to prevent wrong use

Float.Cmp used to return a value < 0, 0, or > 0 depending on how
arguments x, y compared against each other. With the possibility
of NaNs, the result was changed into an Accuracy (to include Undef).
Consequently, Float.Cmp results could still be compared for (in-)
equality with 0, but comparing if < 0 or > 0 would provide the
wrong answer w/o any obvious notice by the compiler.

This change wraps Float.Cmp results into a struct and accessors
are used to access the desired result. This prevents incorrect
use.

Change-Id: I34e6a6c1859251ec99b5cf953e82542025ace56f
Reviewed-on: https://go-review.googlesource.com/7526
Reviewed-by: Rob Pike <r@golang.org>
10 years agosyscall: add missing Syscall9 for darwin/amd64
Mikio Hara [Tue, 3 Mar 2015 03:15:53 +0000 (12:15 +0900)]
syscall: add missing Syscall9 for darwin/amd64

Fixes #10068.

Change-Id: I1f12225ee16b0090b87403931c0bc0157f068309
Reviewed-on: https://go-review.googlesource.com/6555
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/internal/gc: remove namebuf variable
Matthew Dempsky [Fri, 6 Mar 2015 20:02:24 +0000 (12:02 -0800)]
cmd/internal/gc: remove namebuf variable

namebuf was a global char buffer in the C version of gc, which was
useful for providing common storage for constructing symbol and file
names.  However, now that it's just a global Go string and the string
data is dynamically allocated anyway, it doesn't serve any purpose
except to force extra write barriers everytime it's assigned to.

Also, introduce Lookupf(fmt, args...) as shorthand for
Lookup(fmt.Sprintf(fmt, args...)), which was a very common pattern for
using namebuf.

Passes "go build -toolexec 'toolstash -cmp' -a std".

Notably, this CL shrinks 6g's text section by ~15kB:

$ size toolstash/6g tool/linux_amd64/6g
   text    data     bss     dec     hex filename
4600805  605968  342988 5549761  54aec1 toolstash/6g
4585547  605968  342956 5534471  547307 tool/linux_amd64/6g

Change-Id: I98abb44fc7f43a2e2e48425cc9f215cd0be37442
Reviewed-on: https://go-review.googlesource.com/7080
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/7g: fix build breakage
Dave Cheney [Fri, 13 Mar 2015 23:03:55 +0000 (10:03 +1100)]
cmd/7g: fix build breakage

Update cmd/7g to match the other compilers. Fixes build break in rev 6582d1cf8.

Change-Id: I449613cf348254e9de6cc7a6b7737e43ea7d10fe
Reviewed-on: https://go-review.googlesource.com/7580
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocmd/internal/gc, etc: remove canemitecode of Naddr
Michael Hudson-Doyle [Sat, 7 Mar 2015 03:16:48 +0000 (16:16 +1300)]
cmd/internal/gc, etc: remove canemitecode of Naddr

The argument is never consulted apart from passing it to recursive
calls.  So delete it.

Change-Id: Ia15eefb6385b3c99ea4def88f564f4e5a94c68ab
Reviewed-on: https://go-review.googlesource.com/7032
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agotest: add test that gccgo failed to compile
Ian Lance Taylor [Fri, 13 Mar 2015 20:18:54 +0000 (13:18 -0700)]
test: add test that gccgo failed to compile

Change-Id: I9ea6d4d8a9c1c63de36f2f3871dd5ac9201c0aac
Reviewed-on: https://go-review.googlesource.com/7523
Reviewed-by: Minux Ma <minux@golang.org>
10 years agomath/big: fix minor documentation issue
Robert Griesemer [Fri, 13 Mar 2015 21:20:07 +0000 (14:20 -0700)]
math/big: fix minor documentation issue

Change-Id: Ib42f75c03573cec16801b79a6eb9b1b542028f4f
Reviewed-on: https://go-review.googlesource.com/7524
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: fix silly bug in Int64 accessor
Robert Griesemer [Fri, 13 Mar 2015 19:59:56 +0000 (12:59 -0700)]
math/big: fix silly bug in Int64 accessor

Change-Id: If335d45ea1ab6c8aeeb47515f97680e2c1d651f3
Reviewed-on: https://go-review.googlesource.com/7522
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoimage/jpeg: reject bad Tq values in SOF data.
Nigel Tao [Fri, 13 Mar 2015 03:38:25 +0000 (14:38 +1100)]
image/jpeg: reject bad Tq values in SOF data.

Fixes #10154

Change-Id: Ibb8ea9bcf512e7639c57a6f17afbe4495fa329cd
Reviewed-on: https://go-review.googlesource.com/7494
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: remove reference to openbsd kern.rthreads sysctl
Joel Sing [Thu, 12 Mar 2015 14:52:12 +0000 (01:52 +1100)]
runtime: remove reference to openbsd kern.rthreads sysctl

The kern.rthreads sysctl has not existed for a long time - there is no way to
disable rthreads and __tfork no longer returns ENOTSUP.

Change-Id: Ia50ff01ac86ea83358e72b8f45f7818aaec1e4b1
Reviewed-on: https://go-review.googlesource.com/7490
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/5l: make 5l work on openbsd
Joel Sing [Tue, 23 Dec 2014 15:08:58 +0000 (02:08 +1100)]
cmd/5l: make 5l work on openbsd

Change-Id: If58ea50fbf321ae943d0890a40e0552e7bc19709
Reviewed-on: https://go-review.googlesource.com/2080
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agodoc/go1.5.txt: mention zip.WriterAt
Andrew Gerrand [Thu, 12 Mar 2015 21:34:00 +0000 (08:34 +1100)]
doc/go1.5.txt: mention zip.WriterAt

Change-Id: I9f5ca101e0d2fe71cb1ca810cfeeb82c12f5f8e7
Reviewed-on: https://go-review.googlesource.com/7491
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoarchive/zip: remove WriterOptions and replace with SetOffset method
Andrew Gerrand [Thu, 12 Mar 2015 00:54:11 +0000 (11:54 +1100)]
archive/zip: remove WriterOptions and replace with SetOffset method

Change-Id: I0a8b972c33e80c750ff1d63717177a5a3294a112
Reviewed-on: https://go-review.googlesource.com/7445
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Geert-Johan Riemer <gjr19912@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agomath/big: handle NaNs in Float.Cmp
Robert Griesemer [Thu, 5 Mar 2015 21:10:33 +0000 (13:10 -0800)]
math/big: handle NaNs in Float.Cmp

Also:
- Implemented NewFloat convenience factory function (analogous to
  NewInt and NewRat).
- Implemented convenience accessors for Accuracy values returned
  from Float.Cmp.
- Added test and example.

Change-Id: I985bb4f86e6def222d4b2505417250d29a39c60e
Reviewed-on: https://go-review.googlesource.com/6970
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoflag: use four spaces before tab, not three
Russ Cox [Thu, 12 Mar 2015 18:35:37 +0000 (14:35 -0400)]
flag: use four spaces before tab, not three

Four spaces is what works well for both 4- and 8-space tab stops.

Screen with fixed-width font and 4-space tab stops:
http://imgur.com/lps5Lbb

Change-Id: I7d2b813d674c3e0a68f79d63bc5d5ec5bd4f87bb
Reviewed-on: https://go-review.googlesource.com/7503
Reviewed-by: Rob Pike <r@golang.org>
10 years agomath/big: added (internal) Float.form field for easier case distinctions
Robert Griesemer [Thu, 5 Mar 2015 01:00:41 +0000 (17:00 -0800)]
math/big: added (internal) Float.form field for easier case distinctions

This is a fairly significant _internal_ representation change. Instead
of encoding 0, finite, infinite, and NaN values with special mantissa
and exponent values, a new (1 byte) 'form' field is used (without making
the Float struct bigger). The form field permits simpler and faster
case distinctions. As a side benefit, for zero and non-finite floats,
fewer fields need to be set. Also, the exponent range is not the full
int32 range (in the old format, infExp and nanExp were used to represent
Inf and NaN values and tests for those values sometimes didn't test
for the empty mantissa, so the range was reduced by 2 values).

The correspondence between the old and new fields is as follows.
Old representation:

x                 neg      mant         exp
---------------------------------------------------------------
+/-0              sign     empty        0
0 < |x| < +Inf    sign     mantissa     exponent
+/-Inf            sign     empty        infExp
NaN               false    empty        nanExp

New representation (- stands for ignored fields):

x                 neg      mant         exp         form
---------------------------------------------------------------
+/-0              sign     -            -           zero
0 < |x| < +Inf    sign     mantissa     exponent    finite
+/-Inf            sign     -            -           inf
NaN               -        -            -           nan

Client should not be affected by this change.

Change-Id: I7e355894d602ceb23f9ec01da755fe6e0386b101
Reviewed-on: https://go-review.googlesource.com/6870
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: make validate a method of Float (cleanup)
Robert Griesemer [Wed, 4 Mar 2015 23:02:07 +0000 (15:02 -0800)]
math/big: make validate a method of Float (cleanup)

Change-Id: If38f45acffd352ed95f32f3a36edd91a1fb33d0c
Reviewed-on: https://go-review.googlesource.com/6850
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agomath/big: introduce Bits abstraction instead of using "untyped" []int bit lists
Robert Griesemer [Wed, 4 Mar 2015 22:53:41 +0000 (14:53 -0800)]
math/big: introduce Bits abstraction instead of using "untyped" []int bit lists

Change-Id: I6caa6bdcf6643ce3015244397a752bd133f3d00c
Reviewed-on: https://go-review.googlesource.com/6840
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agodoc/go1.5.txt: new format for flag.PrintDefaults
Rob Pike [Thu, 12 Mar 2015 18:20:55 +0000 (11:20 -0700)]
doc/go1.5.txt: new format for flag.PrintDefaults

Change-Id: Ic78deaf91b437016b0a064c1f9ef49c9c29f4c32
Reviewed-on: https://go-review.googlesource.com/7510
Reviewed-by: Rob Pike <r@golang.org>
10 years agoflag: nicer usage messages
Rob Pike [Tue, 10 Mar 2015 22:08:55 +0000 (15:08 -0700)]
flag: nicer usage messages

Make PrintDefaults print an easier-to-read format, and allow the user
to control it a bit by putting a hint into the usage string.

Here is the new doc comment for PrintDefaults, which does the work:

    PrintDefaults prints, to standard error unless configured otherwise, a
    usage message showing the default settings of all defined command-line
    flags. For an integer valued flag x, the default output has the form

-x int
usage-message-for-x (default 7)

    The usage message will appear on a separate line except for single-
    letter boolean flags. Boolean flags omit the type, since they can be
    used without an actual value, and the parenthetical default is omitted
    if the default is the zero value for the type. The type, here int, can
    be replaced by a string of the user's choosing by placing in the usage
    string for the flag a back-quoted name; the first such item in the
    message is taken to be a parameter name to show in the message and the
    back quotes are stripped from the message when displayed. For instance,
    given

flag.String("I", "", "search `directory` for include files")

    the output will be

-I directory
search directory for include files.

Given

A = flag.Bool("A", false, "for bootstrapping, allow 'any' type")
B = flag.Bool("Alongflagname", false, "disable bounds checking")
C = flag.Bool("C", true, "a boolean defaulting to true")
D = flag.String("D", "", "set relative `path` for local imports")
F = flag.Float64("F", 2.7, "a non-zero float")
G = flag.Float64("G", 0, "a float that defaults to zero")
N = flag.Int("N", 27, "a non-zero int")
Z = flag.Int("Z", 0, "an int that defaults to zero")
T = flag.Duration("deltaT", 0, "a duration")

the old output was

  -A=false: for bootstrapping, allow 'any' type
  -Alongflagname=false: disable bounds checking
  -C=true: a boolean defaulting to true
  -D="": set relative `path` for local imports
  -F=2.7: a non-zero float
  -G=0: a float that defaults to zero
  -N=27: a non-zero int
  -Z=0: an int that defaults to zero
  -deltaT=0: a duration

and the new output is

  -A for bootstrapping, allow 'any' type
  -Alongflagname
disable bounds checking
  -C a boolean defaulting to true (default true)
  -D path
    set relative path for local imports
  -F float
    a non-zero float (default 2.7)
  -G float
    a float that defaults to zero
  -N int
    a non-zero int (default 27)
  -Z int
    an int that defaults to zero
  -deltaT duration
    a duration

Change-Id: I54ab3cd5610d551422b004d95ab78305e06a395d
Reviewed-on: https://go-review.googlesource.com/7330
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/asm: add MRC and MCR to end-to-end test for arm
Rob Pike [Wed, 11 Mar 2015 18:31:49 +0000 (11:31 -0700)]
cmd/asm: add MRC and MCR to end-to-end test for arm

The old, per-architecture operand printers didn't lock down the
format of the constant in the MRC and MCR instructions (a value
that could be presented more helpfully - maybe how the
input looks? - but that is an issue for another day). But there is
a portable standard printer now so we can enable tests for these
instructions.

Change-Id: I437a3b112ce63f4d6e1fe3450fc21d8c3372602f
Reviewed-on: https://go-review.googlesource.com/7420
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agodoc/go1.5: mention the ${SRCDIR} in cgo line change
Shenghou Ma [Thu, 12 Mar 2015 17:24:24 +0000 (13:24 -0400)]
doc/go1.5: mention the ${SRCDIR} in cgo line change

Change-Id: I4bc08a7085b45be3d2755a1986cf5b8c82fa165d
Reviewed-on: https://go-review.googlesource.com/7500
Reviewed-by: Minux Ma <minux@golang.org>
10 years agodoc/effective_go.html: add missing newline
Michael Vetter [Thu, 12 Mar 2015 14:49:49 +0000 (15:49 +0100)]
doc/effective_go.html: add missing newline

When printing the type of the function there was no newline printed in
case of unexpected type.

Change-Id: I5946413f0864f712a1b955f488b436793018e0e0
Reviewed-on: https://go-review.googlesource.com/7480
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/asm/internal/asm: report arch if assembly fails
Michael Hudson-Doyle [Thu, 12 Mar 2015 09:13:21 +0000 (22:13 +1300)]
cmd/asm/internal/asm: report arch if assembly fails

Just a trivial thing I noticed in passing.

Change-Id: I875069ceffd623f9e430d07feb5042ab9e69917e
Reviewed-on: https://go-review.googlesource.com/7472
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj/x86: implement -shared computation of TLS base
Michael Hudson-Doyle [Mon, 9 Mar 2015 00:21:51 +0000 (13:21 +1300)]
cmd/internal/obj/x86: implement -shared computation of TLS base

Somehow, terribly embarrassingly, I lost part of the "re-enable
-shared on amd64" patch when rebasing before it got submitted.
This restores it and also fixes the addend to be the necessary -4.

Now updated so that Git will not put the new case into the wrong
switch.

Change-Id: I1d628232771a6d6ce6d085adf379f94a377822c5
Reviewed-on: https://go-review.googlesource.com/7126
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet/http/pprof: Use relative links to profiles in index html
Matt Joiner [Wed, 11 Mar 2015 06:52:57 +0000 (17:52 +1100)]
net/http/pprof: Use relative links to profiles in index html

This allows /debug/pprof/ and descendents to be used through
http.StripPrefix and other path rewriting handlers.

Change-Id: I53673876c107bbfaf430123ead78e6524b42ac21
Reviewed-on: https://go-review.googlesource.com/7351
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoarchive/zip: add NewWriterWithOptions
Geert-Johan Riemer [Mon, 19 Jan 2015 13:39:33 +0000 (14:39 +0100)]
archive/zip: add NewWriterWithOptions

When appending zip data to existing data such as a binary file the
zip headers must use the correct offset. NewWriterWithOptions
allows creating a Writer that uses the provided offset in the zip
headers.

Fixes #8669

Change-Id: I6ec64f1e816cc57b6fc8bb9e8a0918e586fc56b0
Reviewed-on: https://go-review.googlesource.com/2978
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoruntime: don't return a slice with nil ptr but non-zero len from growslice
Shenghou Ma [Wed, 11 Mar 2015 16:07:50 +0000 (12:07 -0400)]
runtime: don't return a slice with nil ptr but non-zero len from growslice

Fixes #10135.

Change-Id: Ic4c5ab15bcb7b9c3fcc685a788d3b59c60c26e1e
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/9g: use REGZERO instead of REG_R0 if we want the zero register
Shenghou Ma [Wed, 11 Mar 2015 17:05:24 +0000 (13:05 -0400)]
cmd/9g: use REGZERO instead of REG_R0 if we want the zero register

This will make the intention clearer.
This is migrated from pre-c2go CL 4930.

Change-Id: I9103126a05323daedd729a43b94b2be8cd7408c9
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7410
Reviewed-by: Austin Clements <austin@google.com>
10 years agodebug/dwarf: factor parsing of unit lengths
Austin Clements [Thu, 5 Mar 2015 20:07:00 +0000 (15:07 -0500)]
debug/dwarf: factor parsing of unit lengths

Many headers in DWARF sections have a "unit length" that can be either
4 bytes or 12 bytes and indicates both the length of the unit and
whether the unit is in 32-bit or 64-bit format.

Currently, we implement unit length parsing in four different places.
Add a "unitLength" method to buf that parses a unit length and use it
in these four places.

Change-Id: I7950b91caaa92aa5e19aa63debc8ae46178ecc4d
Reviewed-on: https://go-review.googlesource.com/7281
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/ld: fix package data parsing
Matthew Dempsky [Fri, 6 Mar 2015 01:00:18 +0000 (17:00 -0800)]
cmd/internal/ld: fix package data parsing

The conversion of this logic from C introduced a few subtle behavior
changes.  E.g., assigning "name := data[p0:]" and then "name =
name[:p1-p0]" actually caused name to span the vast majority of the
package data, as at the time of the second statement p0 points just
after the package name and p1 points to the end of the package data.

Similarly, the logic for advancing past the newline at the end of the
package line changed slightly: for a "package foo safe" line, the new
code would only advance up to the newline, but not past.  (Albeit, in
practice this doesn't matter: newlines in package data are harmless.)

Lastly, "data[p0]" was incorrectly written as "data[0]" a few times.

Change-Id: I49017e16ba33a627f773532b418cbf85a84f2b4b
Reviewed-on: https://go-review.googlesource.com/7000
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agopath/filepath: clarify the package doc about '/' in returned results.
Hyang-Ah (Hana) Kim [Tue, 10 Mar 2015 16:31:33 +0000 (12:31 -0400)]
path/filepath: clarify the package doc about '/' in returned results.

The slash is replaced with os.PathSeparator before returning.
Split, SplitList are the exceptions; comments for them mention this.

Fixes golang/go#10122.

Change-Id: I66dbee8d09f378582e046be8df309a3930151820
Reviewed-on: https://go-review.googlesource.com/7310
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime,reflect,cmd/internal/gc: Fix comments referring to .c/.h files
Keith Randall [Wed, 11 Mar 2015 19:58:47 +0000 (12:58 -0700)]
runtime,reflect,cmd/internal/gc: Fix comments referring to .c/.h files

Everything has moved to Go, but comments still refer to .c/.h files.
Fix all of those up, at least for these three directories.

Fixes #10138

Change-Id: Ie5efe89b247841e0b3f82aac5256b2c606ef67dc
Reviewed-on: https://go-review.googlesource.com/7431
Reviewed-by: Russ Cox <rsc@golang.org>