Commit graph

48126 commits

Author SHA1 Message Date
Aaron Sheah 5fee772c87 doc/go1.17: document archive/zip changes for Go 1.17
For #44513. Fixes #46000

Change-Id: I299d0b5657f1f96174d6e35d60daac8b36e59d29
GitHub-Last-Rev: e63461bff0
GitHub-Pull-Request: golang/go#46235
Reviewed-on: https://go-review.googlesource.com/c/go/+/320809
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Robert Findley <rfindley@google.com>
2021-05-21 17:35:02 +00:00
Tim Heckman 3148694f60 cmd/go: remove warning from module deprecation notice printing
Fixes #46294

Change-Id: I50023006dab83dee455f98a702ca1c72e61764ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/321649
Trust: Jay Conrod <jayconrod@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-05-21 16:51:34 +00:00
Jason A. Donenfeld 7e63c8b765 runtime: wait for Go runtime to initialize in Windows signal test
The test harness waits for "ready" as a sign that the Go runtime has
installed its signal handler and is ready to be tested. But actually,
while LoadLibrary starts the loading of the Go runtime, it does so
asynchronously, so the "ready" sign is potentially premature and
certainly racy. However, all exported cgo entry points make a call to
_cgo_wait_runtime_init_done which waits for that asynchronous
initialization to complete. Therefore, this commit fixes the test to
call into the exported "Dummy" cgo function before emitting the "ready"
sign, so that we're sure the Go runtime is actually loaded.

Updates #45638.

Change-Id: I9b12b172d45bdcc09d54dd301de3a3e499544834
Reviewed-on: https://go-review.googlesource.com/c/go/+/321769
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-05-21 13:21:00 +00:00
Adam Mitha 831573cd21 io/fs: added an example for io/fs.WalkDir
The documentation currently does not show how to get an `FS` instance for the operating system's filesystem. This example demonstrates how to accomplish this using the `os` package.

Fixes #46083

Change-Id: I053111c12ab09ef13f0d04fcdff8a6ea0dccf379
Reviewed-on: https://go-review.googlesource.com/c/go/+/319989
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-05-21 03:21:56 +00:00
Tim King baa934d26d cmd: go get golang.org/x/tools/analysis@49064d23 && go mod vendor
This brings in CLs 312829, 317431, 319211.

Fixes #40356.
Fixes #46129.

Change-Id: I2ee1f858b2a41ffa60d88b0c17511ccad57f1816
Reviewed-on: https://go-review.googlesource.com/c/go/+/321389
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Tim King <taking@google.com>
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-20 20:37:02 +00:00
Vishal Dalwadi 7c692cc7ea doc/go1.17: document changes to os package
Documents the changes to File.WriteString method.

For #44513.
Fixes #46018.

Change-Id: I3a8ef9df9f84662614d54802710bd705d626b995
Reviewed-on: https://go-review.googlesource.com/c/go/+/317910
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
2021-05-20 17:40:58 +00:00
Lapo Luchini ce9a3b79d5 crypto/x509: add new FreeBSD 12.2+ trusted certificate folder
Up to FreeBSD 12.1 the package ca_root_nss was needed in order to have
certificates under /usr/local/share/certs as the base system didn't have
a system trusted certificate store.

This has been fixed in FreeBSD 12.2 using /etc/ssl/certs:
https://svnweb.freebsd.org/base?view=revision&revision=357082

Fixes #46284

Change-Id: I912b1bacc30cdf20d19e3ef9d09b69bb8055ff49
GitHub-Last-Rev: 0fa5542ea3
GitHub-Pull-Request: golang/go#46276
Reviewed-on: https://go-review.googlesource.com/c/go/+/321190
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-05-20 17:06:05 +00:00
Joel Sing f8be906d74 test: re-enable test on riscv64 now that it supports external linking
Update #36739

Change-Id: I14ab2cd0e29966b9a2f992e8c3bcb415203e63e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/321449
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-20 16:41:09 +00:00
Cherry Mui def5360541 doc/go1.17: add release notes for OpenBSD ports
Updates #44513.

Change-Id: I8758768f6231fd7fcbaa7109eb49ee56cd60d93d
Reviewed-on: https://go-review.googlesource.com/c/go/+/321310
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-20 16:09:44 +00:00
Cherry Mui ef1f52cc38 doc/go1.17: add release note for windows/arm64 port
Updates #44513, #42604.

Change-Id: I8200e8087c219a0042ab2a6770a7275c3b17942a
Reviewed-on: https://go-review.googlesource.com/c/go/+/321309
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-20 16:09:29 +00:00
Vishal Dalwadi bb7495a46d doc/go1.17: document new math constants
Documents the newly introduced:
* MaxInt
* MinInt
* MaxUint

Updates #28538.
For #44513.
Fixes #46012.

Change-Id: Iab6bbcf8f76ebe105b973d5fd39b86b8cd078348
Reviewed-on: https://go-review.googlesource.com/c/go/+/317911
Trust: Heschi Kreinick <heschi@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-05-20 16:08:35 +00:00
Michael Anthony Knyszek f07e4dae3c syscall: document NewCallback and NewCallbackCDecl limitations
Currently NewCallback and NewCallbackCDecl may only be called a limited
number of times in a single Go process, but this property of the API is
not documented. This change fixes that, but does not document the
precise limit to avoid making that limit part of the API, leaving us
open to increasing or decreasing the limit in the future as needed.

Although the API avoids documenting a limit, it does guarantee a minimum
callback count so users can rely on at least some amount of callbacks
working.

Updates #46184.

Change-Id: I5129bf5fe301efff73ac112ba1f207ab32058833
Reviewed-on: https://go-review.googlesource.com/c/go/+/321133
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-20 13:19:43 +00:00
Dmitri Shuralyov a8d85918b6 misc/cgo/testplugin: skip TestIssue25756pie on darwin/arm64 builder
This test is known to be broken on the darwin/arm64 builder.
Skip it while it's being investigated so it doesn't mask other failures.

For #46239.
Updates #43228.

Change-Id: I8fe57a0636bba84c3100337146dcb96cc264e524
Reviewed-on: https://go-review.googlesource.com/c/go/+/321349
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-20 01:22:28 +00:00
Dmitri Shuralyov 6c1c055d1e cmd/internal/moddeps: use filepath.SkipDir only on directories
If a filepath.WalkFunc returns filepath.SkipDir when invoked on a
non-directory file, it skips the remaining files in the containing
directory.¹

CL 276272 accidentally added a code path that triggers this behavior
whenever filepath.Walk reaches a non-directory file that begins with
a dot, such as .gitattributes or .DS_Store, causing findGorootModules
to return early without finding any modules in GOROOT. Tests that use
it ceased to provide test coverage that the tree is tidy.

Add an explicit check for info.IsDir in the 5 places that intend to
use filepath.SkipDir to skip traversing that directory. Even paths
like GOROOT/bin and GOROOT/pkg which are unlikely to be anything but
a directory are worth checking, since the goal of moddeps is to take
a possibly problematic GOROOT tree as input and detect problems.

While the goal of findGorootModules is to find all modules in GOROOT
programmatically (in case new modules are added or modified), there
are 4 modules now that are quite likely to exist, so check for their
presence to avoid similar regressions. (It's not hard to update this
test if a well-known GOROOT module is removed or otherwise modified;
but if it becomes hard we can simplify it to check for a reasonable
number of modules instead.)

Also fix the minor skew that has crept in since the test got disabled.

¹ This wasn't necessarily an intentional design decision, but it was
  found only when Go 1.4 was already out. See CL 11690 for details.

Fixes #46254.

Change-Id: Id55ed926f8c0094b1af923070de72bacca05996f
Reviewed-on: https://go-review.googlesource.com/c/go/+/320991
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-05-19 15:20:08 +00:00
Michael Pratt 658b5e66ec net: return nil UDPAddr from ReadFromUDP
In cases where the socket operation has no underlying address,
golang.org/cl/291509 unintentionally changed ReadFromUDP from return a
nil *UDPAddr to a non-nil (but zero value) *UDPAddr.

This may break callers that assume "no address" is always addr == nil,
so change it back to remain nil.

Fixes #46238

Change-Id: I8531e8fa16b853ed7560088eabda0b9e3e53f5be
Reviewed-on: https://go-review.googlesource.com/c/go/+/320909
Trust: Michael Pratt <mpratt@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-05-19 13:04:45 +00:00
Cherry Mui 15a374d5c1 test: check portable error message on issue46234.go
issue46234.go expects an error output "segmentation violation",
which is UNIX-specific. Check for "nil pointer dereference"
instead, which is emitted by the Go runtime and should work on all
platforms.

Should fix Windows builders.

Change-Id: I3f5a66a687d43cae5eaf6a9e942b877e5a248900
Reviewed-on: https://go-review.googlesource.com/c/go/+/321072
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-19 01:09:20 +00:00
Russ Cox eeadce2d87 go/build/constraint: fix parsing of "// +build" (with no args)
"// +build" by itself was like "// +build !" - unsatisfiable.
Make it so again (right now it panics).

Fixes #44487.

Change-Id: Iacbc1398af6f988ef011f9f438e792eb62f8f434
Reviewed-on: https://go-review.googlesource.com/c/go/+/320829
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-05-18 22:36:55 +00:00
Than McIntosh 6d2ef2ef2a cmd/compile: don't emit inltree for closure within body of inlined func
When inlining functions with closures, ensure that we don't mark the
body of the closure with a src.Pos marker that reflects the inline,
since this will result in the generation of an inltree table for the
closure itself (as opposed to the routine that the func-with-closure
was inlined into).

Fixes #46234.

Change-Id: I348296de6504fc4745d99adab436640f50be299a
Reviewed-on: https://go-review.googlesource.com/c/go/+/320913
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-05-18 20:04:57 +00:00
Roland Shoemaker 048cb4ceee crypto/x509: remove duplicate import
Change-Id: I86742ae7aa4ff49a38f8e3bc1d64fb223feae73e
Reviewed-on: https://go-review.googlesource.com/c/go/+/318409
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-18 20:00:18 +00:00
Cherry Mui 690a8c3fb1 make.bash: fix misuse of continue
Apparently, in bash, the "continue" keyword can only be used
inside of a loop, not in an if block. If readelf exists but $CC
does not, make.bash emits a warning:

./make.bash: line 135: continue: only meaningful in a `for', `while', or `until' loop

Change it to a conditional.

Change-Id: I00a0940ed99bc0c565094e506705961b6b3d362e
Reviewed-on: https://go-review.googlesource.com/c/go/+/320170
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-05-18 15:00:55 +00:00
Jeff Widman 8b0901fd32 doc/go1.17: fix typo "avoding" -> "avoiding"
Change-Id: Ice4a6e7ec8175caf3f049ac1ca39929059f90e9c
GitHub-Last-Rev: a2d59d5551
GitHub-Pull-Request: golang/go#46227
Reviewed-on: https://go-review.googlesource.com/c/go/+/320729
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-05-18 07:50:25 +00:00
Rob Pike 5e191f8f48 time: rewrite the documentation for layout strings
People continue to be confused by how these work. Address that by some
rejiggering.

Introduce a constant called Layout that both defines the time and
provides a reference point for Parse and Format to refer to. We can
then delete much redundancy, especially for Format's comments, but
Parse tightens a bit too.

Then change the way the concept of the layout string is introduced,
and provide a clearer catalog of what its elements are.

Fixes #38871

Change-Id: Ib967ae70c7d5798a97b865cdda1fda4daed8a99a
Reviewed-on: https://go-review.googlesource.com/c/go/+/320252
Trust: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-05-18 02:39:04 +00:00
Rob Findley bfe3573d58 go/token: correct the interval notation used in some panic messages
Fix an apparent typo for the right-hand bound in a couple panic
messages, where '[' was used instead of ']'.

Fixes #46215

Change-Id: Ie419c404ca72ed085a83a2c38ea1a5d6ed326cca
Reviewed-on: https://go-review.googlesource.com/c/go/+/320510
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>
2021-05-17 22:19:03 +00:00
Tobias Klauser a2c07a9a1a all: update golang.org/x/net to latest
To pull in CL 318309.

For #41184

Change-Id: I99adb0478e71dbd72e13551a87ed09eae2a0ef2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/320312
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-17 18:03:56 +00:00
Andrew G. Morgan b9b2bed893 syscall: some containers may fail syscall.TestSetuidEtc
The test previously had the hardcoded assumption that /proc/self/status
files had "Groups:" lines containing numerical IDs in ascending order.
Because of the possibility of non-monotonic ordering of GIDs in user
namespaces, this assumption was not universally true for all
/proc/self/gid_map setups.

To ensure this test can pass in those setups, sanity check failed
"Groups:" line matches with a string sorted version of the expected
values. (For the test cases here, numerical and string sorted order
are guaranteed to match.)

Fixes #46145

Change-Id: Ia060e80b123604bc394a15c02582fc406f944d36
Reviewed-on: https://go-review.googlesource.com/c/go/+/319591
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-05-17 17:46:08 +00:00
Jay Conrod b1aff42900 cmd/go: don't print 'go get' deprecation notices in the main module
If a user runs 'go get example.com/cmd' for a package in the main
module, it's more likely they intend to fill in missing dependencies
for that package (especially with -u). If the intent were only to
build and install, 'go install example.com/cmd' would be a better
choice.

For #43684

Resolving a comment on CL 305670.

Change-Id: I5c80ffdcdb3425b448f2f49cc20b07a18cb2bbe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/318570
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-17 16:02:12 +00:00
Lynn Boger bade680867 runtime/cgo: fix crosscall2 on ppc64x
Some uses of crosscall2 did not work on ppc64le and probably
aix-ppc64. In particular, if there was a main program compiled
with -buildmode=pie and used a plugin which invoked crosscall2,
then failures could occur due to R2 getting set incorrectly along the
way. The problem was due to R2 being saved on the caller's
stack; it is now saved on the crosscall2 stack. More details can be
found in the issue.

This adds a testcase where the main program is built with pie
and the plugin invokes crosscall2.

This also changes the save of the CR bits from MOVD to MOVW as
it should be.

Fixes #43228

Change-Id: Ib5673e25a2ec5ee46bf9a1ffb0cb1f3ef5449086
Reviewed-on: https://go-review.googlesource.com/c/go/+/319489
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Heschi Kreinick <heschi@google.com>
2021-05-17 15:57:52 +00:00
Bryan C. Mills ce92a2023c cmd/go: error out of 'go mod tidy' if the go version is newer than supported
Fixes #46142

Change-Id: Ib7a0a159e53cbe476be6aa9a050add10cc750dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/319669
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>
2021-05-15 02:39:08 +00:00
Cherry Mui 02699f810a runtime: mark osyield nosplit on OpenBSD
osyield is called in code paths that are not allowed to split
stack, e.g. casgstatus called from entersyscall/exitsyscall.
It is nosplit on all other platforms. Mark it nosplit on OpenBSD
as well.

Change-Id: I3fed5d7f58b3d50610beca6eed2c7e902b8ec52c
Reviewed-on: https://go-review.googlesource.com/c/go/+/319969
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2021-05-14 19:27:25 +00:00
Michael Fraenkel 3d324f127d net/http: prevent infinite wait during TestMissingStatusNoPanic
If the client request never makes it to the server, the outstanding
accept is never broken. Change the test to always close the listening
socket when the client request completes.

Updates #45358

Change-Id: I744a91dfa11704e7e528163d7669c394e90456dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/319275
Trust: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-14 16:42:01 +00:00
Manlio Perillo 0eb38f2b16 cmd/go/internal/load: override Package.Root in module mode
The Context.ImportDir method in the go/build package sets Package.Root
to $GOPATH, if a package is inside a GOPATH workspace.  The
loadPackageData function keeps this value even when modules are enabled.

Override Package.Root when modules are enabled, instead of just set its
value when Context.ImportDir was unable to set it.

Add a regression test.

Fixes #46119

Change-Id: I900a33fe13a445cb771e2952d0d830f1b4a5921f
Reviewed-on: https://go-review.googlesource.com/c/go/+/319209
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-14 16:15:28 +00:00
Manlio Perillo a938e52986 cmd/go: fix a portability issue in the cd script command
Currently all script tests use the UNIX path separator with the cd
command, causing the PWD environment variable to have the incorrect path
separator on Windows.

Call filepath.FromSlash on the cd command argument.
Update the testdata/script/README to document that the cd argument must
use slashes.

Add a regression test.

To reproduce this issue, a test must use the cd command followed by a
stdout or stderr command containing the pattern $PWD.

Change-Id: Ib2dc5f185cc2476451402787996d14df91f7dddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/319311
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-14 15:35:28 +00:00
Ben Hoyt d137b74539 cmd/go: fix spacing in help text of -overlay flag
There was a space missing in the first line shown below, and an extra
space in the second line shown. Thanks Peter Bourgon for noting this.

BEFORE:
$ go help build | grep -A1 'has some limitations'
has some limitations:importantly, cgo files included from outside the
include path must be  in the same directory as the Go package they are

AFTER:
$ go help build | grep -A1 'has some limitations'
has some limitations: importantly, cgo files included from outside the
include path must be in the same directory as the Go package they are

Note that I edited alldocs.go by hand here, as the mkalldocs.sh script
produces a lot more changes, for example adding the -insecure flag
documentation in. Not sure what's wrong there.

Change-Id: I303f6d6b42b0e24cec0748a949dc23beec64b917
Reviewed-on: https://go-review.googlesource.com/c/go/+/319949
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-14 14:37:54 +00:00
eric fang c925e1546e cmd/internal/obj/arm64: disable AL and NV for some condition operation instructions
According to the armv8-a reference manual, conditions AL and NV are not allowed
for instructions CINC, CINV, CNEG, CSET and CSETM. This CL adds this check and
the corresponding test cases.

Change-Id: Icb496b7b13a353f41491f2de4d939a5cd88abb04
Reviewed-on: https://go-review.googlesource.com/c/go/+/317912
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: eric fang <eric.fang@arm.com>
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-14 07:53:46 +00:00
itchyny 12d383c7c7 debug/macho: fix a typo in macho.go
Change-Id: Ica47b53decf6690fbd37e666e9de5098117b82de
GitHub-Last-Rev: 6aabb208a6
GitHub-Pull-Request: golang/go#46147
Reviewed-on: https://go-review.googlesource.com/c/go/+/319592
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
2021-05-14 00:56:52 +00:00
John Bampton 3a0453514a all: fix spelling
Change-Id: Id991d8e81e04835cabfb02d07a2199bfb553726c
GitHub-Last-Rev: 5d0b55d491
GitHub-Pull-Request: golang/go#44802
Reviewed-on: https://go-review.googlesource.com/c/go/+/299069
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
2021-05-14 00:56:24 +00:00
Cherry Mui b4833f7c06 cmd/link: always mark runtime.unreachableMethod symbol
In the deadcode path we mark runtime.unreachableMethod symbol,
which is a special symbol used for redirecting unreachable
methods. Currently this code is conditioned on not -linkshared.
This is wrong. It should be marked with -linkshared mode as well.

In fact, -linkshared should only affect the entry symbol. Change
the code accordingly.

Change-Id: I252abf850212a930f275589ef0035a43e52cb9cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/319893
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-05-13 21:16:06 +00:00
Cherry Mui 92c189f211 cmd/link: resolve ABI alias for runtime.unreachableMethod
We redirect references to unreachable methods to
runtime.unreachableMethod. We choose to use ABIInternal symbol
for this, because runtime.unreachableMethod is a defined Go
function.

When linking against shared libraries, and ABI wrappers are not
enabled, the imported function symbols are all ABI0 and aliased
to ABIInternal. We need to resolve ABI alias in this case.

Change-Id: Idd64ef46ce0b5f54882ea0069ce0d59dc9b7a599
Reviewed-on: https://go-review.googlesource.com/c/go/+/319891
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-13 21:01:50 +00:00
Kevin Albertson 7a7624a3fa cmd/go: permit .tbd files as a linker flag
A .tbd file is a macOS text-based stub library and is a valid input to
the macOS linker. This change adds .tbd to the allow-list for acceptable
linker flags.

Fixes golang/go#44263

Change-Id: Ie5439a13325dbc908e42f95ec70aca518bb549f9
GitHub-Last-Rev: 6055c3b5fa
GitHub-Pull-Request: golang/go#44276
Reviewed-on: https://go-review.googlesource.com/c/go/+/292269
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2021-05-13 18:59:27 +00:00
Russ Cox cde2d857fe cmd/go: be less strict about go version syntax in dependency go.mod files
It is unclear what the future holds for the go line in go.mod files.
Perhaps at some point we will switch to semver numbering.
Perhaps at some point we will allow specifying minor versions
or even betas and release candidates.
Those kinds of changes are difficult today because the go line
is parsed in dependency modules, meaning that older
versions of the Go toolchain need to understand newer go lines.

This CL makes that case - parsing a go line in a dependency's
go.mod file - a bit more lax about how to find the version.
It allows a leading v and any trailing non-digit-prefixed string
after the MAJOR.MINOR section.

There are no concrete plans to make use of any of these changes,
but if in the future we want to make them, having a few Go releases
under out belt that will accept the syntax in dependencies will
make any changes significantly easier.

Change-Id: I79bb84bba4b769048ac4b14d5c275eb9a3f270c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/317690
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>
2021-05-13 15:33:24 +00:00
Russ Cox 2a61b3c590 regexp: fix repeat of preferred empty match
In Perl mode, (|a)* should match an empty string at the start of the
input. Instead it matches as many a's as possible.
Because (|a)+ is handled correctly, matching only an empty string,
this leads to the paradox that e* can match more text than e+
(for e = (|a)) and that e+ is sometimes different from ee*.

This is a very old bug that ultimately derives from the picture I drew
for e* in https://swtch.com/~rsc/regexp/regexp1.html. The picture is
correct for longest-match (POSIX) regexps but subtly wrong for
preferred-match (Perl) regexps in the case where e has a preferred
empty match. Pointed out by Andrew Gallant in private mail.

The current code treats e* and e+ as the same structure, with
different entry points. In the case of e* the preference list ends up
not quite in the right order, in part because the “before e” and
“after e” states are the same state. Splitting them apart fixes the
preference list, and that can be done by compiling e* as if it were
(e+)?.

Like with any bug fix, there is a very low chance of breaking a
program that accidentally depends on the buggy behavior.

RE2, Go, and Rust all have this bug, and we've all agreed to fix it,
to keep the implementations in sync.

Fixes #46123.

Change-Id: I70e742e71e0a23b626593b16ddef3c1e73b413b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/318750
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-13 14:52:20 +00:00
Than McIntosh fd4631e24f cmd/compile/internal/dwarfgen: fix DWARF param DIE ordering
The DWARF standard requires that the DIEs in a subprogram
corresponding to input and output parameters appear in declaration
order; this patch adds some new code in dwarfgen to enforce this
ordering (relying on the existing fn.Dcl ordering is not sufficient).

Prior to the register ABI, it was easy to keep vars/decls sorted
during DWARF generation since you could always rely on frame offset;
with the ABI sorting by frame offset no longer gives you the original
declaration order in all cases.

Fixes #46055.

Change-Id: I0e070cb781d6453caba896e5d3bee7cd5388050d
Reviewed-on: https://go-review.googlesource.com/c/go/+/318829
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-13 14:30:42 +00:00
Than McIntosh a63cded5e4 debug/dwarf: delay array type fixup to handle type cycles
A user encountered a debug/dwarf crash when running the dwarf2json
tool (https://github.com/volatilityfoundation/dwarf2json) on a
debug-built copy of the linux kernel. In this crash, the DWARF type
reader was trying to examine the contents of an array type while that
array type was still in the process of being constructed (due to
cycles in the type graph).

To avoid such situations, this patch extends the mechanism introduced
in https://go-review.googlesource.com/18459 (which handles typedef
types) to delay fixup of array types as well.

Change-Id: I303f6ce5db1ca4bd79da3581957dfc2bfc17cc01
Reviewed-on: https://go-review.googlesource.com/c/go/+/319329
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Yi Chou <yich@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-13 12:32:21 +00:00
Tobias Klauser 0fa2302ee5 cmd/vendor: update golang.org/x/sys to latest
To pull in CL 318212.

For #41184

Change-Id: Iec0d7bee2d3a5874c24a55ec20efd7746bf70902
Reviewed-on: https://go-review.googlesource.com/c/go/+/319410
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-13 09:12:33 +00:00
Tobias Klauser 2c76a6f7f8 all: add //go:build lines to assembly files
Don't add them to files in vendor and cmd/vendor though. These will be
pulled in by updating the respective dependencies.

For #41184

Change-Id: Icc57458c9b3033c347124323f33084c85b224c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/319389
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-05-13 09:12:17 +00:00
Bryan C. Mills 6db7480f59 cmd/go/internal/modload: in updateLazyRoots, do not require the main module explicitly
Fixes #46078

Change-Id: I8044dac717459f1eeae1d8381a6503f22f9f51ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/319009
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-05-12 20:20:11 +00:00
Cherry Mui f93b951f33 cmd/compile/abi-internal.md: fix table format
The table was not rendered correctly because one line missed a
column.

Change-Id: I1373e4e9fb8b8f2dcd9fd0db339083362cce9b71
Reviewed-on: https://go-review.googlesource.com/c/go/+/319291
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-12 17:32:39 +00:00
Ruslan Andreev 3b321a9d12 cmd/compile: add arch-specific inlining for runtime.memmove
This CL add runtime.memmove inlining for AMD64 and ARM64.
According to ssa dump from testcases generic rules can't inline
memmomve properly due to one of the arguments is Phi operation. But this
Phi op will be optimized out by later optimization stages. As a result
memmove can be inlined during arch-specific rules.
The commit add new optimization rules to arch-specific rules that can
inline runtime.memmove if it possible during lowering stage.
Optimization fires 5 times in Go source-code using regabi.

Fixes #41662

Change-Id: Iaffaf4c482d068b5f0683d141863892202cc8824
Reviewed-on: https://go-review.googlesource.com/c/go/+/289151
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: David Chase <drchase@google.com>
2021-05-12 16:23:30 +00:00
Jonathan Swinney 07ff596404 runtime/internal/atomic: add LSE atomics instructions to arm64
As a follow up to an earlier change[1] to add ARMv8+LSE instructions in
the compiler generated atomic intrinsics, make the same change in the
runtime library. Since not all ARMv8 systems support LSE instructions,
they are protected by a feature-flag branch.

[1]: golang.org/cl/234217 commit: ecc3f5112e

Change-Id: I0e2fb22e78d5eddb6547863667a8865946679a00
Reviewed-on: https://go-review.googlesource.com/c/go/+/310591
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
2021-05-12 16:18:01 +00:00
Russ Cox 03886707f9 runtime: fix handling of SPWRITE functions in traceback
It is valid to see SPWRITE functions at the top of a GC stack traceback,
in the case where they self-preempted during the stack growth check
and haven't actually modified SP in a traceback-unfriendly manner yet.
The current check is therefore too aggressive.

isAsyncSafePoint is taking care of not async-preempting SPWRITE functions
because it doesn't async-preempt any assembly functions at all.
But perhaps it will in the future.

To keep a check that SPWRITE assembly functions are not async-preempted,
add one in preemptPark. Then relax the check in traceback to avoid
triggering on self-preempted SPWRITE functions.

The long and short of this is that the assembly we corrected in x/crypto
issue #44269 was incredibly dodgy but not technically incompatible with
the Go runtime. After this change, the original x/crypto assembly no longer
causes GC traceback crashes during "GOGC=1 go test -count=1000".
But we'll still leave the corrected assembly.

This also means that we don't need to worry about diagnosing SPWRITE
assembly functions that may exist in the wild. They will be skipped for
async preemption and no harm no foul.

Fixes #44269, which was open pending some kind of check for
bad SPWRITE functions in the wild. (No longer needed.)

Change-Id: I6000197b62812bbd2cd92da28eab422634cf75a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/317669
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-12 15:23:09 +00:00