1
0
mirror of https://github.com/golang/go synced 2024-11-06 19:46:20 -07:00
Commit Graph

44384 Commits

Author SHA1 Message Date
Fazlul Shahriar
a980e8a690 net: handle more interface types without a hardware address on Plan 9
We were handling loopback devices when attempting to read hardware
address, but packet interfaces were not being handled. As a general fix,
don't attempt to read hardware address of any device that's not inside
/net.

Fixes #39908

Change-Id: Ifa05e270357e111c60906110db2cc23dc7c1c49c
Reviewed-on: https://go-review.googlesource.com/c/go/+/240259
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
2020-06-29 08:06:23 +00:00
Jie Ma
c875503cf7 doc: fix typos and grammatical errors in contribute.html
Fixed some typos and grammatical errors in contribute.html

Change-Id: Ifb31f22d876b7bea84b5e130870c26813b2fa139
GitHub-Last-Rev: 4351919885
GitHub-Pull-Request: golang/go#39892
Reviewed-on: https://go-review.googlesource.com/c/go/+/240277
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-28 03:14:10 +00:00
Keith Randall
12c01f7698 runtime: ensure arenaBaseOffset makes it into DWARF (for viewcore)
This constant does not make it into DWARF because it is an ideal
constant larger than maxint (1<<63-1). DWARF has no way to represent
signed values that large. Define a different typed constant that
is unsigned and so can represent this constant properly.

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

Change-Id: I4274a2f6e79ebbf1411e85d64758fac1672fb96b
Reviewed-on: https://go-review.googlesource.com/c/go/+/240198
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-06-27 02:49:01 +00:00
Matthew Dempsky
a295d59d10 cmd/cgo: prevent redeclaration of _Ctype_void when C.void is used
CL 230037 changed cmd/cgo to emit "type _Ctype_foo = bar" aliases for
all C.foo types mentioned in the original Go source files. However,
cmd/cgo already emits an appropriate type definition for _Ctype_void.
So if a source file explicitly mentions C.void, this resulted in
_Ctype_void being declared multiple times.

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

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

Fixes #39877.

Change-Id: Ief264b3847c8ef8df1478a6333647ff2cf09b63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240180
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-26 19:00:25 +00:00
Alberto Donizetti
3c474d4164 doc/go1.15: fix typos and wording in a few places
Change-Id: Ib1fc7a8305f3bc698b9022e0a565ccbcf687e0d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/240158
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-26 18:47:38 +00:00
Cherry Zhang
92051a989b [dev.link] all: merge branch 'master' into dev.link
Clean merge.

Change-Id: I2ae0e4cc67e24216c85619717657dce36e887a54
2020-06-26 14:25:33 -04:00
Ian Lance Taylor
186e61f319 doc/go1.14: crypto/tls.Config.NameToCertificate is deprecated
Also crypto/tls.Config.BuildNameToCertificate.

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

Fixes #37626

Change-Id: If8549bc746f42a93f1903439e1b464b3e81e2c19
Reviewed-on: https://go-review.googlesource.com/c/go/+/240005
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-06-26 17:32:19 +00:00
Cherry Zhang
d1015f3e58 runtime: don't preempt if preemption is disabled
If asyncpreemptoff is set, don't preempt upon receiving a SIGURG.

Fixes #38531.

Change-Id: I6d9a828b45c199d3e479cbdfe17a896a40d540f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/240121
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-26 17:07:58 +00:00
Alberto Donizetti
c143a5f2a6 doc/go1.15: fix bad link to crypto/tls
Change-Id: Ie81579cbb1873349a91280f5aebe59624fcb1ef8
Reviewed-on: https://go-review.googlesource.com/c/go/+/240157
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-06-26 16:36:11 +00:00
Cherry Zhang
7dbd40babf [dev.link] cmd/link: remove special dynlinkingGo case in pclntab pass
Now that we removed the "weird thing" about runtime.etext symbol,
we can remove this special case.

Change-Id: I2e4558367758d37e898a802bcd30671c7dd6fe89
Reviewed-on: https://go-review.googlesource.com/c/go/+/240066
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-26 14:26:05 +00:00
Cherry Zhang
a9a1217112 [dev.link] cmd/link: handle runtime.text/etext symbols more consistently
Currently, on most platforms, the start/end symbols runtime.text
and runtime.etext are defined in symtab pass and assigned values
in address pass. In some cases (darwin+dynlink or AIX+external),
however, they are defined and assigned values in textaddress pass
(because they need non-zero sizes). Then their values get
overwritten in address pass. This is bad. The linker expects
their values to be consistent. In particular, in CL 239281,
findfunctab is split to two parts. The two parts need to have a
consistent view of the start/end symbols. If its value changes in
between, bad things can happen.

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

Fix darwin and AIX builds.

Change-Id: Ifdc1bcb69d99be1b7e5b4fd31d473650c03e3b9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240065
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-26 14:25:58 +00:00
Jeremy Faller
1fdf5ba50c [dev.link] cmd/link: move findfunctab to a generated symbol
Basically removes all allocation from findfunctab:

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

Change-Id: I246f7d2751317886b658f7ef672fb30b3c519668
Reviewed-on: https://go-review.googlesource.com/c/go/+/239281
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-25 18:42:39 +00:00
Jeremy Faller
f033e23414 [dev.link] cmd/link: add generator symbols
Create a new class of symbols internal to the linker. These symbols live
in the Loader, and are real smybols, but have no data, only size. After
symbols are allocated in the binary in asmb() a function is called that
is responsible for filling in the data.

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

Change-Id: Ib4291fc6e578478057ed2ec163d7b27426f1d5ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/239280
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-25 18:42:27 +00:00
Filippo Valsorda
b13774691c crypto/x509: move and update the SSL_CERT_FILE and SSL_CERT_DIR docs
Fixes #37907

Change-Id: Ia077de6dcc74ed761d278eab4efbf45e151429b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/239747
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-06-25 17:26:38 +00:00
Keith Randall
3b2f67a597 cmd/compile: remove check that Zero's arg has the correct base type
It doesn't have to. The type in the aux field is authoritative.
There are cases involving casting from interface{} where pointers
have a placeholder pointer type (because the type is not known when
the IData op is generated).

The check was introduced in CL 13447.

Fixes #39459

Change-Id: Id77a57577806a271aeebd20bea5d92d08ee7aa6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/239817
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-06-25 15:59:48 +00:00
Fazlul Shahriar
334752dc82 os: return *PathError error in File.Sync on Plan 9
File.Sync was returning *SyscallError instead of *PathError on Plan 9.
Adjust the error type to match other systems.

Fixes #39800

Change-Id: I844e716eb61c193ef78d29cb0b4a3ef790bb3320
Reviewed-on: https://go-review.googlesource.com/c/go/+/239857
Reviewed-by: David du Colombier <0intro@gmail.com>
2020-06-25 12:02:38 +00:00
Than McIntosh
cbfced7415 [dev.link] cmd/internal: convert basic types to builtin symbols
The Go compiler includes special treatment for a small set of very
commonly used type symbols (26 to be exact); for these types it
doesn't bother to emit type descriptors for "normal" compilations, and
instead only generates them for the runtime package, so as to reduce
object file bloat.

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

Change-Id: I039c805e05c1aef26f035e52760fd0a0af40f7a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/239658
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-25 11:19:16 +00:00
Than McIntosh
be38746eb4 [dev.link] cmd/internal/obj: don't write builtin names in obj writer
Change the object file writer to avoid adding entries to the object
file string table for builtin functions. This helps save some very
small amount of space in the object file.

Change-Id: Ic3b94a154e00eb4c7378b57613580c7073b841bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/239657
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-25 11:18:58 +00:00
Ian Lance Taylor
1bb247a469 doc/go1.15: mention consequence of os.File.ReadFrom
Now that we've added a os.File.ReadFrom method, io.CopyBuffer to a
os.File will no longer use the provided buffer.

For #16474
For #36817
For #37419

Change-Id: I79a3bf778ff93eab88e88dd9ecbb8c7ea101e868
Reviewed-on: https://go-review.googlesource.com/c/go/+/238864
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-25 03:11:43 +00:00
Kerollos Magdy
d7e3a161f5 doc/faq: fix a grammar mistake
Change-Id: Ifa060f5f91d7b964eb180465245104411310d423
GitHub-Last-Rev: cd1862f2ca
GitHub-Pull-Request: golang/go#39780
Reviewed-on: https://go-review.googlesource.com/c/go/+/239388
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-25 02:59:06 +00:00
Ian Lance Taylor
b4652028d4 net: consistently document deadline handling
After CL 228645 some mentions of the Deadline methods referred
to the Timeout method, and some to os.ErrDeadlineExceeded.
Stop referring to the Timeout method, to encourage ErrDeadlineExceeded.

For #31449

Change-Id: I27b8ff34f31798f38b06437546886af8cce98ca4
Reviewed-on: https://go-review.googlesource.com/c/go/+/239705
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-24 22:40:11 +00:00
Filippo Valsorda
7eb5941b95 crypto/tls: replace VerifyPeerCertificate example with VerifyConnection
Look at how much better it is!

Updates #36736

Change-Id: I53a314a103a42dd869c05823fa50f37d70f9d283
Reviewed-on: https://go-review.googlesource.com/c/go/+/239560
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-06-24 20:48:12 +00:00
Filippo Valsorda
66cb673de6 crypto/tls: expand the ConnectionState docs
Fixes #37572

Change-Id: I493392f535a979ee16609861041da2ecfe21cf77
Reviewed-on: https://go-review.googlesource.com/c/go/+/239744
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-06-24 20:22:03 +00:00
Filippo Valsorda
3c6fec86e3 crypto/tls: fix DialContext docs
Change-Id: I58e3febbf63049bebb4f8ed8893288183c8aaccd
Reviewed-on: https://go-review.googlesource.com/c/go/+/239745
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-06-24 20:17:05 +00:00
Filippo Valsorda
72019cf312 crypto/x509: restore support for ios tag on darwin/amd64
Fixes #38710

Change-Id: I9b210e95fd997ff53ec704c5f61110045aaa94bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/239559
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-24 20:16:49 +00:00
Filippo Valsorda
3e95c5b0a1 crypto/x509: update bundled iOS roots and rewrite generator
Switched the generator to using the open source releases of the root
store rather than HTML parsing, while trying to emulate the sorting
algorithm of the table to reduce churn.

Updates #38843

Change-Id: I78608d245eabc2a35c2f98635ed5f1a531ad2ba8
Reviewed-on: https://go-review.googlesource.com/c/go/+/239557
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-24 18:05:37 +00:00
Filippo Valsorda
320e4adc4b crypto/elliptic: document and test that IsOnCurve(∞) == false
This also implies it can't be passed to Marshal.

Fixes #37294

Change-Id: I1e6b6abd87ff31f323486958d5cb34a5c8f76b5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/239562
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-06-24 16:12:25 +00:00
Cherry Zhang
a89fd32316 [dev.link] cmd/link: fix data race on AIX
On AIX, in relocsym we call Xcoffadddynrel, which adds a
relocation record to a global array. relocsym already runs in
parallel. In the past we only parallelize over segments, and
we call Xcoffadddynrel only for symbols in data segment, so it is
effectively called sequentially. In CL 239197 we started to do
more fine-grained parallelism, so we need to make sure it is safe
to call Xcoffadddynrel in parallel.

Fix AIX build.

Change-Id: I3128193995a5a99d9fa04c8e728e590f17298da3
Reviewed-on: https://go-review.googlesource.com/c/go/+/239561
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-24 15:04:05 +00:00
Than McIntosh
f0cf4d4d7f [dev.link] cmd/{compile,link}: fix file/line of last instruction in DWARF line table
The code in the compiler's DWARF line table generation emits line
table ops at the end of each function fragment to reset the state
machine registers back to an initial state, so that when the line
table fragments for each function are stitched together into a
compilation unit, each fragment will have a clean starting point. The
set-file/set-line ops emitted in this code were being applied to the
last row of the line table, however, meaning that they were
overwriting the existing values.

To avoid this problem, add code to advance the PC past the end of the
last instruction in the function, and switch to just using an
end-of-sequence operator at the end of each function instead of
explicit set-file/set-line ops.

Updates #39757.

Change-Id: Ieb30f83444fa86fb1f2cd53862d8cc8972bb8763
Reviewed-on: https://go-review.googlesource.com/c/go/+/239286
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-06-24 11:57:56 +00:00
Cherry Zhang
9f33108dfa cmd/link: skip zero values in fingerprint check
Normally, packages are loaded in dependency order, and if a
Library object is not nil, it is already loaded with the actual
fingerprint. In shared build mode, however, packages may be added
not in dependency order (e.g. go install -buildmode=shared std
adds all std packages before loading them), and it is possible
that a Library's fingerprint is not yet loaded. Skip the check
in this case (when the fingerprint is the zero value).

Fixes #39777.

Change-Id: I66208e92bf687c8778963ba8e33e9bd948f82f3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/239517
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-23 18:38:32 +00:00
Jeremy Faller
f547046850 [dev.link] cmd/link: rescope Datblk to datblk
Change should be non-functional.

Change-Id: I8ac835762a1aa6458d896b8815cd2d87333b55ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/239279
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-23 18:15:44 +00:00
Katie Hockman
18bcc7c285 net/http: document Dir behavior with symlinks
Based on CL 229377.

Change-Id: I016eec20672c909e8fabe799c277f4d2540fc555
Reviewed-on: https://go-review.googlesource.com/c/go/+/238698
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-06-23 14:32:35 +00:00
Cherry Zhang
37682f7a79 [dev.link] cmd/link: apply relocations while writing symbols
We can apply relocations of a symbol right after the symbol data
is copied to output buffer. This should help locality and
parallelism (parallelizing over blocks, instead of over segments).

Linking cmd/compile,
Asmb+Reloc     23.9ms ±18%    16.5ms ±11%   -30.73%  (p=0.008 n=5+5)

Linking cmd/compile with external linking,
Asmb+Reloc     74.0ms ± 3%    33.8ms ± 8%   -54.32%  (p=0.008 n=5+5)

In external linking mode, allocation goes up slightly, as we do
smaller batching now. It doesn't seem too bad.
Asmb+Reloc     15.0MB ± 0%    16.7MB ± 0%   +11.22%  (p=0.008 n=5+5)

Change-Id: Ide33d9ff86c39124c8f5cfc050d7badc753a1ced
Reviewed-on: https://go-review.googlesource.com/c/go/+/239197
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-23 00:57:30 +00:00
Macks
968e18eebd text/template: fix lint typo in VariableNode doc
Change-Id: I68b8c782478aa3e7adbd36a2de1c20b04e8c395b
GitHub-Last-Rev: 50f2719783
GitHub-Pull-Request: golang/go#39622
Reviewed-on: https://go-review.googlesource.com/c/go/+/239383
Reviewed-by: Rob Pike <r@golang.org>
2020-06-23 00:10:24 +00:00
Cholerae Hu
b486bd8967 runtime: fix comment about memequal implementation locations
Change-Id: I9ae3f462a6a6b3809de14b0d08f369524b636d57
Reviewed-on: https://go-review.googlesource.com/c/go/+/237097
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-22 16:13:31 +00:00
Tobias Klauser
60f7876502 syscall: check secondary group membership for Faccessat(..., AT_EACCESS) on Linux
Follow glibc's implementation and check secondary group memberships
using Getgroups.

No test since we cannot easily change file permissions when not running
as root and the test is meaningless if running as root.

Same as CL 238722 did for x/sys/unix

Updates #39660

Change-Id: I6af50e27b255e33405558947a0ab3dfbc33b2d50
Reviewed-on: https://go-review.googlesource.com/c/go/+/238937
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-20 08:40:13 +00:00
Cherry Zhang
5e526e67e7 [dev.link] all: merge branch 'master' into dev.link
NOT apply CL 238779, which is for sym.Symbols.

Clean merge other than that.

Change-Id: I535e9580fcf7d6f382bd684c3d53f11f90d0b6ed
2020-06-19 16:21:43 -04:00
Cherry Zhang
f2bba30e40 cmd/link: use sym.Symbol in addpersrc
addpersrc is called very late, after we have converted to
sym.Symbols and various fields in loader representation have been
dropped. Use the Symbol representation there.

Fixes #39658.

Change-Id: I616e838655b6f01554644171317e2cc5cefabf39
Reviewed-on: https://go-review.googlesource.com/c/go/+/238779
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-19 20:10:25 +00:00
fanzha02
27a0012bd6 cmd/dist: don't copy arm64 specific files for bootstap build
This patch avoids copying cmd/compile/internal/ssa/flags_arm64_test.s.

Fixes #39701

Change-Id: I35d0567e2d3455faf28828c55a0b6d66a5be49e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/238679
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-19 16:41:13 +00:00
Rodolfo Carvalho
b424a312ea runtime/trace: fix file name in example
The preceding paragraph suggests the test run will produce a file called trace.out.
The same name, trace.out, is used in the output from go help testflag, thus we change the go test line instead of changing the preceding paragraph.

Change-Id: Ib1fa7e49e540853e263a2399b16040ea6f41b703
GitHub-Last-Rev: 3535e62bf8
GitHub-Pull-Request: golang/go#39709
Reviewed-on: https://go-review.googlesource.com/c/go/+/238997
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2020-06-19 16:14:19 +00:00
Richard Miller
af09ff1981 runtime, syscall: use local cache for Setenv/Getenv in Plan 9
In os.Getenv and os.Setenv, instead of directly reading and writing the
Plan 9 environment device (which may be shared with other processes),
use a local copy of environment variables cached at the start of
execution. This gives the same semantics for Getenv and Setenv as on
other operating systems which don't share the environment, making it
more likely that Go programs (for example the build tests) will be
portable to Plan 9.

This doesn't preclude writing non-portable Plan 9 Go programs which make
use of the shared environment semantics (for example to have a command
which exports variable definitions to the parent shell). To do this, use
  ioutil.ReadFile("/env/"+key) and
  ioutil.WriteFile("/env/"+key, value, 0666)
in place of os.Getenv(key) and os.Setenv(key, value) respectively.

Note that CL 5599054 previously added env cacheing, citing efficiency
as the reason. However it made the cache write-through, with Setenv
changing the shared environment as well as the cache (so not consistent
with Posix semantics), and Clearenv breaking the sharing of the
environment between the calling thread and other threads (leading to
unpredictable behaviour). Because of these inconsistencies (#8849),
CL 158970045 removed the cacheing again.

This CL restores cacheing but without write-through. The local cache is
initialised at start of execution, manipulated by the standard functions
in syscall/env_unix.go to ensure the same semantics, and exported only
when exec'ing a new program.

Fixes #34971
Fixes #25234
Fixes #19388
Updates #38772

Change-Id: I2dd15516d27414afaf99ea382f0e00be37a570c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/236520
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Fazlul Shahriar <fshahriar@gmail.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
2020-06-19 11:28:19 +00:00
Keith Randall
3dec253783 reflect: zero stack slots before writing to them with write barriers
reflect.assignTo writes to the target using write barriers. Make sure
that the memory it is writing to is zeroed, so the write barrier does
not read pointers from uninitialized memory.

Fixes #39541

Change-Id: Ia64b2cacc193bffd0c1396bbce1dfb8182d4905b
Reviewed-on: https://go-review.googlesource.com/c/go/+/238760
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-19 02:11:35 +00:00
Keith Randall
a07e28194a cmd/compile: redo flag constant ops for arm64
Fixes the *noov opcodes so they handle a constant argument properly.

Most of the infrastructure for this CL is in CL 238077 (the arm32 one).

Fixes #39505

Change-Id: Id424a4e18964b848f05aa42f4d78e5f2e2cdf43b
Reviewed-on: https://go-review.googlesource.com/c/go/+/237999
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-18 20:58:26 +00:00
Keith Randall
40ef1faabc cmd/compile: redo flag constant ops for arm
Encode the flag results in an auxint field instead of having
one opcode per flag state. This helps us handle the new *noov
branches in a unified manner.

This is only for arm, arm64 is in a subsequent CL.

We could extend to other architectures as well, athough it would
only be cleanup, no behavioral change.

Update #39505

Change-Id: Ia46cea596faad540d1496c5915ab1274571543f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/238077
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-18 20:57:49 +00:00
Michael Munday
377c1536f5 cmd/compile: mark s390x int <-> float conversions as clobbering flags
These conversion instructions set the condition code and so should
be marked as clobbering flags.

Fixes #39651.

Change-Id: I91cc9687ea70ef0551bb3139c1875071c349d43e
Reviewed-on: https://go-review.googlesource.com/c/go/+/238628
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-18 16:36:16 +00:00
Lynn Boger
4379fa1740 cmd/internal/obj/ppc64: update doc
This updates the ppc64 asm doc file, including information on
updates to the objdump, correcting information on operand order,
and adding some information on shifts.

Change-Id: Ib8ed53eac86c2121ea5b657c361ad92aae31cb32
Reviewed-on: https://go-review.googlesource.com/c/go/+/238237
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-18 12:34:50 +00:00
Ian Lance Taylor
d872bbcfec reflect: handling flagIndir in DeepEqual potential cycles
Fixes #39607

Change-Id: Ia7e597e0da8a193a25382cc633a1c6080b4f7cbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/238361
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-18 01:14:19 +00:00
Ian Lance Taylor
84baf4162a doc/go1.15: document new bufio.ErrBadReadCount
For #37419
For #38053

Change-Id: I206f360ff4957bc7edc3c35dfc814b7bd5ec440c
Reviewed-on: https://go-review.googlesource.com/c/go/+/237739
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-18 01:12:21 +00:00
Ian Lance Taylor
292a771b87 net/rpc: clarify documention of Call.Done field
Fixes #36116

Change-Id: I93909f2addee9a9435ad658e8b40eef966ce53fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/238078
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-06-18 01:07:32 +00:00
Andy Balholm
0ce1ffc49d regexp/syntax: append patchLists in constant time
By keeping a tail pointer, we can append to a patchList in constant
time, rather than in time proportional to the length of the list. This
gets rid of the quadratic compile times we were seeing for long series
of alternations.

This is basically the same change as
e9d517989f.

Fixes #39542.

Change-Id: Ib4ca0ca9c55abd1594df1984653c7d311ccf7572
Reviewed-on: https://go-review.googlesource.com/c/go/+/238079
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-18 00:40:11 +00:00