]> Cypherpunks repositories - gostls13.git/log
gostls13.git
4 years ago[dev.link] cmd/link: stream external relocations on ARM and on Windows
Cherry Zhang [Wed, 22 Jul 2020 16:56:49 +0000 (12:56 -0400)]
[dev.link] cmd/link: stream external relocations on ARM and on Windows

Do them in the same CL so ARM's archreloc doesn't need to support
both streaming and non-streaming.

TODO: we haven't switched to using mmap to emit external
relocations on Windows.

Change-Id: Ica2ee89c03fc74839efd6b9e26c80585fcdce45c
Reviewed-on: https://go-review.googlesource.com/c/go/+/244357
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: stream external relocations on S390X
Cherry Zhang [Wed, 22 Jul 2020 15:42:13 +0000 (11:42 -0400)]
[dev.link] cmd/link: stream external relocations on S390X

All the bits are there. Just need to enable it.

Change-Id: I12ee25317c6385838493dadc900fb57c3b49a416
Reviewed-on: https://go-review.googlesource.com/c/go/+/244277
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: stream external relocations on MIPS (32/64)
Cherry Zhang [Tue, 21 Jul 2020 23:14:18 +0000 (19:14 -0400)]
[dev.link] cmd/link: stream external relocations on MIPS (32/64)

Change-Id: I47fbeb3a49754395dceff51af371638fd43350ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/244097
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: avoid reading symbol Data in archreloc on ARM64
Cherry Zhang [Tue, 21 Jul 2020 21:59:48 +0000 (17:59 -0400)]
[dev.link] cmd/link: avoid reading symbol Data in archreloc on ARM64

The previous CL changed it to drop the Data when writing out a
symbol. Don't read the data.

Fix ARM64 build.

Change-Id: I121e9b0ebef123dbbc4ddffc02bf1a42788532f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/244038
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years ago[dev.link] cmd/link: remove OutData
Cherry Zhang [Tue, 21 Jul 2020 18:32:09 +0000 (14:32 -0400)]
[dev.link] cmd/link: remove OutData

OutData was used for a symbol to point to its data in the output
buffer, in order to apply relocations. Now we fold relocation
application to Asmb next to symbol data writing. We can just pass
the output data as a local variable.

Linking cmd/compile,

name         old time/op    new time/op    delta
Asmb_GC        19.0ms ±10%    16.6ms ± 9%  -12.50%  (p=0.032 n=5+5)

name         old alloc/op   new alloc/op   delta
Asmb_GC        3.78MB ± 0%    0.14MB ± 1%  -96.41%  (p=0.008 n=5+5)

name         old live-B     new live-B     delta
Asmb_GC         27.5M ± 0%     23.9M ± 0%  -13.24%  (p=0.008 n=5+5)

Change-Id: Id870a10dce2a0a7447a05029c6d0ab39b47d0a12
Reviewed-on: https://go-review.googlesource.com/c/go/+/244017
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: stream external relocations on ARM64 and on Darwin
Cherry Zhang [Fri, 17 Jul 2020 21:56:17 +0000 (17:56 -0400)]
[dev.link] cmd/link: stream external relocations on ARM64 and on Darwin

Support streaming external relocations on ARM64. Support
architecture-specific relocations.

Also support streaming external relocations on Darwin. Do it in
the same CL so ARM64's archreloc doesn't need to support both
streaming and non-streaming.

Change-Id: Ia7fee9957892f98c065022c69a51f47402f4d6e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/243644
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: stream external relocations on 386 ELF
Cherry Zhang [Fri, 17 Jul 2020 21:05:22 +0000 (17:05 -0400)]
[dev.link] cmd/link: stream external relocations on 386 ELF

Change-Id: I17ff3ac82c8ac313f3a3c8e8129800ec9c05b991
Reviewed-on: https://go-review.googlesource.com/c/go/+/243643
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: fix hash collision check
Cherry Zhang [Mon, 20 Jul 2020 22:07:00 +0000 (18:07 -0400)]
[dev.link] cmd/link: fix hash collision check

For content-addressable symbols, we build its content hash based
on the symbol data and relocations. When the compiler builds the
symbol data, it may not always include the trailing zeros, e.g.
the data of [10]int64{1,2,3} is only the first 24 bytes.
Therefore, we may end up with symbols with the same contents
(thus same hash) but different sizes. This is not actually a hash
collision. In this case, we can deduplicate them and keep the one
with the larger size.

Change-Id: If6834542d7914cc00f917d7db151955e5aee6f30
Reviewed-on: https://go-review.googlesource.com/c/go/+/243718
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/internal/obj: handle content-addressable symbols with relocations
Cherry Zhang [Thu, 16 Jul 2020 03:14:50 +0000 (23:14 -0400)]
[dev.link] cmd/internal/obj: handle content-addressable symbols with relocations

For content-addressable symbols with relocations, we build a
content hash based on its content and relocations. Depending on
the category of the referenced symbol, we choose different hash
algorithms such that the hash is globally consistent.

For now, we only support content-addressable symbols with
relocations when the current package's import path is known, so
that the symbol names are fully expanded. Otherwise, if the
referenced symbol is a named symbol whose name is not fully
expanded, the hash won't be globally consistent, and can cause
erroneous collisions. This is fine for now, as the deduplication
is just an optimization, not a requirement for correctness (until
we get to type descriptors).

Change-Id: I639e4e03dd749b5d71f0a55c2525926575b1ac30
Reviewed-on: https://go-review.googlesource.com/c/go/+/243142
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/compile: make read-only static temps content-addressable
Cherry Zhang [Thu, 16 Jul 2020 00:01:32 +0000 (20:01 -0400)]
[dev.link] cmd/compile: make read-only static temps content-addressable

For now, we only do this for symbols without relocations.

Mark static temps "local", as they are not referenced across DSO
boundaries. And deduplicating a local symbol and a non-local
symbol can be problematic.

Change-Id: I0a3dc4138aaeea7fd4f326998f32ab6305da8e4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/243141
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] all: merge branch 'master' into dev.link
Cherry Zhang [Fri, 17 Jul 2020 18:56:36 +0000 (14:56 -0400)]
[dev.link] all: merge branch 'master' into dev.link

Change-Id: I6545cb431e9e3efa02defca52af7eae502adb157

4 years agogo/printer: remove exported StdFormat flag
Dmitri Shuralyov [Wed, 1 Jul 2020 16:49:43 +0000 (12:49 -0400)]
go/printer: remove exported StdFormat flag

The StdFormat flag was added as part of CL 231461, where the primary aim
was to fix the bug #37476. It's expected that the existing printer modes
only adjust spacing but do not change any of the code text itself. A new
printing flag served as a way for cmd/gofmt and go/format to delegate
a part of formatting work to the printer—where it's more more convenient
and efficient to perform—while maintaining current low-level printing
behavior of go/printer unmodified.

We already have cmd/gofmt and the go/format API that implement standard
formatting of Go source code, so there isn't a need to expose StdFormat
flag to the world, as it can only cause confusion.

Consider that to format source in canonical gofmt style completely it
may require tasks A, B, C to be done. In one version of Go, the printer
may do both A and B, while cmd/gofmt and go/format will do the remaining
task C. In another version, the printer may take on doing just A, while
cmd/gofmt and go/format will perform B and C. This makes it hard to add
a gofmt-like mode to the printer without compromising on above fluidity.

This change prefers to shift back some complexity to the implementation
of the standard library, allowing us to avoid creating the new exported
printing flag just for the internal needs of gofmt and go/format today.

We may still want to re-think the API and consider if something better
should be added, but unfortunately there isn't time for Go 1.15. We are
not adding new APIs now, so we can defer this decision until Go 1.16 or
later, when there is more time.

For #37476.
For #37453.
For #39489.
For #37419.

Change-Id: I0bb07156dca852b043487099dcf05c5350b29e20
Reviewed-on: https://go-review.googlesource.com/c/go/+/240683
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
4 years agocompress/flate: fix another deflate Reset inconsistency
Russ Cox [Thu, 16 Jul 2020 20:56:53 +0000 (16:56 -0400)]
compress/flate: fix another deflate Reset inconsistency

While investigating #34121, fixed by CL 193605,
I discovered another case where Reset was not quite
resetting enough.

This specific case is not a problem in Reset itself but
rather that the Huffman bit writer in one code path
is using uninitialized memory left over from a previous
block, making the compression not choose the optimal
compression method.

Fixes #34121.

Change-Id: I29245b28214d924e382f91e2c56b4b8a9b7da13d
Reviewed-on: https://go-review.googlesource.com/c/go/+/243140
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
4 years agocompress/flate: fix deflate Reset consistency
Klaus Post [Thu, 7 May 2020 12:50:00 +0000 (12:50 +0000)]
compress/flate: fix deflate Reset consistency

Modify the overflow detection logic to shuffle the contents
of the table to a lower offset to avoid leaking the effects
of a previous use of compress.Writer past Reset calls.

Fixes #34121

Change-Id: I9963eadfa5482881e7b7adbad4c2cae146b669ab
GitHub-Last-Rev: 8b35798cdd4d5a901d6422647b12984d7e500ba3
GitHub-Pull-Request: golang/go#34128
Reviewed-on: https://go-review.googlesource.com/c/go/+/193605
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years ago[dev.link] cmd/link: stream out external relocations on AMD64 ELF
Cherry Zhang [Tue, 14 Jul 2020 18:46:59 +0000 (14:46 -0400)]
[dev.link] cmd/link: stream out external relocations on AMD64 ELF

Currently, when external linking, in relocsym (in asmb pass), we
convert Go relocations to an in-memory representation of external
relocations, and then in asmb2 pass we write them out to the
output file. This is not memory efficient.

This CL makes it not do the conversion but directly stream out
the external relocations based on Go relocations. Currently only
do this on AMD64 ELF systems.

This reduces memory usage, but makes the asmb2 pass a little
slower.

Linking cmd/compile with external linking:

name             old time/op    new time/op    delta
Asmb_GC            83.8ms ± 7%    70.4ms ± 4%  -16.03%  (p=0.008 n=5+5)
Asmb2_GC           95.6ms ± 4%   118.2ms ± 5%  +23.65%  (p=0.008 n=5+5)
TotalTime_GC        1.59s ± 2%     1.62s ± 1%     ~     (p=0.151 n=5+5)

name             old alloc/op   new alloc/op   delta
Asmb_GC            26.0MB ± 0%     4.1MB ± 0%  -84.15%  (p=0.008 n=5+5)
Asmb2_GC           8.19MB ± 0%    8.18MB ± 0%     ~     (p=0.222 n=5+5)

name             old live-B     new live-B     delta
Asmb_GC             49.2M ± 0%     27.4M ± 0%  -44.38%  (p=0.008 n=5+5)
Asmb2_GC            51.5M ± 0%     29.7M ± 0%  -42.33%  (p=0.008 n=5+5)

TODO: figure out what is slow. Possible improvements:
- Remove redundant work in relocsym.
- Maybe there is a better representation for external relocations
  now.
- Fine-grained parallelism in emitting external relocations.
- The old elfrelocsect only iterates over external relocations,
  now we iterate over all relocations. Is it too many?

Change-Id: Ib0a8ee8c88d65864c62b89a8d634614f7f2c813e
Reviewed-on: https://go-review.googlesource.com/c/go/+/242603
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/internal/goobj2, cmd/link: use short hash function for short symbols
Cherry Zhang [Mon, 13 Jul 2020 19:05:09 +0000 (15:05 -0400)]
[dev.link] cmd/internal/goobj2, cmd/link: use short hash function for short symbols

For symbols of size 8 bytes or below, we can map them to 64-bit
hash values using the identity function. There is no need to use
longer and more expensive hash functions.

For them, we introduce another pseudo-package, PkgIdxHashed64. It
is like PkgIdxHashed except that the hash function is different.

Note that the hash value is not affected with trailing zeros,
e.g. "A" and "A\0\0\0" have the same hash value. This allows
deduplicating a few more symbols. When deduplicating them, we
need to keep the longer one.

Change-Id: Iad0c2e9e569b6a59ca6a121fb8c8f0c018c6da03
Reviewed-on: https://go-review.googlesource.com/c/go/+/242362
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/internal/obj: make integer/float constant symbols content-addressable
Cherry Zhang [Sun, 12 Jul 2020 21:57:11 +0000 (17:57 -0400)]
[dev.link] cmd/internal/obj: make integer/float constant symbols content-addressable

Fill in the data at compile time, and get rid of the preprocess
function in the linker.

We need to be careful with symbol alignment: data symbols are
generally naturally aligned, except for string symbols which are
not aligned. When deduplicating two symbols with same content but
different alignments, we need to keep the biggest alignment.

Change-Id: I4bd96adfdc5f704b5bf3a0e723457c9bfe16a684
Reviewed-on: https://go-review.googlesource.com/c/go/+/242081
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/compile: make GC map symbols content-addressable
Cherry Zhang [Sun, 12 Jul 2020 21:15:35 +0000 (17:15 -0400)]
[dev.link] cmd/compile: make GC map symbols content-addressable

Change-Id: I20e5b580b3e0505473816fe7f277a74e13d33e64
Reviewed-on: https://go-review.googlesource.com/c/go/+/242080
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/internal/goobj2, cmd/link: add content addressable symbols
Cherry Zhang [Fri, 10 Jul 2020 22:49:01 +0000 (18:49 -0400)]
[dev.link] cmd/internal/goobj2, cmd/link: add content addressable symbols

This CL introduces content-addressable symbols (a.k.a. hashed
symbols) to object files. Content-addressable symbols are
identified and referenced by their content hashes, instead of by
names.

In the object file, a new pseudo-package index PkgIdxHashed is
introduced, for content-addressable symbols, and a new block is
added to store their hashes. The hashes are used by the linker to
identify and deduplicate the symbols.

For now, we only support content-addressable symbols that are
always locally defined (i.e. no cross-package references).

As a proof of concept, make string constant symbols content-
addressable.

Change-Id: Iaf53efd74c0ffb54fa95f784628cc84e95844536
Reviewed-on: https://go-review.googlesource.com/c/go/+/242079
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years agocmd/link: skip TestOldLink if the old linker does not exist
Cherry Zhang [Tue, 14 Jul 2020 22:55:29 +0000 (18:55 -0400)]
cmd/link: skip TestOldLink if the old linker does not exist

We don't ship the old linker in binary releases. Skip the test if
we cannot find the old linker.

Fixes #39509.

Change-Id: I1af5552bc56aff5314a384bcb5f3717b725d68e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/242604
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agonet/http: synchronize "100 Continue" write and Handler writes
Russ Cox [Mon, 13 Jul 2020 17:27:22 +0000 (13:27 -0400)]
net/http: synchronize "100 Continue" write and Handler writes

The expectContinueReader writes to the connection on the first
Request.Body read. Since a Handler might be doing a read in parallel or
before a write, expectContinueReader needs to synchronize with the
ResponseWriter, and abort if a response already went out.

The tests will land in a separate CL.

Fixes #34902
Fixes CVE-2020-15586

Change-Id: Icdd8dd539f45e8863762bd378194bb4741e875fc
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/793350
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/242598
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocrypto/x509: respect VerifyOptions.KeyUsages on Windows
Filippo Valsorda [Fri, 19 Jun 2020 02:45:52 +0000 (22:45 -0400)]
crypto/x509: respect VerifyOptions.KeyUsages on Windows

When using the platform verifier on Windows (because Roots is nil) we
were always enforcing server auth EKUs if DNSName was set, and none
otherwise. If an application was setting KeyUsages, they were not being
respected.

Started correctly surfacing IncompatibleUsage errors from the system
verifier, as those are the ones applications will see if they are
affected by this change.

Also refactored verify_test.go to make it easier to add tests for this,
and replaced the EKULeaf chain with a new one that doesn't have a SHA-1
signature.

Thanks to Niall Newman for reporting this.

Fixes #39360
Fixes CVE-2020-14039

Change-Id: If5c00d615f2944f7d57007891aae1307f9571c32
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/774414
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/242597
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agohtml/template: add tests from text/template
Russ Cox [Mon, 6 Jul 2020 16:27:01 +0000 (12:27 -0400)]
html/template: add tests from text/template

Copy and adapt tests from text/template, to exercise more of html/template's copy.

Various differences in behavior are flagged with NOTE comments or t.Skip
and documented in #40075. Many of them are probably bugs.
One clarifying test case added to both text/template and html/template.

No changes to the package itself.

Change-Id: Ifefad83d647db846040d24c2741a0244b00ade82
Reviewed-on: https://go-review.googlesource.com/c/go/+/241084
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
4 years ago[dev.link] cmd/link: dump symbol info on crash under -v
Cherry Zhang [Fri, 10 Jul 2020 22:53:12 +0000 (18:53 -0400)]
[dev.link] cmd/link: dump symbol info on crash under -v

If the linker panics, it usually helps dumping all symbols'
information for debugging. Do it under -v.

Change-Id: I66f9e32a0133e763a631f17a218dcdc805c5df2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/242078
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years agocmd/go: include GOMODCACHE in 'go help environment'
Jay Conrod [Tue, 7 Jul 2020 18:17:30 +0000 (14:17 -0400)]
cmd/go: include GOMODCACHE in 'go help environment'

Updates #34527
Fixes #40089

Change-Id: Ie9c8573536e5c31e874d755f4d888ffc805b796f
Reviewed-on: https://go-review.googlesource.com/c/go/+/241275
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years ago[dev.link] cmd/link: remove ARM64 special handling of GC data in shared libraries
Cherry Zhang [Fri, 10 Jul 2020 20:09:37 +0000 (16:09 -0400)]
[dev.link] cmd/link: remove ARM64 special handling of GC data in shared libraries

The special case is no longer needed, didn't actually work, and
we no longer even save this map anywhere (see CL 240621 for more
information).

Change-Id: I19bcf32cace22decf50fd6414d4519cc51cbb0be
Reviewed-on: https://go-review.googlesource.com/c/go/+/241982
Reviewed-by: Austin Clements <austin@google.com>
4 years ago[dev.link] all: merge branch 'master' into dev.link
Cherry Zhang [Fri, 10 Jul 2020 18:54:13 +0000 (14:54 -0400)]
[dev.link] all: merge branch 'master' into dev.link

Change-Id: I644cfc9dfd6e024a0d62bbd226db8639e4a87dc7

4 years agonet: hangup TCP connection after Dial timeout in Plan 9
Fazlul Shahriar [Wed, 8 Jul 2020 20:57:10 +0000 (16:57 -0400)]
net: hangup TCP connection after Dial timeout in Plan 9

After Dial timeout, force close the TCP connection by writing "hangup"
to the control file. This unblocks the "connect" command if the
connection is taking too long to establish, and frees up the control
file FD.

Fixes #40118

Change-Id: I1cef8539cd9fe0793e32b49c9d0ef636b4b26e1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/241638
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years agodoc/go1.15: fix TODO about -buildmode=pie
Austin Clements [Thu, 9 Jul 2020 18:16:44 +0000 (14:16 -0400)]
doc/go1.15: fix TODO about -buildmode=pie

Updates #37419.

Change-Id: If77067eb348de47a4b101325de8a43502383b6d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/241740
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agonet/textproto: correct documentation of empty line handling
Norman B. Lancaster [Wed, 10 Jul 2019 22:31:00 +0000 (17:31 -0500)]
net/textproto: correct documentation of empty line handling

Fixes #32493

Change-Id: I9c93791c4cc5c0c14556802733066407de3181ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/185542
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agodoc/go1.15: add line for testing streaming change
Jean de Klerk [Thu, 9 Jul 2020 15:55:49 +0000 (09:55 -0600)]
doc/go1.15: add line for testing streaming change

Updates #37419.
Updates #38458.
Updates #24929.

Change-Id: I793bb20fa9db4432fc3a5b69956b7108e4695081
Reviewed-on: https://go-review.googlesource.com/c/go/+/241660
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years ago[dev.link] cmd/compile: make compiler-generated ppc64 TOC symbols static
Than McIntosh [Wed, 8 Jul 2020 22:32:36 +0000 (18:32 -0400)]
[dev.link] cmd/compile: make compiler-generated ppc64 TOC symbols static

Set the AttrStatic flag on compiler-emitted TOC symbols for ppc64; these
symbols don't need to go into the final symbol table in Go binaries.
This fixes a buglet introduced by CL 240539 that was causing failures
on the aix builder.

Change-Id: If8b63bcf6d2791f1ec5a0c371d2d11e806202fd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/241637
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocrypto/x509/internal/macos: rename package to lowercase
Filippo Valsorda [Tue, 7 Jul 2020 18:04:18 +0000 (14:04 -0400)]
crypto/x509/internal/macos: rename package to lowercase

Also add a test to lock in this policy.

Fixes #40065

Change-Id: Iedc4586f2f5598046d84132a8f3bba8f2e93ddc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/241274
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoruntime: mark OpenBSD raise function nosplit
Ian Lance Taylor [Mon, 6 Jul 2020 21:23:26 +0000 (14:23 -0700)]
runtime: mark OpenBSD raise function nosplit

It is called by the signal handler before switching to gsignal
(sigtrampgo -> sigfwdgo -> dieFromSignal -> raise)
which means that it must not split the stack.

All other instances of raise are already marked nosplit.

Fixes #40076

Change-Id: I4794491331af48c46d0d8ebc82d34c6483f0e6cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/241121
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoos: fix regression with handling of nil *File
Joe Tsai [Wed, 8 Jul 2020 05:18:17 +0000 (22:18 -0700)]
os: fix regression with handling of nil *File

Use of a nil *File as an argument should not result in a panic,
but result in the ErrInvalid error being returned.
Fix the copy_file_range implementation to preserve this semantic.

Fixes #40115

Change-Id: Iad5ac39664a3efb7964cf55685be636940a8db13
Reviewed-on: https://go-review.googlesource.com/c/go/+/241417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocrypto: fix PKCS space in docs
Katie Hockman [Wed, 8 Jul 2020 13:40:33 +0000 (09:40 -0400)]
crypto: fix PKCS space in docs

Change-Id: Iee53acb963a889410f8c6daaa9a7841f1b12c6fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/241497
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years ago[dev.link] cmd/link: skip symtab entries for selected file local symbols
Than McIntosh [Tue, 30 Jun 2020 14:22:13 +0000 (10:22 -0400)]
[dev.link] cmd/link: skip symtab entries for selected file local symbols

Don't emit symbol table entries for compiler-generated file-local
symbols (this category includes .stmp_* temporaries and *.stkobj
symbols). Note that user-written static symbols within assembler
sources will still be added to the symbol table. Apply the same test
when emitting DWARF for global variables.

Change-Id: I4db77a2750a0b575e051dfea895c4742cf6709a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/240539
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years ago[dev.link] cmd/compile: mark stmp and stkobj symbols as static
Than McIntosh [Tue, 30 Jun 2020 11:55:16 +0000 (07:55 -0400)]
[dev.link] cmd/compile: mark stmp and stkobj symbols as static

Mark compiler-generated ".stmp_%d" and "<fn>.stkobj" symbols as
AttrStatic, so as to tell the linker that they do not need to be
inserted into its name lookup tables.

Change-Id: I59ffd11659b2c54c2d0ad41275d05c3f919e3b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/240497
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agodoc/editors.html: update VS Code Go extension url
Hana (Hyang-Ah) Kim [Mon, 6 Jul 2020 17:30:56 +0000 (13:30 -0400)]
doc/editors.html: update VS Code Go extension url

Change-Id: I7aa73861de053db6b424f113733de9caba19145b
Reviewed-on: https://go-review.googlesource.com/c/go/+/241086
Reviewed-by: Andrew Bonventre <andybons@golang.org>
4 years agoA+C: add Kush Patel (corporate CLA for Hootsuite Inc)
Kush Patel [Tue, 7 Jul 2020 03:58:50 +0000 (03:58 +0000)]
A+C: add Kush Patel (corporate CLA for Hootsuite Inc)

I'm from Hootsuite. We're a Canadian tech company who provides products
and services to businesses, organizations and individuals to really help
them succeed on social. We have leveraged Go in our stack for the past
4+ years. I am super happy to give back to Go on behalf of Hootsuite
through a small contribution to pkgsite (with a few more in the works).
We love this project and we love open source :)

Hopefully we can give back more in the future!
Kush

Change-Id: Id534a41d78e17e1fa48a8ddecd1ca110cf812388
GitHub-Last-Rev: 297b8b06e75c3ce485f62677ce4591c5cabe8008
GitHub-Pull-Request: golang/go#40088
Reviewed-on: https://go-review.googlesource.com/c/go/+/241218
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocrypto/tls: relax the docs of InsecureSkipVerify
Filippo Valsorda [Wed, 24 Jun 2020 18:31:49 +0000 (14:31 -0400)]
crypto/tls: relax the docs of InsecureSkipVerify

Fixes #39074

Change-Id: I72ec95f4b190253bb82d52a03a769b0399170b93
Reviewed-on: https://go-review.googlesource.com/c/go/+/239746
Reviewed-by: Katie Hockman <katie@golang.org>
4 years agonet: correct address when listening on IPv4zero tcp4/udp4 on Plan 9
Fazlul Shahriar [Sun, 5 Jul 2020 05:03:16 +0000 (01:03 -0400)]
net: correct address when listening on IPv4zero tcp4/udp4 on Plan 9

Since Plan 9 doesn't allow us to listen on 0.0.0.0, the Listener
address that's read in from /net is the IPv6 address ::. Convert
this address to 0.0.0.0 when the network is tcp4 or udp4.

Fixes #40045

Change-Id: Icfb69b823e5b80603742d23c3762a812996fe43f
Reviewed-on: https://go-review.googlesource.com/c/go/+/240918
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years agocrypto/x509/pkix: print non-standard parsed Names at the end
Filippo Valsorda [Tue, 30 Jun 2020 16:04:46 +0000 (12:04 -0400)]
crypto/x509/pkix: print non-standard parsed Names at the end

This doesn't change how ExtraNames are printed, so as not to cause
unnecessary churn of current outputs. Switched the ExtraNames check to a
nil check as we are checking for just-parsed values.

Fixes #39924
Fixes #39873

Change-Id: Ifa07cfc1a057d73643710a774ef8a154222db187
Reviewed-on: https://go-review.googlesource.com/c/go/+/240543
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agodoc/go1.15: add html/template and text/template docs
Filippo Valsorda [Tue, 30 Jun 2020 17:23:32 +0000 (13:23 -0400)]
doc/go1.15: add html/template and text/template docs

Updates #37419

Change-Id: I23abfeabc6be704aad9da2649bbbe7c8e237dfab
Reviewed-on: https://go-review.googlesource.com/c/go/+/240546
Reviewed-by: Carlos Amedee <carlos@golang.org>
4 years agogo/build: rewrite TestDependencies to be cleaner, more correct
Russ Cox [Mon, 6 Jul 2020 12:54:12 +0000 (08:54 -0400)]
go/build: rewrite TestDependencies to be cleaner, more correct

TestDependencies defines the dependency policy
(what can depend on what) for the standard library.

The standard library has outgrown the idea of writing
the policy as a plain map literal. Also, the checker was
ignoring vendored packages, which makes it miss real
problems.

This commit adds a little language for describing
partial orders and rewrites the policy in that language.

It also changes the checker to look inside vendored
packages and adds those to the policy as well.

This turned up one important problem: net is depending
on fmt, unicode via golang.org/x/net/dns/dnsmessage,
filed as #40070.

This is a test-only change, so it should be appropriate
even for the release freeze, especially since it identified
a real bug.

Change-Id: I9b79f30761f167b8587204c959baa973583e39f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/241078
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoall: go get golang.org/x/net@ab3426394381
Russ Cox [Tue, 7 Jul 2020 03:46:17 +0000 (23:46 -0400)]
all: go get golang.org/x/net@ab3426394381

Pull in dns/dnsmessage fix to drop fmt dependency.
Also pulled in minor bug fix in x/crypto (dep of net).

Change-Id: I0f618e81a24ac24a5adae00af34b728b243dfdbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/241257
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agodoc/go1.15: update Go 1.15 release notes using relnote
Carlos Amedee [Tue, 7 Jul 2020 11:39:05 +0000 (07:39 -0400)]
doc/go1.15: update Go 1.15 release notes using relnote

The additions were generated using golang.org/x/build/cmd/relnote.

Updates #37419

Change-Id: I99e934377e4bb511c44908039ad6d3bfd3ee35ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/241065
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years ago[dev.link] cmd/link: emit Mach-O relocations in mmap
Cherry Zhang [Mon, 6 Jul 2020 22:44:42 +0000 (18:44 -0400)]
[dev.link] cmd/link: emit Mach-O relocations in mmap

Following CL 240399 and CL 240400, do the same for Mach-O.

Linking cmd/compile with external linking,

name         old time/op    new time/op    delta
Asmb2_GC       32.7ms ± 2%    13.5ms ± 6%   -58.56%  (p=0.008 n=5+5)

name         old alloc/op   new alloc/op   delta
Asmb2_GC       16.5MB ± 0%     6.4MB ± 0%   -61.15%  (p=0.008 n=5+5)

Change-Id: I0fd7019d8713d1940e5fbbce4ee8eebd926451a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/241178
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years ago[dev.link] cmd/link: run more tests in parallel
Cherry Zhang [Mon, 6 Jul 2020 21:49:24 +0000 (17:49 -0400)]
[dev.link] cmd/link: run more tests in parallel

Change-Id: I4062fd89f234b4ca5386b74584e1363c05e82e84
Reviewed-on: https://go-review.googlesource.com/c/go/+/241177
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years ago[dev.link] cmd/link: remove some unneeded code from writeBlock()
Than McIntosh [Mon, 6 Jul 2020 13:38:17 +0000 (09:38 -0400)]
[dev.link] cmd/link: remove some unneeded code from writeBlock()

The loader writeBlock() function has code that tries to skip the
initial portion of the input symbols list depending on the address of
the section being written-- this code is dead (skipping is never
triggered) due to similar skipping in the callers; remove this
preamble.

Change-Id: I9769694a3194faf73ebebbbc10ceba4928c3087c
Reviewed-on: https://go-review.googlesource.com/c/go/+/241067
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years agopath/filepath: add explicit comment marking elided errors
Russ Cox [Mon, 6 Jul 2020 15:28:15 +0000 (11:28 -0400)]
path/filepath: add explicit comment marking elided errors

The errors on these lines are meant to be discarded.
Add a comment to make that extra clear.

Change-Id: I38f72af6dfbb0e86677087baf47780b3cc6e7d40
Reviewed-on: https://go-review.googlesource.com/c/go/+/241083
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years ago[dev.link] cmd/link: better naming for Loader container/subsym methods, part 2 of 2
Than McIntosh [Wed, 1 Jul 2020 12:45:16 +0000 (08:45 -0400)]
[dev.link] cmd/link: better naming for Loader container/subsym methods, part 2 of 2

Introduce a new loader method "SetCarrierSym", to be used when
establishing container/containee symbol relationships for symbol
bucketing in the symtab phase.

This new method is intended to be employed in situations where you
have a series of related symbols will be represented by a single
carrier symbol as a combined entity. The pattern here is that the
sub-symbols contain content but will be anonymous from a symbol table
perspective; the carrier symbol has no content itself but will appear
in the symbol table. Examples of carrier symbols that follow this
model are "runtime.itablink" and "runtime.typelink".

Change-Id: I1a3391a71062c7c740cb108b3fa210b7f69b81ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/240509
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: better naming for Loader container/subsym methods, part 1 of 2
Than McIntosh [Tue, 30 Jun 2020 15:30:28 +0000 (11:30 -0400)]
[dev.link] cmd/link: better naming for Loader container/subsym methods, part 1 of 2

Introduce a new loader method "AddInteriorSym" to be used when
establishing container/containee symbol relationships for host object
sub-symbols and GOT/dynamic sub-symbols.

Interior symbols are employed in situations where you have a
"container" or "payload" symbol that has content, and then a series of
"interior" sub-symbols that point into a portion of the container
symbol's content. Each interior symbol will typically have a useful
name / size / value, but no content of its own. From a symbol table
perspective the container symbol is anonymous, but the interior
symbols are added to the output symbol table.

Change-Id: I919ed5dbbfe2ef2c9a76214f7ea9b384a1be6297
Reviewed-on: https://go-review.googlesource.com/c/go/+/240508
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years agocmd/go: display test binary output if invoked with -help
Ian Lance Taylor [Thu, 2 Jul 2020 19:32:13 +0000 (12:32 -0700)]
cmd/go: display test binary output if invoked with -help

Fixes #39997

Change-Id: I87ea616bac809b96fcd40f3bbdbbf1c603b9d00e
Reviewed-on: https://go-review.googlesource.com/c/go/+/240878
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/oldlink: port bug fixes to old linker
Cherry Zhang [Mon, 6 Jul 2020 18:22:38 +0000 (14:22 -0400)]
cmd/oldlink: port bug fixes to old linker

This CL ports CL 234105 and CL 240621 to the old linker, which
fix critical bugs (runtime crashes).

Updates #39049.
Updates #39927.

Change-Id: I47afc84349119e320d2e60d64b7188a410835d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/241087
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: write ELF relocations in mmap on all architectures
Cherry Zhang [Sat, 4 Jul 2020 22:14:08 +0000 (18:14 -0400)]
[dev.link] cmd/link: write ELF relocations in mmap on all architectures

In CL 240399 we changed to precompute the size for ELF relocation
records and use mmap to write them, but we left architectures
where elfreloc1 write non-fixed number of bytes. This CL handles
those architectures. When a Go relocation will turn into multiple
ELF relocations, in relocsym we account this difference and add
it to the size calculation. So when emitting ELF relocations, we
know the number of ELF relocations to be emitted.

Change-Id: I6732ab674b442f4618405e5412a77f6e4a3315d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/241079
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years agogo/build: remove use of package log
Russ Cox [Mon, 6 Jul 2020 03:39:45 +0000 (23:39 -0400)]
go/build: remove use of package log

package log does not belong here,
even for an impossible condition.

Change-Id: I6180a4f7766a8e5759db4f33d03703d0b678d0b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/241077
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years ago[dev.link] cmd/link: parallelize ELF relocation writing
Cherry Zhang [Fri, 26 Jun 2020 23:17:33 +0000 (19:17 -0400)]
[dev.link] cmd/link: parallelize ELF relocation writing

Now that we write ELF relocation records in mapped memory with
known sizes and offsets, we can write them in parallel.

Further speed up Asmb2 pass. Linking cmd/compile with external
linking,

Asmb2        141ms ± 4%      97ms ± 5%  -30.98%  (p=0.000 n=10+9)

Change-Id: I52c2b9230e90ed4421c21d7ef13a4f1e996f6054
Reviewed-on: https://go-review.googlesource.com/c/go/+/240400
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years ago[dev.link] cmd/link: emit ELF relocations in mmap
Cherry Zhang [Fri, 26 Jun 2020 20:35:49 +0000 (16:35 -0400)]
[dev.link] cmd/link: emit ELF relocations in mmap

Currently, ELF relocations are generated sequentially in the heap
and flushed to output file periodically. In fact, in some cases,
the output size of the relocation records can be easily computed,
as a relocation entry has fixed size. We only need to count the
number of relocation records to compute the size.

Once the size is computed, we can mmap the output with the proper
size, and directly write relocation records in the mapped memory.
It also opens the possibility of writing relocations in parallel
(not done in this CL).

Note: on some architectures, a Go relocation may turn into
multiple ELF relocations, which makes size calculation harder.
This CL does not handle those cases, and it still writes
sequentially in the heap there.

Linking cmd/compile with external linking,

name          old time/op    new time/op    delta
Asmb2            190ms ± 2%     141ms ± 4%  -25.74%  (p=0.000 n=10+10)

name          old alloc/op   new alloc/op   delta
Asmb2_GC        66.8MB ± 0%     8.2MB ± 0%  -87.79%  (p=0.008 n=5+5)

name          old live-B     new live-B     delta
Asmb2_GC         66.9M ± 0%     55.2M ± 0%  -17.58%  (p=0.008 n=5+5)

Change-Id: If7056bbe909dc90033eef6b9c4891fcca310602c
Reviewed-on: https://go-review.googlesource.com/c/go/+/240399
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agodoc/go1.15: fix wording in a few places
Alberto Donizetti [Sun, 5 Jul 2020 12:25:03 +0000 (14:25 +0200)]
doc/go1.15: fix wording in a few places

Change-Id: I1dc6871bdab7f3048eacd6738fdcfa64b8700c8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/240998
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocrypto/tls: create certs w/o KeyEncipherment KU for non-RSA keys in generate_cert.go
Daniel [Fri, 3 Jul 2020 03:07:02 +0000 (03:07 +0000)]
crypto/tls: create certs w/o KeyEncipherment KU for non-RSA keys in generate_cert.go

Summary

The crypto/tls/generate_cert.go utility should only set the template
x509.Certificate's KeyUsage field to a value with the
x509.KeyUsageKeyEncipherment bits set when the certificate subject
public key is an RSA public key, not an ECDSA or ED25519 public key.

Background

RFC 5480 describes the usage of ECDSA elliptic curve subject keys with
X.509. Unfortunately while Section 3 "Key Usages Bits" indicates which
key usage bits MAY be used with a certificate that indicates
id-ecPublicKey in the SubjectPublicKeyInfo field it doesn't provide
guidance on which usages should *not* be included (e.g. the
keyEncipherment bit, which is particular to RSA key exchange). The same
problem is present in RFC 8410 Section 5 describing Key Usage Bits for
ED25519 elliptic curve subject keys.

There's an update to RFC 5480 in last call stage within the IETF LAMPS
WG, draft-ietf-lamps-5480-ku-clarifications-00. This update is meant
to clarify the allowed Key Usages extension values for certificates with
ECDSA subject public keys by adding:

> If the keyUsage extension is present in a certificate that indicates
> id-ecPublicKey as algorithm of AlgorithmIdentifier [RFC2986] in
> SubjectPublicKeyInfo, then following values MUST NOT be present:
>
> keyEncipherment; and
> dataEncipherment.

I don't believe there is an update for RFC 8410 in the works but I
suspect it will be clarified similarly in the future.

This commit updates generate_cert.go to ensure when the certificate
public key is ECDSA or ED25519 the generated certificate has the
x509.Certificate.KeyUsage field set to a value that doesn't include KUs
specific to RSA. For ECDSA keys this will adhere to the updated RFC 5480
language.

Fixes #36499

Change-Id: Ib1b0757c039b7fe97fc6d1e826fe6b88856c1964
GitHub-Last-Rev: a8f34fb33dde90e09b6f9a27b2598a82b3023abb
GitHub-Pull-Request: golang/go#36500
Reviewed-on: https://go-review.googlesource.com/c/go/+/214337
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoRevert "encoding/json: don't reuse slice elements when decoding"
Daniel Martí [Wed, 1 Jul 2020 11:31:15 +0000 (11:31 +0000)]
Revert "encoding/json: don't reuse slice elements when decoding"

This reverts https://golang.org/cl/191783.

Reason for revert: Broke too many programs which depended on the previous
behavior, even when it was the opposite of what the documentation said.

We can attempt to fix the original issue again for 1.16, while keeping
those programs in mind.

Fixes #39427.

Change-Id: I7a7f24b2a594c597ef625aeff04fff29aaa88fc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/240657
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/link: skip fallocate test if not supported, and adjust allocation size on darwin
Cherry Zhang [Tue, 30 Jun 2020 20:51:27 +0000 (16:51 -0400)]
cmd/link: skip fallocate test if not supported, and adjust allocation size on darwin

On Linux, the linker uses fallocate to preallocate the output
file storage. The underlying file system may not support
fallocate, causing the test to fail. Skip the test in this case.

On darwin, apparently F_PREALLOCATE allocates from the end of the
allocation instead of the logical end of the file. Adjust the
size calculation.

Fixes #39905.

Change-Id: I01e676737fd2619ebbdba05c7cf7f424ec27de35
Reviewed-on: https://go-review.googlesource.com/c/go/+/240618
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/link: fix GC data reading from shared library (attempt 2)
Cherry Zhang [Mon, 29 Jun 2020 21:07:17 +0000 (17:07 -0400)]
cmd/link: fix GC data reading from shared library (attempt 2)

When linking against a Go shared library, when a global variable
in the main module has a type defined in the shared library, the
linker needs to pull the GC data from the shared library to build
the GC program for the global variable. Currently, this fails
silently, as the shared library file is closed too early and the
read failed (with no error check), causing a zero GC map emitted
for the variable, which in turn causes the runtime to treat the
variable as pointerless.

For now, fix this by keeping the file open. In the future we may
want to use mmap to read from the shared library instead.

Also add error checking. And fix a (mostly harmless) mistake in
size caluculation.

Also remove an erroneous condition for ARM64. ARM64 used to have
a special case to get the addend from the relocation on the
gcdata field. That was removed, but the new code accidentally
returned 0 unconditionally. It's no longer necessary to have any
special case, since the addend is now applied directly to the
gcdata field on ARM64, like on all the other platforms.

Fixes #39927.

This is the second attempt of CL 240462. And this reverts
CL 240616.

Change-Id: I01c82422b9f67e872d833336885935bc509bc91b
Reviewed-on: https://go-review.googlesource.com/c/go/+/240621
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/link: mark special symbols reachable
Cherry Zhang [Tue, 30 Jun 2020 22:41:24 +0000 (18:41 -0400)]
cmd/link: mark special symbols reachable

The special symbols are linker-created symbols for special
purposes, therefore reachable (otherwise the linker won't create
them). Mark them so, so they get converted to sym.Symbols when we
convert to old symbol representation.

In particular, the failure for building shared library on PPC64
is due to .TOC. symbol not being converted to sym.Symbol, but
referenced in addmoduledata.

Change-Id: Iaf5d145ffa5d15122e86a6e6983514e56dd5d456
Reviewed-on: https://go-review.googlesource.com/c/go/+/240620
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agodoc: add riscv64 to ports list
Tobias Klauser [Mon, 29 Jun 2020 12:32:22 +0000 (14:32 +0200)]
doc: add riscv64 to ports list

Mention support for the 64-bit RISC-V instruction set (GOARCH=riscv64)
in the "Installing Go from source" document. Also sort the list of
supported instruction sets alphabetically.

Updates #27532

Change-Id: I07a443044a41a803853978dd7f7446de89ecceb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/240377
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
4 years agoRevert "cmd/link: fix GC data reading from shared library"
Cherry Zhang [Tue, 30 Jun 2020 19:09:38 +0000 (19:09 +0000)]
Revert "cmd/link: fix GC data reading from shared library"

This reverts CL 240462.

Reason for revert: test fails on PPC64LE.

Updates #39927.

Change-Id: I4f14fd0c36e604a80ae9f2f86d1e643e28945e93
Reviewed-on: https://go-review.googlesource.com/c/go/+/240616
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/link: fix GC data reading from shared library
Cherry Zhang [Mon, 29 Jun 2020 21:07:17 +0000 (17:07 -0400)]
cmd/link: fix GC data reading from shared library

When linking against a Go shared library, when a global variable
in the main module has a type defined in the shared library, the
linker needs to pull the GC data from the shared library to build
the GC program for the global variable. Currently, this fails
silently, as the shared library file is closed too early and the
read failed (with no error check), causing a zero GC map emitted
for the variable, which in turn causes the runtime to treat the
variable as pointerless.

For now, fix this by keeping the file open. In the future we may
want to use mmap to read from the shared library instead.

Also add error checking. And fix a (mostly harmless) mistake in
size caluculation.

Also remove an erroneous condition for ARM64. ARM64 used to have
a special case to get the addend from the relocation on the
gcdata field. That was removed, but the new code accidentally
returned 0 unconditionally. It's no longer necessary to have any
special case, since the addend is now applied directly to the
gcdata field on ARM64, like on all the other platforms.

Fixes #39927.

Change-Id: Iecd32315b326c7059587fdc190e2fa99426e497e
Reviewed-on: https://go-review.googlesource.com/c/go/+/240462
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
4 years agodoc/go1.15: add encoding/asn1 note about minimal encoding
Roland Shoemaker [Tue, 30 Jun 2020 16:14:15 +0000 (09:14 -0700)]
doc/go1.15: add encoding/asn1 note about minimal encoding

Also fix missing <code> tags in the other encoding/asn1 note.

Updates #37419

Change-Id: Ic0e9131016b44ed864629aa8d0a7fddb57146d21
Reviewed-on: https://go-review.googlesource.com/c/go/+/240518
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years ago[dev.link] cmd/link: stop Seek file in munmap
Cherry Zhang [Fri, 26 Jun 2020 23:54:00 +0000 (19:54 -0400)]
[dev.link] cmd/link: stop Seek file in munmap

If mmap is used, we don't do file I/O anymore, so no need to Seek
in the file either.

Change-Id: Ic8350eb66404398420df18560f6a7acbb3fcf7e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/240398
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years ago[dev.link] cmd/link: read symbol type only when necessary in elfreloc1
Cherry Zhang [Fri, 26 Jun 2020 18:06:41 +0000 (14:06 -0400)]
[dev.link] cmd/link: read symbol type only when necessary in elfreloc1

Slightly speeds up Asmb2.

Linking cmd/compile with external linking:
Asmb2         190ms ± 2%     182ms ± 2%  -4.14%  (p=0.000 n=10+9)

Change-Id: I55511d0e7b0511b60f8d02390076f8566bc7d135
Reviewed-on: https://go-review.googlesource.com/c/go/+/240397
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agonet: fix TestDialerLocalAddr on Plan 9
Fazlul Shahriar [Mon, 29 Jun 2020 23:22:34 +0000 (19:22 -0400)]
net: fix TestDialerLocalAddr on Plan 9

We cannot use "0.0.0.0" (IPv4) or "::" (IPv6) for local address, so
don't use those addresses in the control message. Alternatively, we
could've used "*" instead.

Fixes #39931

Change-Id: Ib2dcbb1a0c648296c3ecaddbe938053a569b1f1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/240464
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years agodoc: add note about missing lock in sample code
Ferenc Szabo [Thu, 25 Jun 2020 09:12:50 +0000 (11:12 +0200)]
doc: add note about missing lock in sample code

The sample code in 'Interfaces and methods' section contains a
data race. Handlers are served concurrently. The handler does write
and read operations; `go test -race` would fail (with concurrent
requests). Since the doc is frozen and the code remains less
cluttered without locks/atomic, don't change the sample code.

Change-Id: I654b324d2f0b7f48497822751907c7d39e2f0e3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/239877
Reviewed-by: Rob Pike <r@golang.org>
4 years agodoc/go1.15: remove encoding/xml doc
Ian Lance Taylor [Fri, 26 Jun 2020 18:31:02 +0000 (11:31 -0700)]
doc/go1.15: remove encoding/xml doc

The change is rolled back in CL 240179.

For #35151
For #39876

Change-Id: Id26ccbdb482772ac31c642156a9900102397b043
Reviewed-on: https://go-review.googlesource.com/c/go/+/240012
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
4 years agoRevert "encoding/xml: fix reserved namespace check to be case-insensitive"
Ian Lance Taylor [Fri, 26 Jun 2020 18:29:34 +0000 (18:29 +0000)]
Revert "encoding/xml: fix reserved namespace check to be case-insensitive"

This reverts CL 203417.

Reason for revert: This change changes uses of tags like "XMLSchema-instance" without any recourse.

For #35151
Fixes #39876

Change-Id: I4c85c8267a46b3748664b5078794dafffb42aa26
Reviewed-on: https://go-review.googlesource.com/c/go/+/240179
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
4 years agodoc: add alt attribute to gopher image in help.html
Alexander Nohe [Sat, 27 Jun 2020 23:22:29 +0000 (23:22 +0000)]
doc: add alt attribute to gopher image in help.html

This adds an alt tag for accessibility. The alt text is a visual
description of the text that is read out loud to users using a
screen reader. The HTML specifications indicate that alt tags for
decorative images should be left blank.

Fixes #39861

Change-Id: I76c39a461ceabe685826aa46e4f26ad893d50634
Reviewed-on: https://go-review.googlesource.com/c/go/+/240258
Reviewed-by: Alexander Nohe <alex.nohe427@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agodoc/go1.15: add release note for encoding/asn1
Roland Shoemaker [Sat, 27 Jun 2020 04:33:22 +0000 (21:33 -0700)]
doc/go1.15: add release note for encoding/asn1

Updates #37419

Change-Id: I05368efbedd8c7e0b50cd691559491699c3a0945
Reviewed-on: https://go-review.googlesource.com/c/go/+/240201
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agonet/http: fix panic with If-None-Match value in http.ServeContent
Marcus Weiner [Wed, 24 Jun 2020 15:24:56 +0000 (15:24 +0000)]
net/http: fix panic with If-None-Match value in http.ServeContent

Fixes #39817

Change-Id: I79f2ad7c836a8a46569f603aca583fdd526d22dc
GitHub-Last-Rev: 5b88aada219aaa2af0c7e1969ed6fa646117d9da
GitHub-Pull-Request: golang/go#39821
Reviewed-on: https://go-review.googlesource.com/c/go/+/239699
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
4 years agonet: add support for dialing from a custom local address on Plan 9
Fazlul Shahriar [Thu, 25 Jun 2020 23:41:13 +0000 (19:41 -0400)]
net: add support for dialing from a custom local address on Plan 9

Make use of the extra parameter on "connect" control message to set the
local IP address and port. The ip(3) man page doesn't document that the
local IP address is settable, but upon inspection of the source code,
it's clearly settable.

Fixes #39747

Change-Id: Ied3d60452f20d6e5af23d1c1dcb34774af0dbd5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/240064
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years agonet: handle more interface types without a hardware address on Plan 9
Fazlul Shahriar [Mon, 29 Jun 2020 05:50:50 +0000 (01:50 -0400)]
net: handle more interface types without a hardware address on Plan 9

We were handling loopback devices when attempting to read hardware
address, but packet interfaces were not being handled. As a general fix,
don't attempt to read hardware address of any device that's not inside
/net.

Fixes #39908

Change-Id: Ifa05e270357e111c60906110db2cc23dc7c1c49c
Reviewed-on: https://go-review.googlesource.com/c/go/+/240259
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years agodoc: fix typos and grammatical errors in contribute.html
Jie Ma [Sat, 27 Jun 2020 23:15:53 +0000 (23:15 +0000)]
doc: fix typos and grammatical errors in contribute.html

Fixed some typos and grammatical errors in contribute.html

Change-Id: Ifb31f22d876b7bea84b5e130870c26813b2fa139
GitHub-Last-Rev: 43519198859ca8f5e1c870b8f3eeb1b465aa6bc5
GitHub-Pull-Request: golang/go#39892
Reviewed-on: https://go-review.googlesource.com/c/go/+/240277
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoruntime: ensure arenaBaseOffset makes it into DWARF (for viewcore)
Keith Randall [Fri, 26 Jun 2020 23:38:40 +0000 (16:38 -0700)]
runtime: ensure arenaBaseOffset makes it into DWARF (for viewcore)

This constant does not make it into DWARF because it is an ideal
constant larger than maxint (1<<63-1). DWARF has no way to represent
signed values that large. Define a different typed constant that
is unsigned and so can represent this constant properly.

Viewcore needs this constant to interrogate the heap data structures.
In addition, the sign of arenaBaseOffset changed in 1.15, and providing
a new name lets viewcore detect the sign change easily.

Change-Id: I4274a2f6e79ebbf1411e85d64758fac1672fb96b
Reviewed-on: https://go-review.googlesource.com/c/go/+/240198
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 years agocmd/cgo: prevent redeclaration of _Ctype_void when C.void is used
Matthew Dempsky [Fri, 26 Jun 2020 18:26:33 +0000 (11:26 -0700)]
cmd/cgo: prevent redeclaration of _Ctype_void when C.void is used

CL 230037 changed cmd/cgo to emit "type _Ctype_foo = bar" aliases for
all C.foo types mentioned in the original Go source files. However,
cmd/cgo already emits an appropriate type definition for _Ctype_void.
So if a source file explicitly mentions C.void, this resulted in
_Ctype_void being declared multiple times.

This CL fixes the issue by suppressing the "type _Ctype_void =
_Ctype_void" alias before printing it. This should be safe because
_Ctype_void is the only type that's specially emitted in out.go at the
moment.

A somewhat better fix might be to fix how _Ctype_void is declared in
the cmd/cgo "frontend", but this is a less invasive fix.

Fixes #39877.

Change-Id: Ief264b3847c8ef8df1478a6333647ff2cf09b63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240180
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agodoc/go1.15: fix typos and wording in a few places
Alberto Donizetti [Fri, 26 Jun 2020 17:05:13 +0000 (19:05 +0200)]
doc/go1.15: fix typos and wording in a few places

Change-Id: Ib1fc7a8305f3bc698b9022e0a565ccbcf687e0d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/240158
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years ago[dev.link] all: merge branch 'master' into dev.link
Cherry Zhang [Fri, 26 Jun 2020 18:25:33 +0000 (14:25 -0400)]
[dev.link] all: merge branch 'master' into dev.link

Clean merge.

Change-Id: I2ae0e4cc67e24216c85619717657dce36e887a54

4 years agodoc/go1.14: crypto/tls.Config.NameToCertificate is deprecated
Ian Lance Taylor [Thu, 25 Jun 2020 23:39:56 +0000 (16:39 -0700)]
doc/go1.14: crypto/tls.Config.NameToCertificate is deprecated

Also crypto/tls.Config.BuildNameToCertificate.

Note that this field and method were deprecated in the Go 1.14 release,
so this change is to the 1.14 release notes.

Fixes #37626

Change-Id: If8549bc746f42a93f1903439e1b464b3e81e2c19
Reviewed-on: https://go-review.googlesource.com/c/go/+/240005
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agoruntime: don't preempt if preemption is disabled
Cherry Zhang [Fri, 26 Jun 2020 15:57:08 +0000 (11:57 -0400)]
runtime: don't preempt if preemption is disabled

If asyncpreemptoff is set, don't preempt upon receiving a SIGURG.

Fixes #38531.

Change-Id: I6d9a828b45c199d3e479cbdfe17a896a40d540f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/240121
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agodoc/go1.15: fix bad link to crypto/tls
Alberto Donizetti [Fri, 26 Jun 2020 16:24:15 +0000 (18:24 +0200)]
doc/go1.15: fix bad link to crypto/tls

Change-Id: Ie81579cbb1873349a91280f5aebe59624fcb1ef8
Reviewed-on: https://go-review.googlesource.com/c/go/+/240157
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
4 years ago[dev.link] cmd/link: remove special dynlinkingGo case in pclntab pass
Cherry Zhang [Fri, 26 Jun 2020 02:38:14 +0000 (22:38 -0400)]
[dev.link] cmd/link: remove special dynlinkingGo case in pclntab pass

Now that we removed the "weird thing" about runtime.etext symbol,
we can remove this special case.

Change-Id: I2e4558367758d37e898a802bcd30671c7dd6fe89
Reviewed-on: https://go-review.googlesource.com/c/go/+/240066
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: handle runtime.text/etext symbols more consistently
Cherry Zhang [Fri, 26 Jun 2020 02:22:59 +0000 (22:22 -0400)]
[dev.link] cmd/link: handle runtime.text/etext symbols more consistently

Currently, on most platforms, the start/end symbols runtime.text
and runtime.etext are defined in symtab pass and assigned values
in address pass. In some cases (darwin+dynlink or AIX+external),
however, they are defined and assigned values in textaddress pass
(because they need non-zero sizes). Then their values get
overwritten in address pass. This is bad. The linker expects
their values to be consistent. In particular, in CL 239281,
findfunctab is split to two parts. The two parts need to have a
consistent view of the start/end symbols. If its value changes in
between, bad things can happen.

This CL fixes it by always defining runtime.text/etext symbols in
the textaddress pass.

Fix darwin and AIX builds.

Change-Id: Ifdc1bcb69d99be1b7e5b4fd31d473650c03e3b9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240065
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/link: move findfunctab to a generated symbol
Jeremy Faller [Mon, 22 Jun 2020 15:11:12 +0000 (11:11 -0400)]
[dev.link] cmd/link: move findfunctab to a generated symbol

Basically removes all allocation from findfunctab:

Findfunctab_GC                172kB ± 0%       0kB ± 0%   ~     (p=1.000 n=1+1)

Change-Id: I246f7d2751317886b658f7ef672fb30b3c519668
Reviewed-on: https://go-review.googlesource.com/c/go/+/239281
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years ago[dev.link] cmd/link: add generator symbols
Jeremy Faller [Fri, 19 Jun 2020 19:35:28 +0000 (15:35 -0400)]
[dev.link] cmd/link: add generator symbols

Create a new class of symbols internal to the linker. These symbols live
in the Loader, and are real smybols, but have no data, only size. After
symbols are allocated in the binary in asmb() a function is called that
is responsible for filling in the data.

This allows the linker to create large symbols, but not pay the price on
the heap memory.

Change-Id: Ib4291fc6e578478057ed2ec163d7b27426f1d5ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/239280
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocrypto/x509: move and update the SSL_CERT_FILE and SSL_CERT_DIR docs
Filippo Valsorda [Wed, 24 Jun 2020 20:49:05 +0000 (16:49 -0400)]
crypto/x509: move and update the SSL_CERT_FILE and SSL_CERT_DIR docs

Fixes #37907

Change-Id: Ia077de6dcc74ed761d278eab4efbf45e151429b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/239747
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
4 years agocmd/compile: remove check that Zero's arg has the correct base type
Keith Randall [Thu, 25 Jun 2020 03:59:18 +0000 (20:59 -0700)]
cmd/compile: remove check that Zero's arg has the correct base type

It doesn't have to. The type in the aux field is authoritative.
There are cases involving casting from interface{} where pointers
have a placeholder pointer type (because the type is not known when
the IData op is generated).

The check was introduced in CL 13447.

Fixes #39459

Change-Id: Id77a57577806a271aeebd20bea5d92d08ee7aa6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/239817
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 years agoos: return *PathError error in File.Sync on Plan 9
Fazlul Shahriar [Thu, 25 Jun 2020 05:15:42 +0000 (01:15 -0400)]
os: return *PathError error in File.Sync on Plan 9

File.Sync was returning *SyscallError instead of *PathError on Plan 9.
Adjust the error type to match other systems.

Fixes #39800

Change-Id: I844e716eb61c193ef78d29cb0b4a3ef790bb3320
Reviewed-on: https://go-review.googlesource.com/c/go/+/239857
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years ago[dev.link] cmd/internal: convert basic types to builtin symbols
Than McIntosh [Wed, 17 Jun 2020 15:42:47 +0000 (11:42 -0400)]
[dev.link] cmd/internal: convert basic types to builtin symbols

The Go compiler includes special treatment for a small set of very
commonly used type symbols (26 to be exact); for these types it
doesn't bother to emit type descriptors for "normal" compilations, and
instead only generates them for the runtime package, so as to reduce
object file bloat.

This patch moves the set of type symbols in question from the
PkgIdxNone index space (in the object file) to the PkgIdxBuiltin
space, which saves some work in the compiler and loader (reduces each
package's index space slightly).

Change-Id: I039c805e05c1aef26f035e52760fd0a0af40f7a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/239658
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years ago[dev.link] cmd/internal/obj: don't write builtin names in obj writer
Than McIntosh [Wed, 17 Jun 2020 14:41:56 +0000 (10:41 -0400)]
[dev.link] cmd/internal/obj: don't write builtin names in obj writer

Change the object file writer to avoid adding entries to the object
file string table for builtin functions. This helps save some very
small amount of space in the object file.

Change-Id: Ic3b94a154e00eb4c7378b57613580c7073b841bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/239657
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
4 years agodoc/go1.15: mention consequence of os.File.ReadFrom
Ian Lance Taylor [Fri, 19 Jun 2020 05:43:36 +0000 (22:43 -0700)]
doc/go1.15: mention consequence of os.File.ReadFrom

Now that we've added a os.File.ReadFrom method, io.CopyBuffer to a
os.File will no longer use the provided buffer.

For #16474
For #36817
For #37419

Change-Id: I79a3bf778ff93eab88e88dd9ecbb8c7ea101e868
Reviewed-on: https://go-review.googlesource.com/c/go/+/238864
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agodoc/faq: fix a grammar mistake
Kerollos Magdy [Tue, 23 Jun 2020 10:45:36 +0000 (10:45 +0000)]
doc/faq: fix a grammar mistake

Change-Id: Ifa060f5f91d7b964eb180465245104411310d423
GitHub-Last-Rev: cd1862f2ca721a4f3d4ede7bcb3e7759ce96c6d5
GitHub-Pull-Request: golang/go#39780
Reviewed-on: https://go-review.googlesource.com/c/go/+/239388
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agonet: consistently document deadline handling
Ian Lance Taylor [Wed, 24 Jun 2020 21:47:41 +0000 (14:47 -0700)]
net: consistently document deadline handling

After CL 228645 some mentions of the Deadline methods referred
to the Timeout method, and some to os.ErrDeadlineExceeded.
Stop referring to the Timeout method, to encourage ErrDeadlineExceeded.

For #31449

Change-Id: I27b8ff34f31798f38b06437546886af8cce98ca4
Reviewed-on: https://go-review.googlesource.com/c/go/+/239705
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>