]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
3 years ago[dev.regabi] all: merge master (ff0e93e) into dev.regabi
Cherry Zhang [Fri, 12 Feb 2021 21:30:51 +0000 (16:30 -0500)]
[dev.regabi] all: merge master (ff0e93e) into dev.regabi

Conflicts:

- src/cmd/compile/internal/gc/walk.go

  gc/walk.go is changed in CL 290950 on the master branch but
  deleted in the dev.regabi branch and moved over to the walk
  package. This CL includes porting CL 290950 over to the new
  walk.

Merge List:

+ 2021-02-12 ff0e93ea31 doc/go1.16: note that package path elements beginning with '.' are disallowed
+ 2021-02-11 249da7ec02 CONTRIBUTORS: update for the Go 1.16 release
+ 2021-02-11 864d4f1c6b cmd/go: multiple small 'go help' fixes
+ 2021-02-11 26ceae85a8 spec: More precise wording in section on function calls.
+ 2021-02-11 930c2c9a68 cmd/go: reject embedded files that can't be packed into modules
+ 2021-02-11 e5b08e6d5c io/fs: allow backslash in ValidPath, reject in os.DirFS.Open
+ 2021-02-10 ed8079096f cmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD
+ 2021-02-09 e9c9683597 cmd/go: suppress errors from 'go get -d' for packages that only conditionally exist
+ 2021-02-09 e0ac989cf3 archive/tar: detect out of bounds accesses in PAX records resulting from padded lengths
+ 2021-02-09 c9d6f45fec runtime/metrics: fix a couple of documentation typpos
+ 2021-02-09 cea4e21b52 io/fs: backslash is always a glob meta character
+ 2021-02-08 dc725bfb3c doc/go1.16: mention new vet check for asn1.Unmarshal

Change-Id: Ib28fffa7dfbff7f6cdbfaf4a304757fead7bbf19

3 years agodoc/go1.16: note that package path elements beginning with '.' are disallowed
Bryan C. Mills [Thu, 11 Feb 2021 21:24:26 +0000 (16:24 -0500)]
doc/go1.16: note that package path elements beginning with '.' are disallowed

For #43985

Change-Id: I1a16f66800c5c648703f0a0d2ad75024525a710f
Reviewed-on: https://go-review.googlesource.com/c/go/+/291389
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years agoCONTRIBUTORS: update for the Go 1.16 release
Carlos Amedee [Thu, 11 Feb 2021 01:29:50 +0000 (20:29 -0500)]
CONTRIBUTORS: update for the Go 1.16 release

This update was created using the updatecontrib command:

go get golang.org/x/build/cmd/updatecontrib
cd gotip
updatecontrib

With manual changes based on publicly available information
to canonicalize letter case and formatting for a few names.

For #12042.

Change-Id: I030b77e8ebcc7fe02106f0f264acdfb0b56e20d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291189
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agocmd/go: multiple small 'go help' fixes
Jay Conrod [Thu, 11 Feb 2021 15:27:55 +0000 (10:27 -0500)]
cmd/go: multiple small 'go help' fixes

* Link to privacy policies for proxy.golang.org and sum.golang.org in
  'go help modules'. It's important that both policies are linked from
  the go command's documentation.
* Fix wording and typo in 'go help vcs' following comments in CL 290992,
  which adds reference documentation for GOVCS.
* Fix whitespace on GOVCS in 'go help environment'.

For #41730

Change-Id: I86abceacd4962b748361244026f219157c9285e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/291230
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agospec: More precise wording in section on function calls.
DQNEO [Wed, 10 Feb 2021 05:46:54 +0000 (14:46 +0900)]
spec: More precise wording in section on function calls.

A caller is not always in a function.

For example, a call can appear in top level declarations.

e.g. var x = f()

Change-Id: I29c4c3b7663249434fb2b8a6d0003267c77268cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/290849
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>

3 years agocmd/go: reject embedded files that can't be packed into modules
Russ Cox [Tue, 9 Feb 2021 22:34:09 +0000 (17:34 -0500)]
cmd/go: reject embedded files that can't be packed into modules

If the file won't be packed into a module,
don't put those files into embeds.
Otherwise people will be surprised when things work
locally but not when imported by another module.

Observed on CL 290709

Change-Id: Ia0ef7d0e0f5e42473c2b774e57c843e68a365bc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/290809
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
3 years agoio/fs: allow backslash in ValidPath, reject in os.DirFS.Open
Russ Cox [Tue, 9 Feb 2021 18:46:53 +0000 (13:46 -0500)]
io/fs: allow backslash in ValidPath, reject in os.DirFS.Open

Rejecting backslash introduces problems with presenting
underlying OS file systems that contain names with backslash.
Rejecting backslash also does not Windows-proof the syntax,
because colon can also be a path separator. And we are not
going to reject colon from all names. So don't reject backslash
either.

There is a similar problem on Windows with names containing
slashes, but those are more difficult (though not impossible)
to create.

Also document and enforce that paths must be UTF-8.

Fixes #44166.

Change-Id: Iac7a9a268025c1fd31010dbaf3f51e1660c7ae2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/290709
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

3 years agocmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD
Cherry Zhang [Wed, 10 Feb 2021 17:43:18 +0000 (12:43 -0500)]
cmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD

For functions that call reflect.Type.Method (or MethodByName), we
mark it as REFLECTMETHOD, which tells the linker that methods
can be retrieved via reflection and the linker keeps all exported
methods live. Currently, this marking expects exactly the
interface call reflect.Type.Method (or MethodByName). But now the
compiler can devirtualize that call to a concrete call
reflect.(*rtype).Method (or MethodByName), which is not handled
and causing the linker to discard methods too aggressively.
Handle the latter in this CL.

Fixes #44207.

Change-Id: Ia4060472dbff6ab6a83d2ca8e60a3e3f180ee832
Reviewed-on: https://go-review.googlesource.com/c/go/+/290950
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years ago[dev.regabi] cmd/link: stop using ABI aliases if wrapper is enabled
Cherry Zhang [Fri, 5 Feb 2021 23:07:46 +0000 (18:07 -0500)]
[dev.regabi] cmd/link: stop using ABI aliases if wrapper is enabled

If ABI wrappers are enabled, we should not see ABI aliases at
link time. Stop resolving them. One exception is shared linkage,
where we still use ABI aliases as we don't always know the ABI
for symbols from shared libraries.

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

3 years agocmd/go: suppress errors from 'go get -d' for packages that only conditionally exist
Bryan C. Mills [Thu, 4 Feb 2021 20:26:52 +0000 (15:26 -0500)]
cmd/go: suppress errors from 'go get -d' for packages that only conditionally exist

Fixes #44106
Fixes #29268

Change-Id: Id113f2ced274d43fbf66cb804581448218996f81
Reviewed-on: https://go-review.googlesource.com/c/go/+/289769
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>

3 years ago[dev.regabi] go/types: use 512 bits as max. integer precision
Rob Findley [Tue, 9 Feb 2021 03:37:48 +0000 (22:37 -0500)]
[dev.regabi] go/types: use 512 bits as max. integer precision

This is a port of CL 288633 to go/types. It differs from that CL
in the implementation of opName, which now uses ast Exprs.

Additionally, a couple tests had to be updated:
 + TestEvalArith is updated to not overflow.
 + stmt0.src is updated to have an error positioned on the '<<'
   operator.

Change-Id: I628357c33a1e7b0bb5bb7de5736f1fb10ce404e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/290630
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: adjust importer to match compiler importer
Rob Findley [Tue, 9 Feb 2021 02:53:29 +0000 (21:53 -0500)]
[dev.regabi] go/types: adjust importer to match compiler importer

This is an exact port of CL 288632 to go/types.

Change-Id: Ie46e13355bdd0713b392e042844bab8491a16504
Reviewed-on: https://go-review.googlesource.com/c/go/+/290629
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: handle untyped constant arithmetic overflow
Rob Findley [Mon, 8 Feb 2021 23:04:58 +0000 (18:04 -0500)]
[dev.regabi] go/types: handle untyped constant arithmetic overflow

This is a port of CL 287832 for go/types. It differs from that CL in its
handling of position data. Unlike the syntax package, which has a
unified Operation node, go/types checks operations for ast.UnaryExpr,
IncDecStmt, and BinaryExpr. It was simpler to keep the existing position
logic. Notably, this correctly puts the errors on the operator.

Change-Id: Id1e3aefe863da225eb0a9b3628cfc8a5684c0c4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/290569
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>

3 years ago[dev.regabi] go/types: must not import a package called "init"
Rob Findley [Mon, 8 Feb 2021 23:24:13 +0000 (18:24 -0500)]
[dev.regabi] go/types: must not import a package called "init"

This is a port of CL 287494 to go/types. The additional checks in
test/fixedbugs are included, though they won't be executed by go/types.
Support for errorcheckdir checks will be added to go/types in a later
CL.

Change-Id: I37e202ea5daf7d7b8fc6ae93a4c4dbd11762480f
Reviewed-on: https://go-review.googlesource.com/c/go/+/290570
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoarchive/tar: detect out of bounds accesses in PAX records resulting from padded lengths
Emmanuel T Odeke [Thu, 4 Feb 2021 09:39:18 +0000 (01:39 -0800)]
archive/tar: detect out of bounds accesses in PAX records resulting from padded lengths

Handles the case in which padding of a PAX record's length field
violates invariants about the formatting of record, whereby it no
longer matches the prescribed format:

    "%d %s=%s\n", <length>, <keyword>, <value>

as per:

    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_03

0-padding, and paddings of other sorts weren't handled and we assumed
that only non-padded decimal lengths would be passed in.
Added test cases to ensure that the parsing still proceeds as expected.

The prior crashing repro:

    0000000000000000000000000000000030 mtime=1432668921.098285006\n30 ctime=2147483649.15163319

exposed the fallacy in the code, that assumed that the length would ALWAYS be a
non-padded decimal length string.

This bug has existed since Go1.1 as per CL 6700047.

Thanks to Josh Bleecher Snyder for fuzzing this package, and thanks to Tom
Thorogood for advocacy, raising parity with GNU Tar, but for providing more test cases.

Fixes #40196

Change-Id: I32e0af4887bc9221481bd9e8a5120a79f177f08c
Reviewed-on: https://go-review.googlesource.com/c/go/+/289629
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
3 years ago[dev.regabi] go/types: report unused packages in source order
Rob Findley [Thu, 4 Feb 2021 17:24:10 +0000 (12:24 -0500)]
[dev.regabi] go/types: report unused packages in source order

This is a port of CL 287072 to go/types.

Change-Id: I08f56995f0323c1f238d1b44703a481d393471d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/289720
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: factor out sorting of methods
Rob Findley [Thu, 4 Feb 2021 17:10:02 +0000 (12:10 -0500)]
[dev.regabi] go/types: factor out sorting of methods

This is a port of CL 285993 to go/types.

Change-Id: I7560cf1176fea5de2c54786a086e547c73294a60
Reviewed-on: https://go-review.googlesource.com/c/go/+/289717
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: convert untyped arguments to delete
Rob Findley [Thu, 4 Feb 2021 17:03:53 +0000 (12:03 -0500)]
[dev.regabi] go/types: convert untyped arguments to delete

This is a port of CL 285059 to go/types. The error assertion is updated
to match go/types error for assignment, which has been improved.

Change-Id: Icdd2751edea0abef7c84feadcbf9265d71239ade
Reviewed-on: https://go-review.googlesource.com/c/go/+/289716
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agoruntime/metrics: fix a couple of documentation typpos
Ian Lance Taylor [Sun, 7 Feb 2021 23:25:39 +0000 (15:25 -0800)]
runtime/metrics: fix a couple of documentation typpos

Fixes #44150

Change-Id: Ibe5bfba01491dd8c2f0696fab40a1673230d76e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/290349
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years agoio/fs: backslash is always a glob meta character
Ian Lance Taylor [Tue, 9 Feb 2021 00:32:39 +0000 (16:32 -0800)]
io/fs: backslash is always a glob meta character

Fixes #44171

Change-Id: I2d3437a2f5b9fa0358e4664e1a8eacebed975eed
Reviewed-on: https://go-review.googlesource.com/c/go/+/290512
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
3 years agodoc/go1.16: mention new vet check for asn1.Unmarshal
KimMachineGun [Mon, 8 Feb 2021 23:27:52 +0000 (23:27 +0000)]
doc/go1.16: mention new vet check for asn1.Unmarshal

This vet check was added in CL 243397.

For #40700.

Change-Id: Ibff6df9395d37bb2b84a791443578009f23af4fb
GitHub-Last-Rev: e47c38f6309f31a6de48d4ffc82078d7ad45b171
GitHub-Pull-Request: golang/go#44147
Reviewed-on: https://go-review.googlesource.com/c/go/+/290330
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.regabi] go/types: consistently report nil type as "untyped nil"
Rob Findley [Thu, 4 Feb 2021 16:44:21 +0000 (11:44 -0500)]
[dev.regabi] go/types: consistently report nil type as "untyped nil"

This is a port of CL 284052 to go/types. The port is not entirely
faithful, as untyped conversion has been refactored in go/types.
Additionally, a comment was added to reference issue #13061 in the
implicitType method.

For #13061

Change-Id: Iec17611f6432c988624023d1d74121ff34eb0c83
Reviewed-on: https://go-review.googlesource.com/c/go/+/289715
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] all: merge master (1901853) into dev.regabi
Cherry Zhang [Mon, 8 Feb 2021 19:01:08 +0000 (14:01 -0500)]
[dev.regabi] all: merge master (1901853) into dev.regabi

Merge List:

+ 2021-02-08 1901853098 runtime/metrics: fix panic in readingAllMetric example
+ 2021-02-08 ed3e4afa12 syscall/plan9: remove spooky fd action at a distance
+ 2021-02-05 724d0720b3 doc/go1.16: add missed heading tag in vet section
+ 2021-02-05 b54cd94d47 embed, io/fs: clarify that leading and trailing slashes are disallowed
+ 2021-02-05 4516afebed testing/fstest: avoid symlink-induced failures in tester
+ 2021-02-04 8869086d8f runtime: fix typo in histogram.go
+ 2021-02-03 e491c6eea9 math/big: fix comment in divRecursiveStep

Change-Id: I5e2bd18f42251eeb4ad0bf5c93a08c6a9b873d7b

3 years ago[dev.regabi] runtime: use g register in some assembly functions on AMD64
Cherry Zhang [Thu, 4 Feb 2021 17:40:04 +0000 (12:40 -0500)]
[dev.regabi] runtime: use g register in some assembly functions on AMD64

Now that we have a g register, just use it.

Note: functions that can be called from ABI0 context (e.g.
morestack) is unchanged. Functions that switch g is also
unchanged, because we need to set the new g in both the register
and TLS.

TODO: other OSes.

Change-Id: I692a82a7caa8417ff620a59676a6275f56747b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/289718
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] cmd/internal/obj/x86: use g register in stack bounds check
Cherry Zhang [Thu, 4 Feb 2021 16:43:24 +0000 (11:43 -0500)]
[dev.regabi] cmd/internal/obj/x86: use g register in stack bounds check

In ABIInternal context, we can directly use the g register for
stack bounds check.

Change-Id: I8b1073a3343984a6cd76cf5734ddc4a8cd5dc73f
Reviewed-on: https://go-review.googlesource.com/c/go/+/289711
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
3 years ago[dev.regabi] runtime: initialize special registers before sigpanic
Cherry Zhang [Thu, 4 Feb 2021 16:41:34 +0000 (11:41 -0500)]
[dev.regabi] runtime: initialize special registers before sigpanic

In case that we are panicking in ABI0 context or external code,
special registers are not initialized. Initialized them in
injected code before calling sigpanic.

TODO: Windows, Plan 9.

Change-Id: I0919b80e7cc55463f3dd94f1f63cba305717270a
Reviewed-on: https://go-review.googlesource.com/c/go/+/289710
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64
Cherry Zhang [Tue, 2 Feb 2021 23:20:16 +0000 (18:20 -0500)]
[dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64

This is a proof-of-concept change for using the g register on
AMD64. getg is now lowered to R14 in the new ABI. The g register
is not yet used in all places where it can be used (e.g. stack
bounds check, runtime assembly code).

Change-Id: I10123ddf38e31782cf58bafcdff170aee0ff0d1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/289196
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
3 years agoruntime/metrics: fix panic in readingAllMetric example
Changkun Ou [Sun, 7 Feb 2021 16:31:12 +0000 (17:31 +0100)]
runtime/metrics: fix panic in readingAllMetric example

medianBucket can return if the total is greater than thresh.
However, if a histogram has no counts, total and thresh
will both be zero and cause panic.

Adding an equal sign to prevent the potential panic.

Fixes #44148

Change-Id: Ifb8a781990f490d142ae7c035b4e01d6a07ae04d
Reviewed-on: https://go-review.googlesource.com/c/go/+/290171
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agosyscall/plan9: remove spooky fd action at a distance
Ori Bernstein [Wed, 6 Jan 2021 02:40:05 +0000 (02:40 +0000)]
syscall/plan9: remove spooky fd action at a distance

Change Plan 9 fork/exec to use the O_CLOEXEC file
descriptor, instead of relying on spooky at a
distance.

Historically, Plan 9 has set the O_CLOEXEC flag on
the underlying channels in the kernel, rather
than the file descriptors -- if two fds pointed
at a single channel, as with dup, changing the
flags on one of them would be observable on the
other.

The per-Chan semantics are ok, if unexpected,
when a chan is only handled within a single
process, but this isn't always the case.

Forked processes share Chans, but even more of
a problem is the interaction between /srv and
OCEXEC, which can lead to unexectedly closed
file descriptors in completely unrelated
proceses. For example:

func exists() bool {
// If some other thread execs here,
// we don't want to leak the fd, so
// open it O_CLOEXEC
fd := Open("/srv/foo", O_CLOEXEC)
if fd != -1 {
Close(fd)
return true
}
return false
}

would close the connection to any file descriptor
(maybe even for the root fs) in ALL other processes
that have it open if an exec were to happen(!),
which is quite undesriable.

As a result, 9front will be changing this behavior
for the next release.

Go is the only code observed so far that relies on
this behavior on purpose, and  It's easy to make the
code work with both semantics: simply using the file
descriptor that was opened with O_CEXEC instead of
throwing it away.

So we do that here.

Fixes #43524

Change-Id: I4887f5c934a5e63e5e6c1bb59878a325abc928d3
GitHub-Last-Rev: 96bb21bd1e8f64dc7e082a56928748a7d54c9272
GitHub-Pull-Request: golang/go#43533
Reviewed-on: https://go-review.googlesource.com/c/go/+/281833
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Richard Miller <millerresearch@gmail.com>
Reviewed-by: Jacob Moody <j4kem00dy@gmail.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>

3 years ago[dev.regabi] cmd/link: resolve symbol ABI in shared linkage
Cherry Zhang [Wed, 3 Feb 2021 20:07:33 +0000 (15:07 -0500)]
[dev.regabi] cmd/link: resolve symbol ABI in shared linkage

In shared build mode and linkage, currently we assume all
function symbols are ABI0 (except for generated type algorithm
functions), and alias them to ABIInternal. When the two ABIs
actually differ (as it is now), this is not actually correct.
This CL resolves symbol ABI based on their mangled names.
If the symbol's name has a ".abi0" or ".abiinternal" suffix, it
is of the corresponding ABI. The symbol without the suffix is
the other ABI. For functions without ABI wrapper generated,
only one ABI exists but we don't know what it is, so we still
use alias (for now).

Change-Id: I2165f149bc83d513e81eb1eb4ee95464335b0e75
Reviewed-on: https://go-review.googlesource.com/c/go/+/289289
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agodoc/go1.16: add missed heading tag in vet section
KimMachineGun [Fri, 5 Feb 2021 05:47:46 +0000 (05:47 +0000)]
doc/go1.16: add missed heading tag in vet section

Add missed heading tag in CL 276373.

For #40700

Change-Id: Ida9e8861589bbc296a5a1cecbf9fe33fa09ed0ca
GitHub-Last-Rev: d218f8d4b70b20c30422863db7bed3683e3218e6
GitHub-Pull-Request: golang/go#44111
Reviewed-on: https://go-review.googlesource.com/c/go/+/289869
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Tim King <taking@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

3 years agoembed, io/fs: clarify that leading and trailing slashes are disallowed
Jay Conrod [Fri, 5 Feb 2021 21:45:40 +0000 (16:45 -0500)]
embed, io/fs: clarify that leading and trailing slashes are disallowed

Fixes #44012

Change-Id: I5782cea301a65ae12ba870ff1e6b2e0a2651dc09
Reviewed-on: https://go-review.googlesource.com/c/go/+/290071
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

3 years agotesting/fstest: avoid symlink-induced failures in tester
Russ Cox [Fri, 5 Feb 2021 15:55:12 +0000 (10:55 -0500)]
testing/fstest: avoid symlink-induced failures in tester

Do not require directory entry and Stat result to match for symlinks,
because they won't (Stat dereferences the symlink).

Fixes #44113.

Change-Id: Ifc6dbce5719906e2f42254a7172f1ef787464a9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/290009
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years ago[dev.regabi] runtime: delete gosave function
Cherry Zhang [Thu, 4 Feb 2021 17:59:06 +0000 (12:59 -0500)]
[dev.regabi] runtime: delete gosave function

The runtime.gosave function is not used anywhere. Delete.

Note: there is also a gosave<> function, which is actually used
and not deleted.

Change-Id: I64149a7afdd217de26d1e6396233f2becfad7153
Reviewed-on: https://go-review.googlesource.com/c/go/+/289719
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] runtime: zero X15 in racecall
Cherry Zhang [Tue, 2 Feb 2021 23:25:39 +0000 (18:25 -0500)]
[dev.regabi] runtime: zero X15 in racecall

racecall can be called in ABIInternal context (e.g. raceread
calling racecalladdr calling racecall) without wrapper. racecall
calls C code, which doesn't preserve our special registers. Set
them explicitly in racecall upon returning from C.

Change-Id: Ic990479c1fca6bb8a3b151325c7a89be8331a530
Reviewed-on: https://go-review.googlesource.com/c/go/+/289709
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
3 years ago[dev.regabi] cmd/asm: define g register on AMD64
Cherry Zhang [Wed, 3 Feb 2021 17:09:53 +0000 (12:09 -0500)]
[dev.regabi] cmd/asm: define g register on AMD64

Define g register as R14 on AMD64. It is not used now, but will
be in later CLs.

The name "R14" is still recognized.

Change-Id: I9a066b15bf1051113db8c6640605e350cea397b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/289195
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] runtime: mark racecallbackthunk as ABIInternal
Cherry Zhang [Tue, 2 Feb 2021 23:09:03 +0000 (18:09 -0500)]
[dev.regabi] runtime: mark racecallbackthunk as ABIInternal

racecallbackthunk is called from C, and it needs to follow C ABI.
The assembly code preserves C callee-save registers. It must not
be called via wrappers, which may not preserve those registers.

Change-Id: Icd72c399f4424d73c4882860d85057fe2671f6aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/289194
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] runtime: don't mark rt0_go ABIInternal
Cherry Zhang [Wed, 3 Feb 2021 16:53:35 +0000 (11:53 -0500)]
[dev.regabi] runtime: don't mark rt0_go ABIInternal

rt0_go is not actually ABIInternal, and it actually has callers
(e.g. _rt0_amd64).

Change-Id: Id730176e620ad9f443e6bfca6ded81a1367531ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/289193
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] runtime/cgo: call setg_gcc in crosscall_amd64
Cherry Zhang [Tue, 2 Feb 2021 22:26:57 +0000 (17:26 -0500)]
[dev.regabi] runtime/cgo: call setg_gcc in crosscall_amd64

Currently, when using cgo, the g pointer is set via a separate
call to setg_gcc or with inline assembly in threadentry. This CL
changes it to call setg_gcc in crosscall_amd64, like other g-
register platforms. When we have an actual g register on AMD64,
we'll need to set the register immediately before calling into
Go.

Change-Id: Ib1171e05cd0dabba3b7d12e072084d141051cf3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/289192
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] go/types: report error for invalid main function signature
Rob Findley [Thu, 4 Feb 2021 16:16:25 +0000 (11:16 -0500)]
[dev.regabi] go/types: report error for invalid main function signature

This is a port of CL 279424, which didn't make it into master in time
for go1.16. Move it to dev.regabi so that it may be merged.

Notably, this port no longer removes the _InvalidInitSig error code,
instead opting to deprecate it. Now that error codes are 'locked in' for
go1.16, even if their API may not yet be exposed, we should follow the
practice of not changing their values. In the future, code generation
can make it easier to keep error code values constant.

For #43308

Change-Id: I5260b93fd063393d38d6458e45a67e7f9b7426ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/289714
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] cmd/internal/obj: access Attribute atomically
Cherry Zhang [Wed, 3 Feb 2021 23:10:04 +0000 (18:10 -0500)]
[dev.regabi] cmd/internal/obj: access Attribute atomically

Symbol's Attributes and ABI are in the same word. In the
concurrent backend, we may read one symbol's ABI (the callee)
while setting its attributes in another goroutine.

Fix racecompile build.

Change-Id: I500e869bafdd72080119ab243db94eee3afcf926
Reviewed-on: https://go-review.googlesource.com/c/go/+/289290
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years ago[dev.regabi] go/types: port check_test.go ergonomics from dev.typeparams
Rob Findley [Thu, 4 Feb 2021 16:06:15 +0000 (11:06 -0500)]
[dev.regabi] go/types: port check_test.go ergonomics from dev.typeparams

On the dev.typeparams and dev.go2go branches, check_test.go has been
updated to automatically discover test data. This is convenient, so port
it to dev.regabi.

Change-Id: I5da9a9a5139c35a2693e64364eb9928ece1cd7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/289713
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] go/types: no "declared but not used" errors for invalid var decls
Rob Findley [Thu, 4 Feb 2021 15:27:41 +0000 (10:27 -0500)]
[dev.regabi] go/types: no "declared but not used" errors for invalid var decls

This is a port of CL 274615, adapted to go/types. The only change was in
the positioning of expected errors in vardecl.src: in go/types they are
positioned on the identifier.

Change-Id: Iab03265a7c4287749373e4380c6db6a95f262f30
Reviewed-on: https://go-review.googlesource.com/c/go/+/289712
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agoruntime: fix typo in histogram.go
Ikko Ashimine [Thu, 4 Feb 2021 02:47:37 +0000 (02:47 +0000)]
runtime: fix typo in histogram.go

indicies -> indices

Change-Id: Ia50ae5918fc7a53c23590a94a18087a99bfd9bb7
GitHub-Last-Rev: 98eb724275fd61d5f5ce5dad6b1010c10f76906d
GitHub-Pull-Request: golang/go#44095
Reviewed-on: https://go-review.googlesource.com/c/go/+/289529
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>

3 years ago[dev.regabi] cmd/compile: reserve X15 as zero register on AMD64
Cherry Zhang [Fri, 29 Jan 2021 18:46:34 +0000 (13:46 -0500)]
[dev.regabi] cmd/compile: reserve X15 as zero register on AMD64

In ABIInternal, reserve X15 as constant zero, and use it to zero
memory. (Maybe there can be more use of it?)

The register is zeroed when transition to ABIInternal from ABI0.

Caveat: using X15 generates longer instructions than using X0.
Maybe we want to use X0?

Change-Id: I12d5ee92a01fc0b59dad4e5ab023ac71bc2a8b7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/288093
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
3 years ago[dev.regabi] runtime, syscall, etc.: mark Darwin syscall wrappers as ABIInternal
Cherry Zhang [Fri, 29 Jan 2021 17:03:32 +0000 (12:03 -0500)]
[dev.regabi] runtime, syscall, etc.: mark Darwin syscall wrappers as ABIInternal

Mark the syscall wrappers as ABIInternal, as they have addresses
taken from Go code, and it is important to call to them without
wrappers.

Previously, the wrapper is just a single JMP instruction, which
makes it not matter. In the next CL we'll make the wrapper
actually have a frame. The real wrappers will mess up things
such as stack alignment for C ABI.

This doesn't look really nice, but I don't know how we can do
better...

TODO: other OSes.

Change-Id: Ifb3920494990a7775e3e6902fbcaf137df3cc653
Reviewed-on: https://go-review.googlesource.com/c/go/+/288092
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agomath/big: fix comment in divRecursiveStep
Katie Hockman [Wed, 27 Jan 2021 15:33:35 +0000 (10:33 -0500)]
math/big: fix comment in divRecursiveStep

There appears to be a typo in the description of
the recursive division algorithm.

Two things seem suspicious with the original comment:
  1. It is talking about choosing s, but s doesn't
     appear anywhere in the equation.
  2. The math in the equation is incorrect.

Where
  B = len(v)/2
  s = B - 1

Proof that it is incorrect:
    len(v) - B >= B + 1
    len(v) - len(v)/2 >= len(v)/2 + 1

    This doesn't hold if len(v) is even, e.g. 10:
    10 - 10/2 >= 10/2 + 1
    10 - 5 >= 5 + 1
    5 >= 6  // this is false

The new equation will be the following,
which will be mathematically correct:
    len(v) - s >= B + 1
    len(v) - (len(v)/2 - 1) >= len(v)/2 + 1
    len(v) - len(v)/2 + 1 >= len(v)/2 + 1
    len(v) - len(v)/2 >= len(v)/2

    This holds if len(v) is even or odd.

    e.g. 10
    10 - 10/2 >= 10/2
    10 - 5 >= 5
    5 >= 5

    e.g. 11
    11 - 11/2 >= 11/2
    11 - 5 >= 5
    6 >= 5

Change-Id: If77ce09286cf7038637b5dfd0fb7d4f828023f56
Reviewed-on: https://go-review.googlesource.com/c/go/+/287372
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>

3 years ago[dev.regabi] all: merge master (fca94ab) into dev.regabi
Robert Griesemer [Tue, 2 Feb 2021 18:27:02 +0000 (10:27 -0800)]
[dev.regabi] all: merge master (fca94ab) into dev.regabi

Conflicts:

- src/syscall/mksyscall.pl

Merge List:

+ 2021-02-02 fca94ab3ab spec: improve the example in Type assertions section
+ 2021-02-02 98f8454a73 cmd/link: don't decode type symbol in shared library in deadcode
+ 2021-02-02 1426a571b7 cmd/link: fix off-by-1 error in findShlibSection
+ 2021-02-01 32e789f4fb test: fix incorrectly laid out instructions in issue11656.go
+ 2021-02-01 0b6cfea634 doc/go1.16: document that on OpenBSD syscalls are now made through libc
+ 2021-02-01 26e29aa15a cmd/link: disable TestPIESize if CGO isn't enabled
+ 2021-02-01 6ac91e460c doc/go1.16: minor markup fixes
+ 2021-01-29 44361140c0 embed: update docs for proposal tweaks
+ 2021-01-29 68058edc39 runtime: document pointer write atomicity for memclrNoHeapPointers
+ 2021-01-28 c8bd8010ff syscall: generate readlen/writelen for openbsd libc
+ 2021-01-28 41bb49b878 cmd/go: revert TestScript/build_trimpath to use ioutil.ReadFile
+ 2021-01-28 725a642c2d runtime: correct syscall10/syscall10X on openbsd/amd64
+ 2021-01-28 4b068cafb5 doc/go1.16: document go/build/constraint package
+ 2021-01-28 376518d77f runtime,syscall: convert syscall on openbsd/arm64 to libc
+ 2021-01-27 00f2ff5c94 api/go1.16: add go/build/constraint APIs
+ 2021-01-27 35334caf18 crypto/x509: remove leftover CertificateRequest field
+ 2021-01-27 a5a5e2c968 runtime: make sure to remove open-coded defer entries in all cases after a recover
+ 2021-01-27 8cfa01943a runtime: block console ctrlhandler when the signal is handled
+ 2021-01-27 ff9e8364c6 cmd/go: skip issue33139 when the 'cc' script command is unavailable
+ 2021-01-27 cd176b3615 runtime: switch runtime to libc for openbsd/arm64
+ 2021-01-27 6c8fbfbdcf runtime: convert openbsd/arm64 locking to libc
+ 2021-01-27 5cdf0da1bf syscall: clean up mkasm related changes
+ 2021-01-27 210f70e298 doc/go1.16: fix closing brace in .Export format
+ 2021-01-27 0f797f168d math: fix typo in sqrt.go code comment
+ 2021-01-26 8634a234df runtime,syscall: convert syscall on openbsd/amd64 to libc
+ 2021-01-26 1d5e14632e os: further document limitations around naked file descriptors
+ 2021-01-26 cf263e9f77 os: correct names in CreateTemp and MkdirTemp doc comments
+ 2021-01-26 ce8b318624 net/http/fcgi: remove locking added to prevent a test-only race

Change-Id: I9e89df040dfbbeb50f4ce653a8da437cb72b3ef9

3 years agospec: improve the example in Type assertions section
task4233 [Tue, 2 Feb 2021 03:54:24 +0000 (03:54 +0000)]
spec: improve the example in Type assertions section

The example, var v, ok T1 = x.(T), can be interpreted as type T1 interface{} or type T = bool; type T1 = T.
Separating the example would help understanding for readers.

Change-Id: I179f4564e67f4d503815d29307df2cebb50c82f9
GitHub-Last-Rev: b34fffb6bb07cb2883bc313ef3bc9980b3dd4abe
GitHub-Pull-Request: golang/go#44040
Reviewed-on: https://go-review.googlesource.com/c/go/+/288472
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>

3 years agocmd/link: don't decode type symbol in shared library in deadcode
Cherry Zhang [Mon, 1 Feb 2021 18:36:50 +0000 (13:36 -0500)]
cmd/link: don't decode type symbol in shared library in deadcode

In the linker's deadcode pass we decode type symbols for
interface satisfaction analysis. When linking against Go shared
libraries, the type symbol may come from a shared library, so it
doesn't have data in the current module being linked, so we cannot
decode it. We already have code to skip DYNIMPORT symbols. However,
this doesn't actually work, because at that point the type symbols'
names haven't been mangled, whereas they may be mangled in the
shared library. So the symbol definition (in shared library) and
reference (in current module) haven't been connected.

Skip decoding type symbols of type Sxxx (along with DYNIMPORT)
when linkShared.

Note: we cannot skip all type symbols, as we still need to mark
unexported methods defined in the current module.

Fixes #44031.

Change-Id: I833d19a060c94edbd6fc448172358f9a7d760657
Reviewed-on: https://go-review.googlesource.com/c/go/+/288496
Trust: Cherry Zhang <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agocmd/link: fix off-by-1 error in findShlibSection
Cherry Zhang [Mon, 1 Feb 2021 21:46:49 +0000 (16:46 -0500)]
cmd/link: fix off-by-1 error in findShlibSection

We want to find a section that contains addr. sect.Addr+sect.Size
is the exclusive upper bound.

Change-Id: If2cd6bdd6e03174680e066189b0f4bf9e2ba6630
Reviewed-on: https://go-review.googlesource.com/c/go/+/288592
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agotest: fix incorrectly laid out instructions in issue11656.go
Tom Thorogood [Mon, 1 Feb 2021 03:02:18 +0000 (13:32 +1030)]
test: fix incorrectly laid out instructions in issue11656.go

CL 279423 introduced a regression in this test as it incorrectly laid
out various instructions. In the case of arm, the second instruction
was overwriting the first. In the case of 386, amd64 and s390x, the
instructions were being appended to the end of the slice after 64
zero bytes.

This was causing test failures on "linux/s390x on z13".

Fixes #44028

Change-Id: Id136212dabdae27db7e91904b0df6a3a9d2f4af4
Reviewed-on: https://go-review.googlesource.com/c/go/+/288278
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years ago[dev.regabi] test: add a test for inlining closures
Dan Scales [Sun, 31 Jan 2021 18:05:03 +0000 (10:05 -0800)]
[dev.regabi] test: add a test for inlining closures

Add a test case for issue 43818. We don't want to mark as inlinable a
function with a closure that has an operation (such as OSELRECV2) that
we don't currently support for exporting. This test case fails to
compile without the fix for #43818.

Updates #43818

Change-Id: Ief322a14aefaefc6913c40a6b8505214bd622fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/288392
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>

3 years agodoc/go1.16: document that on OpenBSD syscalls are now made through libc
Cherry Zhang [Thu, 28 Jan 2021 17:19:49 +0000 (12:19 -0500)]
doc/go1.16: document that on OpenBSD syscalls are now made through libc

Updates #36435, #40700.

Change-Id: I1e2ded111ad58066cc9f2c9d00e719497b0f34d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/287634
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
3 years agocmd/link: disable TestPIESize if CGO isn't enabled
Nehal J Wani [Tue, 26 Jan 2021 16:29:05 +0000 (16:29 +0000)]
cmd/link: disable TestPIESize if CGO isn't enabled

With CGO disabled, the test throws the following error:

elf_test.go:291: # command-line-arguments
    loadinternal: cannot find runtime/cgo

Change-Id: Iaeb183562ab637c714240b49e73078bdb791b35b
GitHub-Last-Rev: f8fe9afad5611411966413d17cb5874f7b0018a0
GitHub-Pull-Request: golang/go#43911
Reviewed-on: https://go-review.googlesource.com/c/go/+/286632
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>

3 years agodoc/go1.16: minor markup fixes
Toshihiro Shiino [Sun, 31 Jan 2021 12:42:44 +0000 (12:42 +0000)]
doc/go1.16: minor markup fixes

Add missing <code> tags.
Remove unnecessary <br> tag.

For #40700

Change-Id: I03d3ce1c89a9ae3d3195dcd2bb8b1a61f011e1ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/288275
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
3 years agoembed: update docs for proposal tweaks
Ian Lance Taylor [Fri, 29 Jan 2021 18:25:34 +0000 (10:25 -0800)]
embed: update docs for proposal tweaks

//go:embed variables can be type aliases.

//go:embed variables can't be local to a function.

For #43216
For #43602
Fixes #43978

Change-Id: Ib1d104dfa32b97c91d8bfc5ed5d461ca14da188f
Reviewed-on: https://go-review.googlesource.com/c/go/+/288072
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
3 years agoruntime: document pointer write atomicity for memclrNoHeapPointers
Cherry Zhang [Thu, 28 Jan 2021 19:57:55 +0000 (14:57 -0500)]
runtime: document pointer write atomicity for memclrNoHeapPointers

memclrNoHeapPointers is the underlying implementation of
typedmemclr and memclrHasPointers, so it still needs to write
pointer-aligned words atomically. Document this requirement.

Updates #41428.

Change-Id: Ice00dee5de7a96a50e51ff019fcef069e8a8406a
Reviewed-on: https://go-review.googlesource.com/c/go/+/287692
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agosyscall: generate readlen/writelen for openbsd libc
Joel Sing [Thu, 28 Jan 2021 08:19:47 +0000 (19:19 +1100)]
syscall: generate readlen/writelen for openbsd libc

Rather than hand rolling readlen and writelen, move it to being generated
via mksyscall.pl, as is done for most other functions.

Updates #36435

Change-Id: I649aed7b182b41c8639686feae25ce19dab812c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/287532
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agocmd/go: revert TestScript/build_trimpath to use ioutil.ReadFile
Bryan C. Mills [Thu, 28 Jan 2021 16:14:23 +0000 (11:14 -0500)]
cmd/go: revert TestScript/build_trimpath to use ioutil.ReadFile

This call was changed to os.ReadFile in CL 266365, but the test also
builds that source file using gccgo if present, and released versions
of gccgo do not yet support ioutil.ReadFile.

Manually tested with gccgo gccgo 10.2.1 (see #35786).

Fixes #43974.
Updates #42026.

Change-Id: Ic4ca0848d3ca324e2ab10fd14ad867f21e0898e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/287613
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoruntime: correct syscall10/syscall10X on openbsd/amd64
Joel Sing [Wed, 27 Jan 2021 12:09:57 +0000 (23:09 +1100)]
runtime: correct syscall10/syscall10X on openbsd/amd64

The syscall10/syscall10X implementation uses an incorrect stack offset for
arguments a7 to a10. Correct this so that the syscall arguments work as
intended.

Updates #36435
Fixes #43927

Change-Id: Ia7ae6cc8c89f50acfd951c0f271f3b3309934499
Reviewed-on: https://go-review.googlesource.com/c/go/+/287252
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agodoc/go1.16: document go/build/constraint package
Ian Lance Taylor [Wed, 27 Jan 2021 21:54:10 +0000 (13:54 -0800)]
doc/go1.16: document go/build/constraint package

For #40700
For #41184
Fixes #43957

Change-Id: Ia346f4cf160431b721efeba7dc5f1fb8814efd95
Reviewed-on: https://go-review.googlesource.com/c/go/+/287472
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agoruntime,syscall: convert syscall on openbsd/arm64 to libc
Joel Sing [Tue, 26 Jan 2021 14:48:47 +0000 (01:48 +1100)]
runtime,syscall: convert syscall on openbsd/arm64 to libc

Convert the syscall package on openbsd/arm64 to use libc rather than performing
direct system calls.

Updates #36435

Change-Id: I7e1da8537cea9ed9bf2676f181e56ae99383333f
Reviewed-on: https://go-review.googlesource.com/c/go/+/286815
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years ago[dev.regabi] cmd/compile: remove nested functions from expands_calls.go
David Chase [Wed, 27 Jan 2021 00:33:34 +0000 (19:33 -0500)]
[dev.regabi] cmd/compile: remove nested functions from expands_calls.go

Replace nested function spaghetti with state object and methods.
Still somewhat complex, but a bit more explicit.

Change-Id: I21987c8e4be75821faa5a248af05d2095cdfb0d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/287132
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years ago[dev.regabi] cmd/go: Use GOMAXPROCS to limit default build, compile parallelism
David Chase [Wed, 14 Oct 2020 17:05:33 +0000 (13:05 -0400)]
[dev.regabi] cmd/go: Use GOMAXPROCS to limit default build, compile parallelism

When people want deterministic/single-process builds, they probably
assume that GOMAXPROCS=1 will do that.  It currently does not,
neither for build parallelism nor for compiler internal parallelism.
(Current incantation for that is "go build -p=1 -gcflags=all=-c=1 ... ")

This CL makes
  "GOMAXPROCS=1 go build ..."
behave like
  "go build -p=1 -gcflags=all=-c=1 ... "

RELNOTE=yes

Change-Id: I9cfe50b7deee7334d2f1057b58385f6c98547b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/284695
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
3 years agoapi/go1.16: add go/build/constraint APIs
Alexander Rakoczy [Wed, 27 Jan 2021 20:26:02 +0000 (15:26 -0500)]
api/go1.16: add go/build/constraint APIs

These APIs were added in CL 240604 as part of an approved proposal. It
was submitted after the initial api/go1.16.txt creation.

For #41184
For #43407

Change-Id: Ifb54df2b61c554c32bd9d17afbb74f4e42e0b228
Reviewed-on: https://go-review.googlesource.com/c/go/+/287412
Trust: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agocrypto/x509: remove leftover CertificateRequest field
Roland Shoemaker [Wed, 27 Jan 2021 20:00:46 +0000 (12:00 -0800)]
crypto/x509: remove leftover CertificateRequest field

Removes the KeyUsage field that was missed in the rollback in
CL 281235.
Also updates CreateCertificateRequest to reflect that these fields
were removed.

For #43407.
Updates #43477.
Updates #37172.

Change-Id: I6244aed4a3ef3c2460c38af5511e5c2e82546179
Reviewed-on: https://go-review.googlesource.com/c/go/+/287392
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoruntime: make sure to remove open-coded defer entries in all cases after a recover
Dan Scales [Tue, 26 Jan 2021 01:51:03 +0000 (17:51 -0800)]
runtime: make sure to remove open-coded defer entries in all cases after a recover

We add entries to the defer list at panic/goexit time on-the-fly for
frames with open-coded defers. We do this so that we can correctly
process open-coded defers and non-open-coded defers in the correct order
during panics/goexits. But we need to remove entries for open-coded
defers from the defer list when there is a recover, since those entries
may never get removed otherwise and will get stale, since their
corresponding defers may now be processed normally (inline).

This bug here is that we were only removing higher-up stale entries
during a recover if all defers in the current frame were done. But we
could have more defers in the current frame (as the new test case
shows). In this case, we need to leave the current defer entry around
for use by deferreturn, but still remove any stale entries further along
the chain.

For bug 43921, simple change that we should abort the removal loop for
any defer entry that is started (i.e. in process by a still
not-recovered outer panic), even if it is not an open-coded defer.

This change does not fix bug 43920, which looks to be a more complex fix.

Fixes #43882
Fixes #43921

Change-Id: Ie05b2fa26973aa26b25c8899a2abc916090ee4f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/286712
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>

3 years agoruntime: block console ctrlhandler when the signal is handled
Nuno Cruces [Wed, 27 Jan 2021 19:02:37 +0000 (19:02 +0000)]
runtime: block console ctrlhandler when the signal is handled

Fixes #41884

I can confirm this change fixes my issue.
I can't confirm that this doesn't break any and everything else.
I see that this code has been tweaked repeatedly, so I would really welcome guidance into further testing.

Change-Id: I1986dd0c2f30cfe10257f0d8c658988d6986f7a6
GitHub-Last-Rev: 92f02c96973e12f1472511bcf3c5ebb36c6b0440
GitHub-Pull-Request: golang/go#41886
Reviewed-on: https://go-review.googlesource.com/c/go/+/261057
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>

3 years agocmd/go: skip issue33139 when the 'cc' script command is unavailable
Nehal J Wani [Wed, 27 Jan 2021 16:24:14 +0000 (16:24 +0000)]
cmd/go: skip issue33139 when the 'cc' script command is unavailable

With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: https://github.com/golang/go/issues/8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: https://github.com/golang/go/issues/36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

CC was set to /dev/null (during build) in the scenario mentioned above

This patch replaces [!exec:cc] with [!cgo] because we care about the
availability of the 'cc' builtin and not the 'cc' executable in $PATH

Change-Id: Ifbd2441f5f8e903ca3da213aba76f44c2e2eebab
GitHub-Last-Rev: 3b743787d08502f7a936e800ee7b6909fcf56068
GitHub-Pull-Request: golang/go#43912
Reviewed-on: https://go-review.googlesource.com/c/go/+/286633
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years agoruntime: switch runtime to libc for openbsd/arm64
Joel Sing [Tue, 26 Jan 2021 12:06:51 +0000 (23:06 +1100)]
runtime: switch runtime to libc for openbsd/arm64

Use libc rather than performing direct system calls for the runtime on
openbsd/arm64.

Updates #36435

Change-Id: I8bd41dfec16209f2b9a83dda24b9a1e4b06757c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/286814
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agoruntime: convert openbsd/arm64 locking to libc
Joel Sing [Tue, 26 Jan 2021 06:52:19 +0000 (17:52 +1100)]
runtime: convert openbsd/arm64 locking to libc

Switch openbsd/arm64 to locking via libc, rather than performing direct
system calls.

Update #36435

Change-Id: I2f30432c4bc232224cf87dca750665b8c40c7b72
Reviewed-on: https://go-review.googlesource.com/c/go/+/286813
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agosyscall: clean up mkasm related changes
Joel Sing [Tue, 26 Jan 2021 14:00:05 +0000 (01:00 +1100)]
syscall: clean up mkasm related changes

The mkasm_darwin.go file was renamed to mkasm.go in CL 270380, with OpenBSD
support being added. The mkasm_openbsd.go file should not have been merged,
so remove it. Fix up references to mkasm_$GOOS.go and provide $GOOS as an
argument on invocation.

Updates #36435

Change-Id: I868d3f2146973d026e6a663d437749dbb6b312ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/286812
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agodoc/go1.16: fix closing brace in .Export format
Ryuji Iwata [Tue, 26 Jan 2021 12:53:08 +0000 (12:53 +0000)]
doc/go1.16: fix closing brace in .Export format

A parenthesis of go list "-f" flag format is double curly braces.

Change-Id: Ifd38e0b0ae3c46272a4acd65584818228168b7c6
GitHub-Last-Rev: b46030492b5caf18fe127621fdf92cbec4c03ad5
GitHub-Pull-Request: golang/go#43924
Reviewed-on: https://go-review.googlesource.com/c/go/+/286752
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>

3 years agomath: fix typo in sqrt.go code comment
Paul Davis [Tue, 26 Jan 2021 23:29:47 +0000 (23:29 +0000)]
math: fix typo in sqrt.go code comment

"it does not necessary" -> "it is not necessary"

Change-Id: I66f9cf2670d76b3686badb4a537b3ec084447d62
GitHub-Last-Rev: 52a0f9993abf25369cdb6b31eaf476df1626cf87
GitHub-Pull-Request: golang/go#43935
Reviewed-on: https://go-review.googlesource.com/c/go/+/287052
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>

3 years ago[dev.regabi] cmd/compile: missing last patch set for cl286013
David Chase [Tue, 26 Jan 2021 19:04:02 +0000 (14:04 -0500)]
[dev.regabi] cmd/compile: missing last patch set for cl286013

Forgot to mail last patch set before committing, repair that.

Change-Id: I1ef72d0d7df56e89369e6fb4d6e5690f254e6aa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/286912
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years ago[dev.regabi] cmd/compile: remove leftover code form late call lowering work
David Chase [Sat, 23 Jan 2021 03:53:47 +0000 (22:53 -0500)]
[dev.regabi] cmd/compile: remove leftover code form late call lowering work

It's no longer conditional.

Change-Id: I697bb0e9ffe9644ec4d2766f7e8be8b82d3b0638
Reviewed-on: https://go-review.googlesource.com/c/go/+/286013
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agoruntime,syscall: convert syscall on openbsd/amd64 to libc
Joel Sing [Sun, 15 Nov 2020 17:47:56 +0000 (04:47 +1100)]
runtime,syscall: convert syscall on openbsd/amd64 to libc

Convert the syscall package on openbsd/amd64 to use libc rather than performing
direct system calls.

Updates #36435

Change-Id: Ieb5926a91ed34f7c722e3667004ec484c86804ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/270380
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoos: further document limitations around naked file descriptors
Victor Michel [Sun, 24 Jan 2021 05:53:36 +0000 (05:53 +0000)]
os: further document limitations around naked file descriptors

NewFile requires the file descriptor to be either closed
through the returned File instance, or to stay valid at least
until the finalizer runs during garbage collection.

These requirements are easily violated when file descriptors
are closed via unix.Close, or when the *File returned by
NewFile is garbage collected while the underlying file descriptor is
still in use.

This commit adds further documentation for NewFile and Fd, making it
explicit that using naked file descriptors is subject to constraints
due to garbage collection of File objects.

Fixes #43863

Change-Id: I49ea1f0054eb2d2a72b616450c8e83476f4d07fb
GitHub-Last-Rev: 180d0130ae9009456914fb265b4bafa0e599de0e
GitHub-Pull-Request: golang/go#43867
Reviewed-on: https://go-review.googlesource.com/c/go/+/286032
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
3 years ago[dev.regabi] all: merge master (bf0f7c9) into dev.regabi
Matthew Dempsky [Tue, 26 Jan 2021 00:14:12 +0000 (16:14 -0800)]
[dev.regabi] all: merge master (bf0f7c9) into dev.regabi

This merge involved two merge conflicts:

1. walk's ascompatee code has been substantially refactored on
dev.regabi, so CL 285633 is ported to the new style.

2. The os.TestDirFS workaround added in CL 286213 can be removed now
that #42637 has been fixed by CL 285720.

Conflicts:

- src/cmd/compile/internal/gc/walk.go
- src/os/os_test.go

Merge List:

+ 2021-01-25 bf0f7c9d78 doc/go1.16: mention os.DirFS in os section
+ 2021-01-25 deaf29a8a8 cmd/compile: fix order-of-assignment issue w/ defers
+ 2021-01-25 ad2ca26a52 doc/go1.16: mention os.DirEntry and types moved from os to io/fs
+ 2021-01-25 a51921fa5b doc/go1.16: mention new testing/iotest functions
+ 2021-01-25 e6b6d107f7 doc/go1.16: mention deprecation of io/ioutil
+ 2021-01-25 96a276363b doc/go1.16: mention go/build changes
+ 2021-01-25 3d85c69a0b html/template: revert "avoid race when escaping updates template"
+ 2021-01-25 54514c6b28 cmd/go: fix TestScript/cgo_path, cgo_path_space when CC set
+ 2021-01-25 6de8443f3b doc/asm: add a section on go_asm.h, clean up go_tls.h section
+ 2021-01-25 54b251f542 lib/time, time/tzdata: update tzdata to 2021a
+ 2021-01-25 ff82cc971a os: force consistent mtime before running fstest on directory on Windows
+ 2021-01-25 044f937a73 doc/go1.16: fix WalkDir and Walk links
+ 2021-01-23 b634f5d97a doc/go1.16: add crypto/x509 memory optimization
+ 2021-01-23 9897655c61 doc/go1.16: reword ambiguously parsable sentence
+ 2021-01-23 cd99385ff4 cmd/internal/obj/arm64: fix VMOVQ instruction encoding error
+ 2021-01-23 66ee8b158f runtime: restore cgo_import_dynamic for libc.so on openbsd
+ 2021-01-22 25c39e4fb5 io/ioutil: fix example test for WriteFile to allow it to run in the playground
+ 2021-01-22 eb21b31e48 runtime: define dummy msanmove
+ 2021-01-22 3a778ff50f runtime: check for g0 stack last in signal handler
+ 2021-01-22 a2cef9b544 cmd/go: don't lookup the path for CC when invoking cgo

Change-Id: I651949f9eb18b57e3c996c4f3b2b3bf458bc5d97

3 years agoos: correct names in CreateTemp and MkdirTemp doc comments
Ian Lance Taylor [Fri, 22 Jan 2021 00:13:35 +0000 (16:13 -0800)]
os: correct names in CreateTemp and MkdirTemp doc comments

For #42026

Change-Id: I51e3ce9d3a4729cfac44bd3ff3f3ec80dcd5abb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/285376
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agonet/http/fcgi: remove locking added to prevent a test-only race
Hilko Bengen [Mon, 25 Jan 2021 22:54:20 +0000 (22:54 +0000)]
net/http/fcgi: remove locking added to prevent a test-only race

The race reported in issue #41167 was detected only because the
ReadWriter used in test code happened to be a bytes.Buffer whose
Read and Write operate (unsafely) on shared state. This is not the
case in any realistic scenario where the FastCGI protocol is spoken
over sockets or pairs of pipes.

Since tests that use nopWriteCloser don't care about any output
generate by child.Serve(), we change nopWriteCloser to provide
a dummy Write method.

Remove the locking added in CL 252417, since it causes a deadlock
during write as reported in #43901. The race in tests no longer
happens thanks to the aforementioned change to nopWriteCloser.

Fixes #43901.
Updates #41167.

Change-Id: I8cf31088a71253c34056698f8e2ad0bee9fcf6c6
GitHub-Last-Rev: b06d8377fdada075775d79a20577d38a7c471b45
GitHub-Pull-Request: golang/go#43027
Reviewed-on: https://go-review.googlesource.com/c/go/+/275692
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

3 years agodoc/go1.16: mention os.DirFS in os section
Ian Lance Taylor [Fri, 22 Jan 2021 01:58:17 +0000 (17:58 -0800)]
doc/go1.16: mention os.DirFS in os section

For #40700
For #41190

Change-Id: I8ade6efd5be09003fc3e5db5a9b91ba6e0f023f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/285593
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agocmd/compile: fix order-of-assignment issue w/ defers
Matthew Dempsky [Fri, 22 Jan 2021 03:27:12 +0000 (19:27 -0800)]
cmd/compile: fix order-of-assignment issue w/ defers

CL 261677 fixed a logic issue in walk's alias detection, where it was
checking the RHS expression instead of the LHS expression when trying
to determine the kind of assignment. However, correcting this exposed
a latent issue with assigning to result parameters in functions with
defers, where an assignment could become visible earlier than intended
if a later expression could panic.

Fixes #43835.

Change-Id: I061ced125e3896e26d65f45b28c99db2c8a74a8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/285633
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>

3 years agodoc/go1.16: mention os.DirEntry and types moved from os to io/fs
Ian Lance Taylor [Fri, 22 Jan 2021 01:29:36 +0000 (17:29 -0800)]
doc/go1.16: mention os.DirEntry and types moved from os to io/fs

For #40700
For #41467
For #41190

Change-Id: Id94e7511c98c38a22b1f9a55af6e200c9df07fd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/285592
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agodoc/go1.16: mention new testing/iotest functions
Ian Lance Taylor [Fri, 22 Jan 2021 06:47:18 +0000 (22:47 -0800)]
doc/go1.16: mention new testing/iotest functions

For #38781
For #40700
For #41190

Change-Id: I72f1055e51edb517041d3861640734ba6ef5f342
Reviewed-on: https://go-review.googlesource.com/c/go/+/285673
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agodoc/go1.16: mention deprecation of io/ioutil
Ian Lance Taylor [Fri, 22 Jan 2021 00:23:18 +0000 (16:23 -0800)]
doc/go1.16: mention deprecation of io/ioutil

For #40025
For #40700
For #42026

Change-Id: Ib51b5e1398c4eb811506df21e3bd56dd84bd1f7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/285377
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years ago[dev.regabi] cmd/compile: disallow taking address of SSA'd values
Matthew Dempsky [Mon, 25 Jan 2021 22:14:10 +0000 (14:14 -0800)]
[dev.regabi] cmd/compile: disallow taking address of SSA'd values

Adds some extra validation that the frontend is setting flags like
Addrtaken correctly.

Change-Id: Iffde83e32ba1c4c917ab8cb3fe410a4f623cf635
Reviewed-on: https://go-review.googlesource.com/c/go/+/286434
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agodoc/go1.16: mention go/build changes
Ian Lance Taylor [Thu, 21 Jan 2021 04:41:16 +0000 (20:41 -0800)]
doc/go1.16: mention go/build changes

For #40070
For #41191
For #43469
For #43632

Change-Id: I6dc6b6ea0f35876a4c252e4e287a0280aca9d502
Reviewed-on: https://go-review.googlesource.com/c/go/+/285213
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agohtml/template: revert "avoid race when escaping updates template"
Ian Lance Taylor [Fri, 22 Jan 2021 22:54:23 +0000 (14:54 -0800)]
html/template: revert "avoid race when escaping updates template"

This reverts CLs 274450 and 279492, except for the new tests.
The new race test is changed to skip, as it now fails.
We can try again for 1.17.

Original CL descriptions:

    html/template: attach functions to namespace

    The text/template functions are stored in a data structure shared by
    all related templates, so do the same with the original, unwrapped,
    functions on the html/template side.

    html/template: avoid race when escaping updates template

For #39807
Fixes #43855

Change-Id: I2ce91321ada06ea496a982aefe170eb5af9ba847
Reviewed-on: https://go-review.googlesource.com/c/go/+/285957
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
3 years agocmd/go: fix TestScript/cgo_path, cgo_path_space when CC set
Jay Conrod [Mon, 25 Jan 2021 15:34:28 +0000 (10:34 -0500)]
cmd/go: fix TestScript/cgo_path, cgo_path_space when CC set

These tests failed if CC was set to a path containing a separator
during make.bash. They now set CC explicitly.

Fixes #43897

Change-Id: Ic6e7f192fcb363f0ac9f45b329113255453bf76f
Reviewed-on: https://go-review.googlesource.com/c/go/+/286292
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 years ago[dev.regabi] cmd/compile/internal: specify memory layout
Austin Clements [Sat, 23 Jan 2021 21:58:34 +0000 (16:58 -0500)]
[dev.regabi] cmd/compile/internal: specify memory layout

This CL expands internal-abi.md to cover Go's memory layout rules and
then uses this to specify the calling convention more precisely.

Change-Id: Ifeef9e49d9ccc8c7333dec81bdd47b511b028469
Reviewed-on: https://go-review.googlesource.com/c/go/+/286073
Trust: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years ago[dev.regabi] cmd/compile/internal: add internal ABI specification
Austin Clements [Thu, 21 Jan 2021 15:19:21 +0000 (10:19 -0500)]
[dev.regabi] cmd/compile/internal: add internal ABI specification

This adds a document specifying the internal ABI (specifically the
calling convention). This document lives in the Go tree (rather than
the proposal repository) because the intent is for it to track the
reality in the compiler.

Updates #40724.

Change-Id: I583190080cd7d8cb1084f616fd1384d0f1f25725
Reviewed-on: https://go-review.googlesource.com/c/go/+/285292
Trust: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
3 years agodoc/asm: add a section on go_asm.h, clean up go_tls.h section
Austin Clements [Fri, 22 Jan 2021 15:58:12 +0000 (10:58 -0500)]
doc/asm: add a section on go_asm.h, clean up go_tls.h section

Currently the only mention of go_asm.h is buried in a confusing
section about the runtime-specific go_tls.h header. We actually want
people to use go_asm.h, so this CL adds a section with a proper
discussion of this header. As part of this, we remove the discussion
of go_asm.h from the go_tls.h section and clean up what remains.

I stumbled on this when working on the internal ABI specification. I
wanted to refer to stable documentation on how to access struct fields
from assembly and found there was none.

Change-Id: I0d53741e7685e65794611939e76285f7c82e1d65
Reviewed-on: https://go-review.googlesource.com/c/go/+/286052
Trust: Austin Clements <austin@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years ago[dev.regabi] cmd/compile: enable rational constant arithmetic
Matthew Dempsky [Mon, 25 Jan 2021 07:39:16 +0000 (23:39 -0800)]
[dev.regabi] cmd/compile: enable rational constant arithmetic

This allows more precision and matches types2's behavior.

For backwards compatibility with gcimporter, for now we still need to
write out declared constants as limited-precision floating-point
values. To ensure consistent behavior of constant arithmetic whether
it spans package boundaries or not, we include the full-precision
rational representation in the compiler's extension section of the
export data.

Also, this CL simply uses the math/big.Rat.String text representation
as the encoding. This is inefficient, but because it's only in the
compiler's extension section, we can easily revisit this in the
future.

Declaring exported untyped float and complex constants isn't very
common anyway. Within the standard library, only package math declares
any at all, containing just 15. And those 15 are only imported a total
of 12 times elsewhere in the standard library.

Change-Id: I85ea23ab712e93fd3b68e52d60cbedce9be696a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/286215
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] os: disable TestDirFS until #42637 is fixed
Matthew Dempsky [Mon, 25 Jan 2021 05:26:14 +0000 (21:26 -0800)]
[dev.regabi] os: disable TestDirFS until #42637 is fixed

This test is causing nearly every trybot run on dev.regabi and
dev.typeparams to fail. It's already a release blocker for Go 1.16, so
the failures on the development branches is entirely noise; and
because it causes the trybots to short-circuit, it risks masking
actual Windows-specific failures.

This CL disables the test until a proper solution is decided upon and
implemented for Go 1.16.

Updates #42637.

Change-Id: Ibc85edaed591f1c125cf0b210867aa89d2b0a4b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/286213
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years ago[dev.regabi] cmd/go: workaround -race issue on ppc64le
Matthew Dempsky [Sun, 24 Jan 2021 20:26:47 +0000 (12:26 -0800)]
[dev.regabi] cmd/go: workaround -race issue on ppc64le

The race detector on ppc64le corrupts command-line arguments lists if
they contain an empty string, and cmd/go often generates compiler
argument lists containing `-D ""`. Since this is equivalent to not
specifying the `-D` flag at all, just do that. This allows using a
race-detector-enabled cmd/compile on ppc64le.

Updates #43883.

Change-Id: Ifac5cd9a44932129438b9b0b3ecc6101ad3716b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/286173
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agolib/time, time/tzdata: update tzdata to 2021a
Tobias Klauser [Mon, 25 Jan 2021 11:31:54 +0000 (12:31 +0100)]
lib/time, time/tzdata: update tzdata to 2021a

Changelog:

  South Sudan changes from +03 to +02 on 2021-02-01 at 00:00.

Release announcement:

  http://mm.icann.org/pipermail/tz-announce/2021-January/000065.html

Updates #22487

Change-Id: Ia0a1a7a8f5d47adac9782bc2a445f69e02440f77
Reviewed-on: https://go-review.googlesource.com/c/go/+/285719
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
3 years ago[dev.regabi] cmd/compile: modify abiutils for recently updated ABI
David Chase [Thu, 21 Jan 2021 17:02:39 +0000 (12:02 -0500)]
[dev.regabi] cmd/compile: modify abiutils for recently updated ABI

Discovered difficluties posed by earlier design, these modifications
should work better.  Updated tests, also added some helper functions
for use in call lowering.

Change-Id: I459f0f71ad8a6730c571244925c3f395e1df28de
Reviewed-on: https://go-review.googlesource.com/c/go/+/285392
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
3 years agoos: force consistent mtime before running fstest on directory on Windows
Jason A. Donenfeld [Mon, 18 Jan 2021 14:23:16 +0000 (15:23 +0100)]
os: force consistent mtime before running fstest on directory on Windows

FindFileNext sometimes returns a different mtime than looking at the
file directly, because the MFT on NTFS is written to lazily. In order to
keep these in sync, we use GetFileInformationByHandle to get the actual
mtime, and then write it back to the file explicitly.

Fixes #42637.

Change-Id: I774016d3ac55d0dc9b0f9c1b681516c33ba0d28a
Reviewed-on: https://go-review.googlesource.com/c/go/+/285720
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>