cmd/ld: move symtab, ELF generation to portable code

More cleanup in preparation for fixing issue 4069.

This CL replaces the three nearly identical copies of the
asmb ELF code with a single asmbelf function in elf.c.

In addition to the ELF code movement, remove the elfstr
array in favor of a simpler lookup, and identify sections by
name throughout instead of computing fragile indices.

The CL also replaces the three nearly identical copies of the
genasmsym code with a single genasmsym function in lib.c.

The ARM linker still compiles and generates binaries,
but I haven't tested the binaries. They may not work.

R=ken2
CC=golang-dev
https://codereview.appspot.com/7062047
cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing

This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.

Command lines that used to work, like
        8c -FVw
        6c -Dfoo
        5g -I/foo/bar
now need to be split into separate arguments:
        8c -F -V -w
        6c -D foo
        5g -I /foo/bar
The new spacing will work with both old and new tools.

The new parser also allows = for arguments, as in
        6c -D=foo
        5g -I=/foo/bar
but that syntax will not work with the old tools.

In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.

The recently added gc flag -= has been renamed -complete.

R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://codereview.appspot.com/7035043
doc: Updated links for sub-repository documentation.

Use godoc.org instead of gopkgdoc.appspot.com.

R=golang-dev, minux.ma
CC=golang-dev
https://codereview.appspot.com/7036051

Committer: Andrew Gerrand <adg@golang.org>
go/types: less closure creations in gcimporter.

Closures are incredibly expensive on linux/arm due to
repetitive flush of instruction cache.

go test -short on ODROID-X:

Before:
ok      exp/gotype      17.091s
ok      go/types        2.225s

After:
ok      exp/gotype      7.193s
ok      go/types        1.143s

R=dave, minux.ma, rsc
CC=golang-dev, remy
https://codereview.appspot.com/7062045
A+C: Caleb Spare (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://codereview.appspot.com/7070046
encoding/json: documented that ,string applies only to string and numeric fields.

Fixes issue 4437.

R=golang-dev, adg
CC=golang-dev, rsc
https://codereview.appspot.com/7064045

Committer: Andrew Gerrand <adg@golang.org>
bytes: Examples recommending bytes.Compare(a, b) rel_op 0 to test a rel_op b.

R=golang-dev, minux.ma, rsc, adg
CC=golang-dev
https://codereview.appspot.com/7042045

Committer: Andrew Gerrand <adg@golang.org>
src: Use bytes.Equal instead of bytes.Compare where possible.

bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.

Change generated automatically using:
  gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
  gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'

R=golang-dev, dave, adg, rsc
CC=golang-dev
https://codereview.appspot.com/7038051

Committer: Andrew Gerrand <adg@golang.org>
bytes: fix docs: s/array/slice/.

R=rsc, mdempsky, dave
CC=golang-dev
https://codereview.appspot.com/7028051
cmd/gofmt, bufio, image: Consistency and error handling.

cmd/gofmt: Add error handling for ioutil.WriteFile.
bufio: Consistency, rename e to err.
image: Consistency, fix comment for asReader.

R=golang-dev, dave, minux.ma, adg
CC=golang-dev
https://codereview.appspot.com/7029056

Committer: Andrew Gerrand <adg@golang.org>
misc/dashboard/builder: set GOPATH before building subrepos

This proposal updates the dashboard builder to avoid relying on the (soon to be removed) support for using go get to download to $GOROOT. The result is

WORKSPACE=$(the value of the -buildRoot flag / $BUILDER_NAME + hg revision)
GOROOT=$WORKSPACE/go
GOPATH=$WORKSPACE

Required for CL 6941058.

R=minux.ma, adg
CC=golang-dev
https://codereview.appspot.com/7034049
spec: Use "non-negative" instead of "positive"

Replacing division-by-power-of-2 with right-shift is valid for
zero too.

R=gri
CC=golang-dev
https://codereview.appspot.com/7027049

Committer: Robert Griesemer <gri@golang.org>
os: fix Open for empty root directories on windows

Fixes issue 4601.

R=golang-dev, rsc, bradfitz, kardianos
CC=golang-dev
https://codereview.appspot.com/7033046
go/types: Set Signature.Recv for imported types

R=golang-dev, bradfitz, gri
CC=golang-dev
https://codereview.appspot.com/7065046

Committer: Robert Griesemer <gri@golang.org>
go/doc: trim only first space or newline from example output comment

Fixes issue 4487.

R=rsc
CC=golang-dev
https://codereview.appspot.com/7057048
bytes: Change Compare example to be consistent with sort.Search's.

R=rsc, adg
CC=golang-dev
https://codereview.appspot.com/7057049

Committer: Russ Cox <rsc@golang.org>
bytes: Fix missing godoc punctuation.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7067047

Committer: Russ Cox <rsc@golang.org>
      doc: two minor edits to contribute.html

- Missing parenthesis
- Fix bad phrasing

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7063048

Committer: Russ Cox <rsc@golang.org>
os: document that Exit does not run deferred calls

Fixes issue 4101.

R=dsymonds, rsc
CC=golang-dev
https://codereview.appspot.com/7065048
cmd/gc, cmd/ld: rename -b to -race

There's no b in race detector.
The new flag matches the one in the go command
(go test -race math).

R=golang-dev, dsymonds
CC=golang-dev
https://codereview.appspot.com/7072043