1
0
mirror of https://github.com/golang/go synced 2024-09-23 21:20:13 -06:00
Commit Graph

45796 Commits

Author SHA1 Message Date
Nikhil Benesch
4d27c4c223 runtime: correct error handling in several FreeBSD syscall wrappers
The FreeBSD syscall convention uses the carry flag to indicate whether
an error has occured. The sys_umtx_op, thr_new, and pipe2 syscall
wrappers were failing to account for this convention and silently
suppressing errors as a result. This commit corrects these wrappers
by copying the pattern used by the other fallible syscall wrappers.

Note that futexsleep1 must now explicitly ignore the ETIMEDOUT error
from sys_umtx_op. Previously ETIMEDOUT was implicitly ignored because
sys_umtx_op never returned an error.

Fixes #43106.

Change-Id: I9c422b87cf4c6d308003bf42c3b419f785578b5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/276892
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Trust: Than McIntosh <thanm@google.com>
2020-12-22 15:59:17 +00:00
Cherry Zhang
9b6147120a cmd/pack: treat compiler's -linkobj output as "compiler object"
Treat the compiler's -linkobj output as "compiler object, which
means "pack c" will "see through" the file and add individual
entry to the new archive, instead of the object as a whole.

This is somewhat peculiar. But Go 1.15's cmd/pack does this,
although seemingly accidental. We just do the same. FWIW, it
does make things more consistent with/without -linkobj flag.

Fixes #43271.

Change-Id: I6b2d99256db7ebf0fa430f85afa7464e334f6bcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/279483
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-12-22 15:50:18 +00:00
Cherry Zhang
bc7e4d9257 syscall: don't generate ptrace on iOS
May fix #43302.

Change-Id: I6b7ddf94495c4fa80cf8a50a38eef5f8b2872669
Reviewed-on: https://go-review.googlesource.com/c/go/+/279481
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-21 21:48:47 +00:00
Michael Anthony Knyszek
6cff874c47 runtime/metrics: add Read examples
This change adds two examples of using the Read function: one that reads
one metric and one that reads all metrics.

Change-Id: I4940a44c9b1d65f3f7a1554e3145ff07e6492fc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/275855
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2020-12-21 19:28:12 +00:00
Cherry Zhang
8438a5779b runtime: use _exit on darwin
On darwin, where we use libc for syscalls, when the runtime exits,
it calls libc exit function, which may call back into user code,
e.g. invoking functions registered with atexit. In particular, it
may call back into Go. But at this point, the Go runtime is
already exiting, so this wouldn't work.

On non-libc platforms we use exit syscall directly, which doesn't
invoke any callbacks. Use _exit on darwin to achieve the same
behavior.

No test for now, as it doesn't pass on all platforms (see trybot
run of PS2).

May fix #42465.
May fix #43294.

Change-Id: Ia1ada22b5da8cb64fdd598d0541eb90e195367eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/269378
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-21 19:16:38 +00:00
Michael Pratt
cb95819cf6 runtime: detect netbsd netpoll overrun in sysmon
The netbsd kernel has a bug [1] that occassionally prevents netpoll from
waking with netpollBreak, which could result in missing timers for an
unbounded amount of time, as netpoll can't restart with a shorter delay
when an earlier timer is added.

Prior to CL 232298, sysmon could detect these overrun timers and
manually start an M to run them. With this fallback gone, the bug
actually prevents timer execution indefinitely.

As a workaround, we add back sysmon detection only for netbsd.

[1] https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50094

Updates #42515

Change-Id: I8391f5b9dabef03dd1d94c50b3b4b3bd4f889e66
Reviewed-on: https://go-review.googlesource.com/c/go/+/277332
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Trust: Michael Pratt <mpratt@google.com>
2020-12-21 18:00:57 +00:00
Richard Miller
53c984d976 runtime: skip wakep call in wakeNetPoller on Plan 9
This was part of a performance improvement made by CL 232298 to
reduce timer latency. On multiprocessor Plan 9 machines, it triggers
memory faults often enough that the builder test suite never completes
successfully. See issue #42303 for discussion. As shown by the benchmark
result below, worst case latency on plan9_arm is very bad even with the
wakep call in place - in the tickers-per-P=1 case, a 3ms timer is 270ms late.
Skipping the wakep call and running the benchmark again shows some cases
worse, some better. The performance cost doesn't seem excessive for this
temporary workaround which makes the plan9_arm builders usable again.

With wakep call:

cpu% go test -bench Latency time
goos: plan9
goarch: arm
pkg: time
BenchmarkParallelTimerLatency-4     	     100	  10985859 avg-late-ns	  18630963 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-4          	     195	 270294688 avg-late-ns	 542057670 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-4          	     234	 182452000 avg-late-ns	 423933688 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-4          	     280	 193003004 avg-late-ns	 408034405 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-4          	     282	 132819086 avg-late-ns	 313624570 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-4          	     339	  71152187 avg-late-ns	 189014519 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-4          	     315	  26860484 avg-late-ns	 101759844 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-4          	     357	  19106739 avg-late-ns	  59435620 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-4          	     376	   7246933 avg-late-ns	  38888461 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-4          	     267	  40476892 avg-late-ns	 205851926 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-4         	     294	  87836303 avg-late-ns	 252059695 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-4            	     379	   4127144 avg-late-ns	  10494927 max-late-ns

Without wakep call:

BenchmarkParallelTimerLatency-4     	      61	  10775151 avg-late-ns	  18668517 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-4          	     199	 299587535 avg-late-ns	 597182307 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-4          	     272	 184561831 avg-late-ns	 449739837 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-4          	     235	 154983257 avg-late-ns	 370940553 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-4          	     290	 150034689 avg-late-ns	 332399843 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-4          	     298	  47540764 avg-late-ns	 133709031 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-4          	     350	  20379394 avg-late-ns	  81742809 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-4          	     363	  14403223 avg-late-ns	  98901212 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-4          	     375	  12293090 avg-late-ns	  50266552 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-4          	     336	  40628820 avg-late-ns	 150946099 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-4         	     289	  88265539 avg-late-ns	 280770418 max-late-ns
BenchmarkStaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-4            	     375	   8364937 avg-late-ns	  22598421 max-late-ns

Fixes #42303

Change-Id: I70c63cb2a2bad46950a7cd9dfc7bb32943710d32
Reviewed-on: https://go-review.googlesource.com/c/go/+/275672
Reviewed-by: David du Colombier <0intro@gmail.com>
Trust: Michael Pratt <mpratt@google.com>
2020-12-21 17:56:36 +00:00
Ian Lance Taylor
9abbe27710 test: skip issue11656.go on mips/mips64/ppc64
For #11656
For #43283

Change-Id: I1fcf2b24800f421e36201af43130b487abe605b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/279312
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2020-12-21 04:23:39 +00:00
Matthew Dempsky
89b44b4e2b cmd/compile: recognize reassignments involving receives
Previously, reassigned was failing to detect reassignments due to
channel receives in select statements (OSELRECV, OSELRECV2), or due to
standalone 2-value receive assignments (OAS2RECV). This was reported
as a devirtualization panic, but could have caused mis-inlining as
well.

Fixes #43292.

Change-Id: Ic8079c20c0587aeacff9596697fdeba80a697b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/279352
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-20 09:43:29 +00:00
Ian Lance Taylor
55b58018f4 test: for issue11656 try to execute trap, not call it
The issue11656 code was using the trap instruction as a PC value,
but it is intended to call a PC value that contains the trap instruction.

It doesn't matter too much as in practice the address is not
executable anyhow. But may as well have the code act the way it
is documented to act.

Also, don't run the test with gccgo/GoLLVM, as it can't work.
The illegal instruction will have no unwind data, so the unwinder
won't be able to get past it. In other words, gccgo/GoLLVM suffer
from the exact problem that the issue describes, but it seems insoluble.

For golang/go#11656

Change-Id: Ib2e50ffc91d215fd50e78f742fafe476c92d704e
Reviewed-on: https://go-review.googlesource.com/c/go/+/278473
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-19 00:20:38 +00:00
Ian Lance Taylor
626cc7c02d test: permit "exponent too large" error
The language spec only requires a signed binary exponent of 16 bits
for floating point constants. Permit a "exponent too large" error for
larger exponents.

Don't run test 11326b with gccgo, as it requires successful compilation
of floating point constants with exponents that don't fit in 16 bits.

Change-Id: I98688160c76864aba525a151a14aaaf86bc36a6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/279252
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-12-18 23:47:11 +00:00
Ian Lance Taylor
139cd0e12f go/build: make TestDependencies work again
CL 243940 accidentally broke TestDependencies such that it always passed.
Make it work again, and add a test so that it won't break in the same way.

This revealed that the new embed package was missing from TestDepencies,
so add it.

Fixes #43249

Change-Id: I02b3e38dd35ad88880c4344d46de13b7639aa4c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/279073
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-12-18 19:44:42 +00:00
Ian Lance Taylor
2de7866470 os: remove dependency on strings package
Historically the os package has not imported the strings package.
That was enforced by go/build.TestDependencies, but that test
was accidentally broken (#43249). A dependency of os on strings
was accidentally added by CL 266364; remove it.

For #42026
For #43249

Change-Id: If932308f30561fdcc5c608d7563e849c0d2870d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/279072
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-12-18 18:25:14 +00:00
Henrique Vicente
ae652a4ac9 os/signal: fix flaky tests for NotifyContext.
Test failures started to happen sporadically on some builds after the introduction of NotifyContext.
To make these tests more robust and avoid the risk of crosstalk we run them in a separate process.

Fixes #41561.

Change-Id: Ia7af105c316afd11765358f1e5e253ccfe2adc2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/270198
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Cherry Zhang <cherryyz@google.com>
2020-12-18 04:42:39 +00:00
Than McIntosh
740851baca cmd/link: avoid use of -T when linking with lld
When doing external linking on Windows, auto-detect the linker flavor
(bfd vs gold vs lld) and when linking with "lld", avoid the use of
"-T" (linker script), since this option is not supported by lld.
[Note: the Go linker currently employs -T to ensure proper placement
of the .debug_gdb_scripts section, to work around issues in older
versions of binutils; LLD recognizes this section and does place it
properly].

Updates #39326.

Change-Id: I3ea79cdceef2316bf86eccdb60188ac3655264ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/278932
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-18 00:16:17 +00:00
Ian Lance Taylor
f1778c28a9 test: recognize and use gc build tag
Change the run.go driver to recognize the "gc" build tag.

Change existing tests to use the "gc" build tag if they use some
feature that seems specific to the gc compiler, such as passing specific
options to or expecting specific behavior from "go tool compile".
Change tests to use the "!gccgo" build tag if they use "go build" or
"go run", as while those might work with compilers other than gc, they
won't work with the way that gccgo runs its testsuite (which happens
independently of the go command).

For #43252

Change-Id: I666e04b6d7255a77dfc256ee304094e3a6bb15ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/279052
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-18 00:10:44 +00:00
Dmitri Shuralyov
8fcf318123 api/go1.16: remove crypto/tls APIs that are moved to Go 1.17
CL 269697 was created before CL 276454 and submitted after,
so the api/go1.16.txt file needs to be updated accordingly
to fix the build.

Updates #32406.

Change-Id: I6bf79cc981be504e0baefa82982814aaee4434dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/278992
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-12-17 20:25:45 +00:00
Johan Brandhorst
520f3b72db crypto/tls: revert "add HandshakeContext method to Conn"
This reverts CL 246338.

Reason for revert: waiting for 1.17 release cycle

Updates #32406

Change-Id: I074379039041e086c62271d689b4b7f442281663
Reviewed-on: https://go-review.googlesource.com/c/go/+/269697
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
2020-12-17 20:04:25 +00:00
Dmitri Shuralyov
2ff33f5e44 api: promote next to go1.16
Change-Id: Id7d242ddd4b80a763787513d0a658dd7aea9db7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/276454
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-12-17 16:03:19 +00:00
Ian Lance Taylor
5a4db102b2 html/template: avoid race when escaping updates template
Fixes #39807

Change-Id: Icf384f800e2541bc753507daa3a9bc7e5d1c3f79
Reviewed-on: https://go-review.googlesource.com/c/go/+/274450
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roberto Clapis <roberto@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-12-17 03:20:55 +00:00
Rob Findley
b0f01e17f8 go/types: report error for invalid (but empty) expr switch
This is a port of CL 278132 from the dev.typeparams branch. A notable
addition is a new error code, since no existing codes made sense and we
have an analogous code for type switches.

Fixes #43110

Change-Id: I22b3f9d8777063223f82785504e8b7d299bc5216
Reviewed-on: https://go-review.googlesource.com/c/go/+/278813
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
2020-12-16 22:45:19 +00:00
Cherry Zhang
5abda2618b cmd/link: handle large relocation addend on darwin/arm64
Mach-O relocation addend is signed 24-bit. When external linking,
if the addend is larger, we cannot put it directly into a Mach-O
relocation. This CL handles large addend by creating "label"
symbols at sym+0x800000, sym+(0x800000*2), etc., and emitting
Mach-O relocations that target the label symbols with a smaller
addend. The label symbols are generated late (similar to what
we do for RISC-V64).

One complexity comes from handling of carrier symbols, which does
not track its size or its inner symbols. But relocations can
target them. We track them in a side table (similar to what we
do for XCOFF, xcoffUpdateOuterSize).

Fixes #42738.

Change-Id: I8c53ab2397f8b88870d26f00e9026285e5ff5584
Reviewed-on: https://go-review.googlesource.com/c/go/+/278332
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>
2020-12-16 16:40:57 +00:00
Cherry Zhang
a318d56c1e cmd/link: pass arch-specific flags to external linker when testing supported flag
When testing if a flag (e.g. "-no-pie") is supported by the
external linker, pass arch-specific flags (like "-marm").

In particular, on the ARM builder, if CGO_LDFLAGS=-march=armv6
is set, the C toolchain fails to build if -marm is not passed.

	# cc -march=armv6 1.c
	1.c: In function 'main':
	1.c:3:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
	 int main() {
	 ^~~

This makes the Go linker think "-no-pie" is not supported when it
actually is.

Passing -marm makes it work.

Fixes #43202.

Change-Id: I4e8b71f08818993cbbcb2494b310c68d812d6b50
Reviewed-on: https://go-review.googlesource.com/c/go/+/278592
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>
2020-12-16 16:37:40 +00:00
Than McIntosh
f4e7a6b905 cmd/internal/goobj: fix buglet in object file reader
The code in the new (introduced in 1.15) Go object file reader was
casting a pointer-mmaped-memory into a large array prior to performing
a read of the relocations section:

	return (*[1<<20]Reloc)(unsafe.Pointer(&r.b[off]))[:n:n]

For very large object files, this artificial array isn't large enough
(that is, there are more than 1048576 relocs to read), so update the
code to use a larger artifical array size.

Fixes #41621.

Change-Id: Ic047c8aef4f8a3839f2e7e3594bce652ebd6bd5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/278492
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Than McIntosh <thanm@google.com>
2020-12-16 14:09:20 +00:00
Tobias Klauser
75e16f5127 doc/go1.16: add link to reflect.StructTag
For #40700.

Change-Id: I67dd55b435304e428929c9a54b8881f9b78efdfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/278392
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-16 09:01:04 +00:00
Meng Zhuo
08b5091d03 net: close connection in localServer teardown
The transponder sets up a deferred close on accepted connections which
is fine after the client reads all data. However there are no mutexes
nor channels to block the transponder from closing. If the scheduler
runs close before the client read, it will cause an EOF failure.

Fixes #42720

Change-Id: Ic21b476c5efc9265a80a2c6f8484efdb5af66405
Reviewed-on: https://go-review.googlesource.com/c/go/+/273672
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Damien Neil <dneil@google.com>
2020-12-16 02:14:48 +00:00
Jason A. Donenfeld
8981092d71 cmd/link: ignore SEH marking on PE objects
Microsoft's linker looks at whether all input objects have an empty
section called @feat.00. If all of them do, then it enables SEH;
otherwise it doesn't enable that feature. So, since around the Windows
XP SP2 era, most tools that make PE objects just tack on that section,
so that it won't gimp Microsoft's linker logic. Go doesn't support SEH,
so in theory, none of this really matters to us. But actually, if the
linker tries to ingest an object with @feat.00 -- which are produced by
LLVM's resource compiler, for example -- it chokes because of the
IMAGE_SYM_ABSOLUTE section that it doesn't know how to deal with. Since
@feat.00 is just a marking anyway, skip IMAGE_SYM_ABSOLUTE sections that
are called @feat.00.

Change-Id: I1d7bfcf6001186c53e2c487c5ac251ca65efefee
Reviewed-on: https://go-review.googlesource.com/c/go/+/268239
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-12-16 00:08:40 +00:00
Ian Lance Taylor
731bb54038 test: update for gofrontend error message changes
fixedbugs/bug195.go:9:20: error: interface contains embedded non-interface
fixedbugs/bug195.go:12:20: error: interface contains embedded non-interface
fixedbugs/bug195.go:15:22: error: interface contains embedded non-interface
fixedbugs/bug195.go:18:9: error: invalid recursive interface
fixedbugs/bug195.go:26:9: error: invalid recursive interface

fixedbugs/bug251.go:15:9: error: invalid recursive interface

fixedbugs/issue23823.go:15:9: error: invalid recursive interface

Change-Id: If4c22430557459d5b361beda7168f8cb42b58811
Reviewed-on: https://go-review.googlesource.com/c/go/+/278512
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-15 21:45:05 +00:00
Ian Lance Taylor
129bb1917b doc/go1.15: mention 1.15.3 cgo restriction on empty structs
For #40954

Change-Id: I6a30aed31a16e820817f4ca5c7f591222e922946
Reviewed-on: https://go-review.googlesource.com/c/go/+/277432
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-12-15 21:04:49 +00:00
Ian Lance Taylor
685a322fe4 test: match gofrontend error messages
fixedbugs/issue11614.go:14:9: error: interface contains embedded non-interface
fixedbugs/issue11614.go:22:20: error: interface contains embedded non-interface

Change-Id: Ie9875916697833f5fa28ab890218851a741120ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/278175
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-15 21:01:37 +00:00
Ian Lance Taylor
3d6467824c test: only require issue11674 errors with gc compiler
The gofrontend code sees that the denominator is not zero,
so it computes the values. Dividing zero by a non-zero value
produces zero. The language spec doesn't require any of these
cases to report an error, so make the errors compiler-specific.

Change-Id: I5ed759a3121e38b937744d32250adcbdf2c4d3c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/278117
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-12-15 20:58:17 +00:00
Ian Lance Taylor
7cdc84a15b test: remove bug429 (duplicates runtime.TestSimpleDeadlock)
The bug429 tests is an exact duplicate of TestSimpleDeadlock in the
runtime package. The runtime package is the right place for this test,
and the version in the runtime package will run faster as the build
step is combined with other runtime package tests.

Change-Id: I6538d24e6df8e8c5e3e399d3ff37d68f3e52be56
Reviewed-on: https://go-review.googlesource.com/c/go/+/278173
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-15 20:55:01 +00:00
Ian Lance Taylor
412dc2f4d3 test: adjust issue11371 to fit in required precision
The language spec only requires that floating point values be
represented with 256 bits, which is about 1e75. The issue11371 test
was assuming that the compiler could represent 1e100. Adjusting the
test so that it only assumes 256 bits of precision still keeps the
test valid, and permits it to pass when using the gofrontend.

Change-Id: I9d1006e9adc9438277f4b8002488c912e5d61cc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/278116
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-15 20:50:35 +00:00
Ian Lance Taylor
8e2d74b705 test: only check for issue11362 error with gc
With the gc compiler the import path implies the package path,
so keeping a canonical path is important.  With the gofrontend
this is not the case, so we don't need to report this as a bug.

Change-Id: I245e34f9b66383bd17e79438d4b002a3e20aa994
Reviewed-on: https://go-review.googlesource.com/c/go/+/278115
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-15 20:46:33 +00:00
Ian Lance Taylor
f8ac237032 test: import file name for issue19028
The pattern in NNN.dir directories is that if we have a.go,
the other files import "./a". For gc it happens to work to use a path,
but not for gofrontend. Better to be consistent.

Change-Id: I2e023cbf6bd115f9fb77427b097b0ff9b9992f17
Reviewed-on: https://go-review.googlesource.com/c/go/+/278113
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-15 20:45:24 +00:00
Tobias Klauser
a508840c67 doc/go1.16: fix path, path/filepath release notes
The path package doesn't have a Glob function. Adjust the release notes
re. CL 264397 accordingly.

Also add links to the documentation of all mentioned functions.

For #40700.

Change-Id: Ibf3e0530fa6fab36a3f6fbc664f0800869ce9ec7
Reviewed-on: https://go-review.googlesource.com/c/go/+/278213
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-15 16:31:07 +00:00
Tobias Klauser
5046cb8a6e doc/go1.16: fix formatting in net, net/http and net/http/httputil sections
For #40700.

Change-Id: I83d9ef9f79d59a0165a47ccc938fc2bf40e90703
Reviewed-on: https://go-review.googlesource.com/c/go/+/278212
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-15 16:30:24 +00:00
Meng Zhuo
3298300ddf text/template: error on range over send channel
template range require channel contains RecvDir
if recv on send only channel will raise an panic.

Fixes #43065

Change-Id: Ie0ea70ce60e074bf8c9f2378e07ef1d4c41dc38f
Reviewed-on: https://go-review.googlesource.com/c/go/+/276532
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2020-12-15 13:59:00 +00:00
Ian Lance Taylor
5a25a3fd1d test: recognize gofrontend error messages
fixedbugs/issue26416.go:24:16: error: unknown field ‘t1f1’ in ‘t2’
fixedbugs/issue26416.go:25:16: error: unknown field ‘t1f2’ in ‘t3’
fixedbugs/issue26416.go:26:16: error: unknown field ‘t2f1’ in ‘t3’

fixedbugs/issue26616.go:15:9: error: single variable set to multiple-value function call
fixedbugs/issue26616.go:9:5: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:12:13: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:13:13: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:15:9: error: incompatible type in initialization (multiple-value function call in single-value context)
fixedbugs/issue26616.go:14:11: error: incompatible types in assignment (multiple-value function call in single-value context)

fixedbugs/issue26855.go:23:12: error: incompatible type for field 1 in struct construction
fixedbugs/issue26855.go:27:12: error: incompatible type for field 1 in struct construction

fixedbugs/issue25958.go:14:18: error: expected ‘<-’ or ‘=’
fixedbugs/issue25958.go:15:35: error: expected ‘<-’ or ‘=’

fixedbugs/issue28079b.go:13:9: error: array bound is not constant
fixedbugs/issue28079b.go:16:22: error: invalid context-determined non-integer type for left operand of shift

fixedbugs/issue28079c.go:14:22: error: invalid context-determined non-integer type for left operand of shift

fixedbugs/issue28450.go:9:19: error: ‘...’ only permits one name
fixedbugs/issue28450.go:10:18: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:11:16: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:11:24: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:13:25: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:15:19: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:16:21: error: ‘...’ must be last parameter
fixedbugs/issue28450.go:16:31: error: ‘...’ must be last parameter

fixedbugs/issue28268.go:20:1: error: method ‘E’ redeclares struct field name
fixedbugs/issue28268.go:19:1: error: method ‘b’ redeclares struct field name

fixedbugs/issue27356.go:14:14: error: expected function
fixedbugs/issue27356.go:18:9: error: expected function

fixedbugs/issue29855.go:13:11: error: unknown field ‘Name’ in ‘T’

fixedbugs/issue27938.go:14:15: error: expected package
fixedbugs/issue27938.go:18:13: error: expected package
fixedbugs/issue27938.go:22:13: error: expected package
fixedbugs/issue27938.go:22:9: error: expected signature or type name

fixedbugs/issue29870b.go:13:9: error: ‘x’ declared but not used

fixedbugs/issue30085.go:10:18: error: wrong number of initializations
fixedbugs/issue30085.go:11:21: error: wrong number of initializations

fixedbugs/issue30087.go:10:18: error: wrong number of initializations
fixedbugs/issue30087.go:11:11: error: number of variables does not match number of values
fixedbugs/issue30087.go:12:9: error: wrong number of initializations
fixedbugs/issue30087.go:13:9: error: wrong number of initializations

fixedbugs/issue28926.go:16:14: error: use of undefined type ‘G’
fixedbugs/issue28926.go:18:14: error: use of undefined type ‘E’
fixedbugs/issue28926.go:22:24: error: use of undefined type ‘T’

fixedbugs/issue30722.go:13:13: error: invalid numeric literal
fixedbugs/issue30722.go:14:13: error: invalid numeric literal
fixedbugs/issue30722.go:15:13: error: invalid numeric literal

fixedbugs/issue33308.go:12:19: error: invalid context-determined non-integer type for left operand of shift

fixedbugs/issue33386.go:16:9: error: expected operand
fixedbugs/issue33386.go:22:9: error: expected operand
fixedbugs/issue33386.go:26:17: error: expected operand
fixedbugs/issue33386.go:27:18: error: expected operand
fixedbugs/issue33386.go:28:29: error: expected operand
fixedbugs/issue33386.go:15:17: error: reference to undefined name ‘send’
fixedbugs/issue33386.go:27:13: error: reference to undefined name ‘a’
fixedbugs/issue33386.go:21:19: error: value computed is not used

fixedbugs/issue33460.go:34:10: error: duplicate key in map literal
fixedbugs/issue33460.go:21:9: error: duplicate case in switch
fixedbugs/issue33460.go:24:9: error: duplicate case in switch
fixedbugs/issue33460.go:25:9: error: duplicate case in switch

fixedbugs/issue32723.go:12:14: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:13:13: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:16:16: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:17:16: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:18:15: error: invalid comparison of non-ordered type
fixedbugs/issue32723.go:21:15: error: invalid comparison of non-ordered type

fixedbugs/issue35291.go:13:9: error: duplicate value for index 1

fixedbugs/issue38745.go:12:12: error: reference to undefined field or method ‘M’
fixedbugs/issue38745.go:13:16: error: reference to undefined field or method ‘M’
fixedbugs/issue38745.go:17:19: error: reference to undefined field or method ‘M’
fixedbugs/issue38745.go:17:9: error: not enough arguments to return

fixedbugs/issue41500.go:16:22: error: incompatible types in binary expression
fixedbugs/issue41500.go:17:26: error: incompatible types in binary expression
fixedbugs/issue41500.go:18:22: error: incompatible types in binary expression
fixedbugs/issue41500.go:19:26: error: incompatible types in binary expression

fixedbugs/issue41575.go:23:6: error: invalid recursive type
fixedbugs/issue41575.go:9:6: error: invalid recursive type ‘T1’
fixedbugs/issue41575.go:13:6: error: invalid recursive type ‘T2’
fixedbugs/issue41575.go:17:6: error: invalid recursive type ‘a’
fixedbugs/issue41575.go:18:6: error: invalid recursive type ‘b’
fixedbugs/issue41575.go:19:6: error: invalid recursive type ‘c’
fixedbugs/issue41575.go:25:6: error: invalid recursive type ‘g’
fixedbugs/issue41575.go:32:6: error: invalid recursive type ‘x’
fixedbugs/issue41575.go:33:6: error: invalid recursive type ‘y’

fixedbugs/issue4215.go:10:9: error: not enough arguments to return
fixedbugs/issue4215.go:14:9: error: return with value in function with no return type
fixedbugs/issue4215.go:19:17: error: not enough arguments to return
fixedbugs/issue4215.go:21:9: error: not enough arguments to return
fixedbugs/issue4215.go:27:17: error: not enough arguments to return
fixedbugs/issue4215.go:29:17: error: too many values in return statement
fixedbugs/issue4215.go:31:17: error: not enough arguments to return
fixedbugs/issue4215.go:43:17: error: not enough arguments to return
fixedbugs/issue4215.go:46:17: error: not enough arguments to return
fixedbugs/issue4215.go:48:9: error: too many values in return statement
fixedbugs/issue4215.go:52:9: error: too many values in return statement

fixedbugs/issue41247.go:10:16: error: incompatible type for return value 1

fixedbugs/issue41440.go:13:9: error: too many arguments

fixedbugs/issue6772.go:10:16: error: ‘a’ repeated on left side of :=
fixedbugs/issue6772.go:17:16: error: ‘a’ repeated on left side of :=

fixedbugs/issue6402.go:12:16: error: incompatible type for return value 1

fixedbugs/issue6403.go:13:23: error: reference to undefined identifier ‘syscall.X’
fixedbugs/issue6403.go:14:15: error: reference to undefined name ‘voidpkg’

fixedbugs/issue7746.go:24:20: error: constant multiplication overflow

fixedbugs/issue7760.go:15:7: error: invalid constant type
fixedbugs/issue7760.go:16:7: error: invalid constant type
fixedbugs/issue7760.go:18:7: error: invalid constant type
fixedbugs/issue7760.go:19:7: error: invalid constant type
fixedbugs/issue7760.go:21:11: error: expression is not constant
fixedbugs/issue7760.go:22:11: error: expression is not constant
fixedbugs/issue7760.go:24:7: error: invalid constant type
fixedbugs/issue7760.go:25:7: error: invalid constant type

fixedbugs/issue7129.go:18:11: error: argument 1 has incompatible type (cannot use type bool as type int)
fixedbugs/issue7129.go:19:11: error: argument 1 has incompatible type (cannot use type bool as type int)
fixedbugs/issue7129.go:20:11: error: argument 1 has incompatible type (cannot use type bool as type int)
fixedbugs/issue7129.go:20:17: error: argument 2 has incompatible type (cannot use type bool as type int)

fixedbugs/issue7150.go:12:20: error: index expression is negative
fixedbugs/issue7150.go:13:13: error: some element keys in composite literal are out of range
fixedbugs/issue7150.go:14:13: error: some element keys in composite literal are out of range
fixedbugs/issue7150.go:15:13: error: some element keys in composite literal are out of range
fixedbugs/issue7150.go:16:13: error: some element keys in composite literal are out of range

fixedbugs/issue7675.go:16:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:16:24: error: argument 3 has incompatible type (cannot use type string as type float64)
fixedbugs/issue7675.go:16:9: error: not enough arguments
fixedbugs/issue7675.go:16:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:18:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:18:24: error: argument 3 has incompatible type (cannot use type string as type float64)
fixedbugs/issue7675.go:18:28: error: argument 4 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:18:9: error: too many arguments
fixedbugs/issue7675.go:18:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:19:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:19:9: error: not enough arguments
fixedbugs/issue7675.go:19:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:21:11: error: argument 1 has incompatible type (cannot use type int as type string)
fixedbugs/issue7675.go:21:19: error: argument 3 has incompatible type
fixedbugs/issue7675.go:21:14: error: floating-point constant truncated to integer
fixedbugs/issue7675.go:23:14: error: floating-point constant truncated to integer

fixedbugs/issue7153.go:11:15: error: reference to undefined name ‘a’
fixedbugs/issue7153.go:11:18: error: incompatible type for element 1 in composite literal
fixedbugs/issue7153.go:11:24: error: incompatible type for element 2 in composite literal

fixedbugs/issue7310.go:12:13: error: left argument must be a slice
fixedbugs/issue7310.go:13:13: error: second argument must be slice or string
fixedbugs/issue7310.go:14:15: error: incompatible types in binary expression

fixedbugs/issue6964.go:10:13: error: invalid type conversion (cannot use type complex128 as type string)

fixedbugs/issue7538a.go:14:9: error: reference to undefined label ‘_’

fixedbugs/issue8311.go:14:9: error: increment or decrement of non-numeric type

fixedbugs/issue8507.go:12:6: error: invalid recursive type ‘T’

fixedbugs/issue9521.go:16:20: error: argument 2 has incompatible type
fixedbugs/issue9521.go:17:20: error: argument 2 has incompatible type (cannot use type float64 as type int)

fixedbugs/issue8385.go:30:19: error: argument 1 has incompatible type (type has no methods)
fixedbugs/issue8385.go:30:14: error: not enough arguments
fixedbugs/issue8385.go:35:9: error: not enough arguments
fixedbugs/issue8385.go:36:9: error: not enough arguments
fixedbugs/issue8385.go:37:10: error: not enough arguments
fixedbugs/issue8385.go:38:10: error: not enough arguments
fixedbugs/issue8385.go:39:10: error: not enough arguments
fixedbugs/issue8385.go:40:10: error: not enough arguments
fixedbugs/issue8385.go:41:13: error: not enough arguments

fixedbugs/issue8438.go:13:23: error: incompatible type for element 1 in composite literal
fixedbugs/issue8438.go:14:22: error: incompatible type for element 1 in composite literal
fixedbugs/issue8438.go:15:23: error: incompatible type for element 1 in composite literal

fixedbugs/issue8440.go:10:9: error: reference to undefined name ‘n’

Change-Id: I5707aec7d3c9178c4f4d794d4827fc907b52efb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/278032
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-15 02:35:59 +00:00
Jason A. Donenfeld
663cd862ed cmd/link: do not mark resource section as writable
Resources are immutable, and all other linkers set this section to be
read-only and not read-write. Fix this oversight by removing the writable
flag.

Change-Id: Ib441bde6620be2000f1685df1ea7bfaebdbe7860
Reviewed-on: https://go-review.googlesource.com/c/go/+/268258
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-12-14 22:39:04 +00:00
Jason A. Donenfeld
48dfa2b2dc cmd/link: deal with ADDR32NB relocations the same way as ADDR32 on arm
As far as I can tell, the addend is the same for both of these, and in
this context we don't really care about setting or unsetting the thumb
selection bit, so just treat these the same way.

Change-Id: I3756c027239f77778c32b317733df9ac92272580
Reviewed-on: https://go-review.googlesource.com/c/go/+/268238
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-12-14 22:35:02 +00:00
Jason A. Donenfeld
033390d9ad cmd/link: recognize arm header of PE objects
The linker recognizes headers for 386 and amd64 PE objects, but not arm
objects. This is easily overlooked, since its the same as the 386 header
value, except the two nibbles of the first word are swapped. This commit
simply adds the check for this. Without it, .syso objects are rejected,
which means Windows binaries can't have resources built into them. At
the same time, we add comments to better indicate which condition
applies to which arch.

Change-Id: I210411d978504c1a9540e23abc5a180e24f159ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/268237
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-12-14 22:34:47 +00:00
Brad Fitzpatrick
48906a6d57 net/http/pprof: don't treat os.Args as format string in Cmdline handler
Found by @josharian running staticcheck against a fork of this code
elsewhere.

Change-Id: Ica8bae5df71adde1a71e541dd55b0b81b97b3baf
Reviewed-on: https://go-review.googlesource.com/c/go/+/277992
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
2020-12-14 22:28:10 +00:00
Rob Findley
6e3cc5c56f go/types: report invalid ... in conversions
This is a port of CL 277072 from the dev.typeparams branch.

Fixes #43124

Change-Id: I1424c396dc1ea984ec85b8f31a4d43353bf7e4fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/277352
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>
2020-12-14 22:05:52 +00:00
Tobias Klauser
278b9a8a4a io/fs: fix package reference in FS godoc
Reported by Ben on golang-dev
https://groups.google.com/g/golang-dev/c/gsoj5Vv15j0/m/kZxzYUdnAQAJ

Change-Id: Ic2c9600b831592ad54036b816138760b7fbb737a
Reviewed-on: https://go-review.googlesource.com/c/go/+/277377
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>
2020-12-14 22:04:37 +00:00
Tobias Klauser
d06794da4a doc/go1.16: add missing <code> tag
For #40700.

Change-Id: I616429f82a44cea32701ed0af6e42ed6c71ee097
Reviewed-on: https://go-review.googlesource.com/c/go/+/277378
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-14 21:09:33 +00:00
Katie Hockman
dea6d94a44 math/big: add test for recursive division panic
The vulnerability that allowed this panic is
CVE-2020-28362 and has been fixed in a security
release, per #42552.

Change-Id: I774bcda2cc83cdd5a273d21c8d9f4b53fa17c88f
Reviewed-on: https://go-review.googlesource.com/c/go/+/277959
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-12-14 20:56:03 +00:00
Daniel S Fava
2f5b1a3974 test: make a race detector test robust to timing variations
The `external_cgo_thread` test in `runtime/race/output_test.go` was
producing intermittent failures.  The test was performing a sleep,
which may not be enough depending on how long it takes to setup the
callBack goroutine.

Added a synchronization to make sure callBack finishes before main ends.

Whether the increment to racy++ happens first in the callBack
or in main doesn't matter: the race detector should flag the race
regardless.  The output check was changed so that the test passes
regardless of which increment occurs first.

Fixes #43008

Change-Id: I325ec3dea52b3725e739fbf2bd7ae92875d2de10
Reviewed-on: https://go-review.googlesource.com/c/go/+/276752
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2020-12-14 20:30:16 +00:00
Anmol Sethi
c81343ce3a net/http: attempt deadlock fix in TestDisableKeepAliveUpgrade
1. The test now checks the response status code.
2. The transport has been changed to not set "Connection: Close" if
   DisableKeepAlive is set and the request is a HTTP/1.1 protocol
   upgrade.

Updates #43073

Change-Id: I9977a18b33b8747ef847a8d11bb7b4f2d8053b8c
GitHub-Last-Rev: f809cebb13
GitHub-Pull-Request: golang/go#43086
Reviewed-on: https://go-review.googlesource.com/c/go/+/276375
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-14 19:19:09 +00:00
Ian Lance Taylor
828746ec57 debug/dwarf: don't try to parse addr/rnglists header
In an executable, the debug_addr and debug_rnglists sections are
assembled by concatenating the input sections, and each input section
has a header, and each header may have different attributes. So just
parsing the single header isn't right.  Parsing the header is not
necessary to handle offsets into these sections which is all we do.

Looking at the header is also problematic because GCC with
-gsplit-dwarf when using DWARF versions 2 through 4 emits a
.debug_addr section, but it has no header.  The header was only added
for DWARF 5. So we can't parse the header at all for that case, and we
can't even detect that case in general.

This CL also fixes SeekPC with addrx and strx formats, by not using
the wrong compilation unit to find the address or string base.
To make that work when parsing the compilation unit itself, we add
support for delay the resolution of those values until we know the base.

New test binaries built with

gcc -gdwarf-5 -no-pie debug/dwarf/testdata/line[12].c
(gcc (Debian 10.2.0-15) 10.2.0)

clang -gdwarf-5 -no-pie debug/dwarf/testdata/line[12].c
(clang version 9.0.1-14)

Change-Id: I66783e0eded629bf80c467767f781164d344a54d
Reviewed-on: https://go-review.googlesource.com/c/go/+/277233
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-12-14 18:06:06 +00:00