1
0
mirror of https://github.com/golang/go synced 2024-11-07 02:56:11 -07:00
Commit Graph

41639 Commits

Author SHA1 Message Date
Matthew Dempsky
dc72a2f95f cmd/compile: detect unsafe conversions from smaller to larger types
This CL extends the runtime instrumentation for (*T)(ptr) to also
check that the first and last bytes of *(*T)(ptr) are part of the same
heap object.

Updates #22218.
Updates #34959.

Change-Id: I2c8063fe1b7fe6e6145e41c5654cb64dd1c9dd41
Reviewed-on: https://go-review.googlesource.com/c/go/+/201778
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-17 19:29:20 +00:00
Brad Fitzpatrick
4edd78d9f8 doc/go1.14.html: add some TODOs about various ports
Updates #15581
Updates #34368

Change-Id: Ife3be7ed484cbe87960bf972ac701954d86127d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/201740
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-17 18:58:07 +00:00
Matthew Dempsky
ef18d6a929 syscall: avoid "just past the end" pointers in UnixRights
Caught with -d=checkptr.

Updates #22218.

Change-Id: Ic0fcff4d2c8d83e4e7f5e0c6d01f03c9c7766c6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201617
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-17 18:42:47 +00:00
Trung Nguyen
3972f97d04 net/http, net/textproto: add Header.Values, MIMEHeader.Values methods
Fixes #34799

Change-Id: I134b2717fa90c8955902e7eeaaf8510dcc28340e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200760
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-17 18:21:01 +00:00
Bryan C. Mills
f38a510692 os/exec: re-enable TestExtraFiles checks skipped on various OSes
The issues associated with these skipped checks are closed.
If they are working around unfixed bugs, the issues should remain open.
If they are working around unfixable properties of the system, the skips
should refer to those properties rather than closed issues.

Updates #2603
Updates #3955
Updates #25628

Change-Id: I3491c69b2ef5bad0fb12001fe8f7e06b424883ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/201718
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-17 18:16:38 +00:00
Brad Fitzpatrick
4569f1baa8 syscall: remove use of IN_KUBERNETES in test, add a TODO to improve further
Updates #34956

Change-Id: I35c39f3afda7226eeae0fd6936f7ee0d5d6c025b
Reviewed-on: https://go-review.googlesource.com/c/go/+/201737
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-17 17:11:19 +00:00
Brad Fitzpatrick
728a876ae2 net: skip some interface tests on Dragonfly for now
Skipping tests isn't great, but neither is a wall of red masking other
potential regressions.

Updates #34368

Change-Id: I5fdfa54846dd8d648001594c74f059af8af52247
Reviewed-on: https://go-review.googlesource.com/c/go/+/201482
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-17 17:03:29 +00:00
Artem Alekseev
24494440e0 cmd/asm: add missing x86 instructions
Instructions added: CLDEMOTE, CLWB, TPAUSE, UMWAIT, UMONITOR.

Change-Id: I1ba550d4d5acc41a2fd97068ff5834e0412d3bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/183225
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17 16:30:15 +00:00
Bryan C. Mills
00ea8e1c67 os/exec: preserve the process environment when invoking TestHelperProcess
Also log errors from the lsof command on failure.
(That's how the missing environment was discovered.)

Updates #25628

Change-Id: I71594f60c15d0d254d5d4a86deec7431314c92ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/201717
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-17 15:04:49 +00:00
Michael Munday
86235ec2bf cmd/asm/internal/arch: delete unused s390x functions
These functions are not necessary and are not called anywhere.

Change-Id: I1c0d814ba3044c27e3626ac9e6052d8154140404
Reviewed-on: https://go-review.googlesource.com/c/go/+/201697
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-17 14:55:25 +00:00
Than McIntosh
6ecaae0325 [dev.link] cmd/link: remove unused slow paths from BytesAt/StringAt
This change removes the NewReader function (no longer used by objdump)
and prunes away the now unused code paths from Reader.BytesAt and
Reader.StringAt, which helps with performance. At the moment the
reader operates by always ingesting the entire object file (either via
direct read or by mmap), meaning that there will always be a slice
available for us to index into.

Change-Id: I3af7396effe19e50ed594fe8d82fd2d15465687c
Reviewed-on: https://go-review.googlesource.com/c/go/+/201437
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>
2019-10-17 14:20:15 +00:00
Than McIntosh
e5acb58c39 [dev.link] cmd/objdump: switch to using NewReaderFromBytes
Convert the object file dumper to use NewReaderFromBytes when
reading new object files, as opposed to NewReader.

Change-Id: I9f5e0356bd21c16f545cdd70262e983a2ed38bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201441
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17 14:20:08 +00:00
Than McIntosh
6cbf37b30b [dev.link] cmd/link: record go.itablink symbols during object file read
Change the new loader to keep a note of the set of "go.itablink.*"
symbols (using a small map), and add a method that clients can use to
query whether a given global index corresponds to a "go.itablink.*"
sym. This eliminates one instance of raw symbol name reading/matching
during new deadcode, which should produce a minor speedup.

Change-Id: I5915773a3f33c16099ccd68592dbba783d909bc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/201400
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17 14:20:00 +00:00
Than McIntosh
8011051361 [dev.link] cmd: add flag to mark gotype symbols
Add a flag bit to mark symbols in the new object file as containing Go
type information. The use of a flag eliminates the need to do symbol
name matching as part of the new dead code elimination pass, which
should produce a minor speedup.

Change-Id: Iec8700e1139e2c4e310644c0766379865d2d6f82
Reviewed-on: https://go-review.googlesource.com/c/go/+/201399
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17 14:18:37 +00:00
Than McIntosh
15634a0230 [dev.link] cmd: convert symbol "shared" flag to object file flag
For the new object file format, don't tag individual symbols with a
"shared" flag, since that characteristic is better off as an attribute
of the containing object file as opposed to the individual symbol. Add
a new flags field in the object file header and put a bit in the flags
if the shared flags is in effect during compilation.

Change-Id: I2cf6d33bf7bf2fd8a7614ae0cd6ef03914777498
Reviewed-on: https://go-review.googlesource.com/c/go/+/201398
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17 14:18:28 +00:00
Alex Brainman
72ab424bc8 time: change genzabbrs.go to fetch windowsZones.xml file from GitHub
It seems that windowsZones.xml file has moved to Github. I opened

http://unicode.org/cldr/data/common/supplemental/windowsZones.xml

in my browser, and it redirected me to

https://github.com/unicode-org/cldr/blob/master/common/supplemental/windowsZones.xml

Very nice of them.

And we could see windowsZones.xml change history now. We could even
probably file issues against this file, if we find problems.

Anyway, this CL adjusts genzabbrs.go to use new GitHub location.

I also run 'go generate' command with updated genzabbrs.go to update
zoneinfo_abbrs_windows.go.

Fixes #34917

Change-Id: I69b71a4e02edd999435738ecb225a6f9793a66d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/201378
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-17 08:27:57 +00:00
Matthew Dempsky
80a6fedea0 cmd/compile: add -d=checkptr to validate unsafe.Pointer rules
This CL adds -d=checkptr as a compile-time option for adding
instrumentation to check that Go code is following unsafe.Pointer
safety rules dynamically. In particular, it currently checks two
things:

1. When converting unsafe.Pointer to *T, make sure the resulting
pointer is aligned appropriately for T.

2. When performing pointer arithmetic, if the result points to a Go
heap object, make sure we can find an unsafe.Pointer-typed operand
that pointed into the same object.

These checks are currently disabled for the runtime, and can also be
disabled through a new //go:nocheckptr annotation. The latter is
necessary for functions like strings.noescape, which intentionally
violate safety rules to workaround escape analysis limitations.

Fixes #22218.

Change-Id: If5a51273881d93048f74bcff10a3275c9c91da6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/162237
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-17 00:40:21 +00:00
Jay Conrod
3b003c3edb cmd/go/internal/module: fix inverted condition in MatchPathMajor
This was spotted in CL 200767. This change just ensures internal
packages match their equivalents in x/mod.

Also pulled in test added in CL 201517.

Change-Id: I51d23d62697c256548f411930fcb6bccce51bf34
Reviewed-on: https://go-review.googlesource.com/c/go/+/201497
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-16 23:14:14 +00:00
Eugene Kalinin
02196d3657 encoding/json: correct caller's name in encoding errors
1. Change mapencode.encode to use fmt.Error rather than MarshalerError.
MarshalerError refer to MarshalJSON, but mapencode.encode does not use that.

2. Add sourceFunc field to MarshalerError to record the name of the function
that creates the error, so that the Error method can report it correctly.

Fixes #29753

Change-Id: I186c2fac8470ae2f9e300501de3730face642230
Reviewed-on: https://go-review.googlesource.com/c/go/+/184119
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-16 22:58:08 +00:00
Cherry Zhang
2bbf2e0233 [dev.link] cmd/link: add basic shared library support in newobj mode
This CL adds basic shared library support in newobj mode. This is
not complete -- there are still tests in misc/cgo/testshared
failing. But at least a simple program works, and some tests
there pass.

Add the mechanism of loading external symbols with contents.
(Before, external symbols are always contentless.) This may
potentially be also used for other host objects.

Change-Id: I68dbf71e7949cc01ebf37ea159084e798ae16925
Reviewed-on: https://go-review.googlesource.com/c/go/+/201537
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-16 22:28:18 +00:00
Michael Munday
943df4f629 crypto/ecdsa: remove s390x assembly
This a revert of CL 174437 and follow up fix CL 201317.

The s390x assembly in this package makes use of an instruction
(specifically KDSA) which is not supported by the current build
machine. Remove this assembly for now, we can revisit this
functionality once we have a newer build machine and can ensure
that this assembly is well tested.

Updates #34927.

Change-Id: I779286fa7d9530a254b53a515ee76b1218821f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/201360
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-16 21:57:24 +00:00
Bryan C. Mills
b76e6f8825 Revert "cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata"
This reverts CL 190098.

Reason for revert: broke several builders.

Change-Id: I69161352f9ded02537d8815f259c4d391edd9220
Reviewed-on: https://go-review.googlesource.com/c/go/+/201519
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
2019-10-16 20:59:53 +00:00
Emmanuel T Odeke
2718789bc7 io/ioutil: support predictable prefix,suffix for TempDir with *
Allow TempDir to create directories with predictable
prefixes and suffixes, separated by the last "*", for example:
    "prefix*suffix"
will now expand to
    "prefix" + <RANDOM_VALUE> + "suffix"

RELNOTE=yes

Fixes #33805.

Change-Id: I85fa73ae6a684ce820d1810c82a60765eb9c4a42
Reviewed-on: https://go-review.googlesource.com/c/go/+/198488
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-16 20:38:29 +00:00
Dan Scales
dad616375f cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata
Generate inline code at defer time to save the args of defer calls to unique
(autotmp) stack slots, and generate inline code at exit time to check which defer
calls were made and make the associated function/method/interface calls. We
remember that a particular defer statement was reached by storing in the deferBits
variable (always stored on the stack). At exit time, we check the bits of the
deferBits variable to determine which defer function calls to make (in reverse
order). These low-cost defers are only used for functions where no defers
appear in loops. In addition, we don't do these low-cost defers if there are too
many defer statements or too many exits in a function (to limit code increase).

When a function uses open-coded defers, we produce extra
FUNCDATA_OpenCodedDeferInfo information that specifies the number of defers, and
for each defer, the stack slots where the closure and associated args have been
stored. The funcdata also includes the location of the deferBits variable.
Therefore, for panics, we can use this funcdata to determine exactly which defers
are active, and call the appropriate functions/methods/closures with the correct
arguments for each active defer.

In order to unwind the stack correctly after a recover(), we need to add an extra
code segment to functions with open-coded defers that simply calls deferreturn()
and returns. This segment is not reachable by the normal function, but is returned
to by the runtime during recovery. We set the liveness information of this
deferreturn() to be the same as the liveness at the first function call during the
last defer exit code (so all return values and all stack slots needed by the defer
calls will be live).

I needed to increase the stackguard constant from 880 to 896, because of a small
amount of new code in deferreturn().

The -N flag disables open-coded defers. '-d defer' prints out the kind of defer
being used at each defer statement (heap-allocated, stack-allocated, or
open-coded).

Cost of defer statement  [ go test -run NONE -bench BenchmarkDefer$ runtime ]
  With normal (stack-allocated) defers only:         35.4  ns/op
  With open-coded defers:                             5.6  ns/op
  Cost of function call alone (remove defer keyword): 4.4  ns/op

Text size increase (including funcdata) for go cmd without/with open-coded defers:  0.09%

The average size increase (including funcdata) for only the functions that use
open-coded defers is 1.1%.

The cost of a panic followed by a recover got noticeably slower, since panic
processing now requires a scan of the stack for open-coded defer frames. This scan
is required, even if no frames are using open-coded defers:

Cost of panic and recover [ go test -run NONE -bench BenchmarkPanicRecover runtime ]
  Without open-coded defers:        62.0 ns/op
  With open-coded defers:           255  ns/op

A CGO Go-to-C-to-Go benchmark got noticeably faster because of open-coded defers:

CGO Go-to-C-to-Go benchmark [cd misc/cgo/test; go test -run NONE -bench BenchmarkCGoCallback ]
  Without open-coded defers:        443 ns/op
  With open-coded defers:           347 ns/op

Updates #14939 (defer performance)
Updates #34481 (design doc)

Change-Id: I51a389860b9676cfa1b84722f5fb84d3c4ee9e28
Reviewed-on: https://go-review.googlesource.com/c/go/+/190098
Reviewed-by: Austin Clements <austin@google.com>
2019-10-16 18:27:16 +00:00
Fazlul Shahriar
e94475eab1 net: fix multicast and IPv6 related issues on Plan 9
Fix issues that make these tests pass:
- TestDialerLocalAddr: return error if local address is not IPv4 for
"tcp4" network.
- TestInterfaceAddrs, TestInterfaceUnicastAddrs: don't assume each
interface has only one address. It may have more than one or none.
- TestConcurrentPreferGoResolversDial: should be skipped on Plan 9.
- TestListenMulticastUDP: remove IP from `announce` command and don't
mix IPv4 address with IPv6 address in `addmulti` command.

Fixes #34931

Change-Id: Ie0fdfe19ea282e5d6d6c938bf3c9139f8f5b0308
Reviewed-on: https://go-review.googlesource.com/c/go/+/201397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-16 17:46:16 +00:00
Ben Shi
f6c624a22a cmd/internal/obj/arm: remove NaCl related DATABUNDLE
Updates golang/go#30439

Change-Id: Ieaf18b7cfd22a768eb1b7ac549ebc03637258876
Reviewed-on: https://go-review.googlesource.com/c/go/+/201377
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-16 15:58:33 +00:00
Cherry Zhang
5caac2f73e [dev.link] cmd: default to new object files
Switch the default to new object files.

Internal linking cgo is disabled for now, as it does not work yet
in newobj mode.

Shared libraries are also broken.

Disable some tests that are known broken for now.

Change-Id: I8ca74793423861d607a2aa7b0d89a4f4d4ca7671
Reviewed-on: https://go-review.googlesource.com/c/go/+/200161
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-16 15:57:07 +00:00
Than McIntosh
c9470b0483 [dev.link] cmd/link/internal/objfile: relocate loader to new package
Third change of several to update the loader API to reflect the final
consensus version of the loader API as described in Cherry's doc.
This piece:

   - move objfile.Loader into its own separate package, and update
     clients accordingly.

This includes a few minor cleanups, including converting a couple
of loader-related functions to methods, and privatizing some of the
loader methods such as ToGlobal/ToLocal.

Change-Id: Iae20585751a45491d8b19dcffc096aadae6bbfc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/200998
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-16 13:24:55 +00:00
Agniva De Sarker
03bb3e9ad1 cmd/internal/obj/wasm,cmd/link/internal/wasm: add fast path for writeUleb128
While building a simple hello world binary, there are total 858277 calls
to writeUleb during the assembler phase out of which 836625 (97%) are less than 7 bits.

Using a simple micro-benchmark like this:

func BenchmarkUleb(b *testing.B) {
	var buf bytes.Buffer
	for i := 0; i < b.N; i++ {
		writeUleb128(&buf, 42)
		buf.Reset()
	}
}

We get the following results with the fast path enabled.

name    old time/op  new time/op  delta
Uleb-4  8.45ns ± 2%  7.51ns ± 2%  -11.16%  (p=0.000 n=10+10)

Applying the time taken to the number of calls, we get roughly 6% improvement
in total time taken for writeUleb128.

We also apply the change to the function in linker to make it consistent.

Change-Id: I9fe8c41df1209f5f3aa7d8bd0181f1b0e536ceb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/201177
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-16 06:29:51 +00:00
bill_ofarrell
86f40a2e03 crypto/ecdsa: fix buffer size on s390x for ecdsa
I used too small a size for buffers, which can cause a panic in some testing.
The new buffer size is generous and sufficient for all purposes.

Fixes #34927
Fixes #34928

Change-Id: Icdbbfed5da87fe3757be40dfd23182b37ec62d58
Reviewed-on: https://go-review.googlesource.com/c/go/+/201317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-16 03:09:29 +00:00
Cherry Zhang
c4817f5d4f cmd/compile: on Wasm and AIX, let deferred nil function panic at invocation
The Go spec requires

	If a deferred function value evaluates to nil, execution
	panics when the function is invoked, not when the "defer"
	statement is executed.

On Wasm and AIX, currently we actually emit a nil check at the
point of defer statement, which will make it panic too early.
This CL fixes this.

Also, on Wasm, now the nil function will be passed through
deferreturn to jmpdefer, which does an explicit nil check and
calls sigpanic if it is nil. This sigpanic, being called from
assembly, is ABI0. So change the assembler backend to also
handle sigpanic in ABI0.

Fixes #34926.
Updates #8047.

Change-Id: I28489a571cee36d2aef041f917b8cfdc31d557d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/201297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-16 00:05:37 +00:00
Ian Lance Taylor
dc37bd2ac9 cmd/go: add test for gccgo name mangling crash
Updates #33871

Change-Id: I73b1513a89ad89126159ce03ee72b922cd01916c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200837
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-15 23:45:22 +00:00
Robert Griesemer
898f9db81f math/big: make Rat accessors safe for concurrent use
Do not modify the underlying Rat denominator when calling
one of the accessors Float32, Float64; verify that we don't
modify the Rat denominator when calling Inv, Sign, IsInt, Num.

Fixes #34919.
Reopens #33792.

Change-Id: Ife6d1252373f493a597398ee51e7b5695b708df5
Reviewed-on: https://go-review.googlesource.com/c/go/+/201205
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-15 23:31:58 +00:00
Ian Lance Taylor
52e5987f5d os: keep attr.Files alive when calling StartProcess
Updates #34810
Fixes #34858

Change-Id: Ie934861e51eeafe8a7fd6653c4223a5f5d45efe8
Reviewed-on: https://go-review.googlesource.com/c/go/+/201198
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-15 20:34:04 +00:00
Ian Lance Taylor
831e3cfaa5 runtime: change netpoll to take an amount of time to block
This new facility will be used by future CLs in this series.

Change the only blocking call to netpoll to do the right thing when
netpoll returns an empty list.

Updates #6239
Updates #27707

Change-Id: I58b3c2903eda61a3698b1a4729ed0e81382bb1ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/171821
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-15 20:29:56 +00:00
Cherry Zhang
4a9b30cfc9 [dev.link] cmd/internal/goobj2: provide accessor methods for flags
Per Jeremy's comment in CL 199643. This makes the code read
better.

Change-Id: If270aecd712a27fb52e3faf5a4339200327d9ffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/201023
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-15 19:00:07 +00:00
Cherry Zhang
7256f50065 [dev.link] cmd/link: let cgo import overwrite contentless data symbol
A contentless data symbol may be a declaration of a cgo-imported
variable, e.g.

	//go:cgo_import_dynamic xxx
	var xxx uintptr

In this case, we want to mark the symbol imported, instead of
defined with zero value.

We used to load cgo directives before loading the object file, so
we'll mark the symbol SDYNIMPORT first. But in newobj mode,
currently we load cgo directives later. Letting SDYNIMPORT
overwrite contentless data symbol makes it work in both ordering.

Change-Id: I878f52086d6cdb5a347669bf8f848a49bce87b52
Reviewed-on: https://go-review.googlesource.com/c/go/+/201020
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-15 19:00:00 +00:00
Cherry Zhang
5fec788239 [dev.link] cmd/link: add dupok symbols resolved to another package to textp
When a dupok symbol is resolved to another package, we still need
to record its presence in the current package, as the trampoline
pass expects packages are laid out in dependency order. At the
point after deadcode where we populate symbol contents for
reachable symbols (add relocations and read symbol data), make a
note of the dupok text symbols for each package. Later in
addToTextp we will visit packages in dependency order, process
the dup text symbol list for each package and select a final lib
for each dup text symbol.

Change-Id: Ib885e0a7e2343229d853aa629e3e337111df6011
Reviewed-on: https://go-review.googlesource.com/c/go/+/200797
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-15 18:59:52 +00:00
Cherry Zhang
6ba3ae9ca5 [dev.link] cmd/internal/obj, cmd/link: add InlTree in new object files
Add InlTree to the FuncInfo aux symbol in new object files.

In the linker, change InlinedCall.Func from a Symbol to a string,
as we only use its Name. (There was a use of Func.File, but that
use is not correct anyway.) So we don't need to create a Symbol
if not necessary.

Change-Id: I38ce568ae0934cd9cb6d0b30599f1c8d75444fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/200098
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-15 18:56:08 +00:00
Cherry Zhang
dab05a0484 [dev.link] cmd/link: implement symbol overwrite logic
If two defined symbols have the same name, one contentless and
one with content, the one with content "wins". This is mainly for
go:linkname on data symbols. Support this logic in newobj mode.

Introduce an "overwrite" mechanism, letting one symbol overwrite
another. This machanism could later be used for the linker
overwriting symbol contents (e.g. -X flag).

Change-Id: I32ee7d4b82df275f11b38c3abefc99b878ff12d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200097
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-15 18:55:59 +00:00
Cherry Zhang
27111e5fec [dev.link] cmd/internal/obj, cmd/link: use aux symbol for DWARF symbols
Use the auxiliary symbol mechanism to connect the text symbol and
its associated DWARF symbols. This way, the linker can track the
DWARF symbols from the text symbol, without looking up special
names.

Currently, in the linker this is only used in the deadcode pass
to track which DWARF symbols are used and need to load. Later
passes still use name lookup for now.

Change-Id: I2fe49f3b1f0ecc1472ae8aa93907cff740022d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/199801
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-15 18:55:48 +00:00
Cherry Zhang
cab29ebd84 [dev.link] cmd/link: create sym.Symbols after deadcode in newobj mode
With the new object files, now we can run the deadcode pass on
indices instead of Symbol structs, so we can delay creating
Symbols after the deadcode pass. Then we only need to create
reachable symbols.

Not create Symbols in LoadNew and LoadRefs, and recombine
LoadReloc into LoadFull.

Split loadcgo into two parts: the first finds root symbols, the
second create Symbols and sets attributes. The first runs before
the deadcode pass, while the second runs after.

TODO: currently there are still symbols that are not marked
reachable but still used. This includes DWARF symbols, file
symbols, and type symbols that are referenced by DWARF symbols.
We still need to create them (conservatively).

Change-Id: I695779c9312be9d49ab1683957ac3e72e1f65a1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/199643
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-15 18:55:32 +00:00
Brad Fitzpatrick
6da300b196 net/http: remove references to old NPN support
We now only support ALPN.

Updates #28362

Change-Id: I8d9461c7a91315ee92e712448d0bf5c4070d09ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/201202
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-15 18:20:42 +00:00
Bryan C. Mills
e7394e178d cmd/go: omit new 'vendor/modules.txt' annotations if the go version is 1.13 or lower
Updates #33848

Change-Id: I887d78179d467030f4177d1834ccefee28a55c8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/201257
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-15 18:15:22 +00:00
Ian Lance Taylor
47759fbab7 time: avoid or clarify CEST
In the tzdata database CEST is not recognized as a timezone name.
It is used as the abbreviated name for daylight saving time in
Central Europe.  Avoid using CEST in documentation as it suggests
that programs can parse dates that use CEST, which will typically
fail on Unix systems.

Updates #34913

Change-Id: I4b22f7d06607eb5b066812a48af58edd95498286
Reviewed-on: https://go-review.googlesource.com/c/go/+/201197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-15 17:48:38 +00:00
Michael Anthony Knyszek
2c87be436b runtime: call goready in wakeScavenger instead of ready
This changes fixes an oversight in wakeScavenger which would cause ready
to be called off of the system stack. This change makes it so that
wakeScavenger calls goready, which switches to the system stack before
calling ready.

Fixes #34773.

Change-Id: Icb13f180b4d8fdd47c921eac1b896e3dd49e43b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200999
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-15 17:29:47 +00:00
Cherry Zhang
90fe9c7c5c [dev.link] cmd/internal/obj: convert "\" to "/" in file path
The old code does this. Do the same.

Change-Id: Ibf32ac347d6425e19ad0bc664c6b43ab5eba9c5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/201022
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-15 17:13:55 +00:00
Ben Shi
11d7775c9f cmd/compile: remove some nacl SSA rules
Updates golang/go#30439

Change-Id: I7ef5301fbd650d26a37a1241ddf7ca1ccd58b89d
Reviewed-on: https://go-review.googlesource.com/c/go/+/200941
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-15 16:45:31 +00:00
David Chase
6adaf17eaa cmd/compile: preserve statements in late nilcheckelim optimization
When a subsequent load/store of a ptr makes the nil check of that pointer
unnecessary, if their lines differ, change the line of the load/store
to that of the nilcheck, and attempt to rehome the load/store position
instead.

This fix makes profiling less accurate in order to make panics more
informative.

Fixes #33724

Change-Id: Ib9afaac12fe0d0320aea1bf493617facc34034b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200197
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-15 16:43:44 +00:00
Keith Randall
c2c2ba280c cmd/compile: fix fmt test
CL 196781 added map[int64]uint32 to the set of things printed with %v.

Fixes #34907

Change-Id: If4a13e86cfb4b691988f5fb70449ae23760f5789
Reviewed-on: https://go-review.googlesource.com/c/go/+/201079
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-15 01:10:46 +00:00