1
0
mirror of https://github.com/golang/go synced 2024-11-24 13:40:19 -07:00
Commit Graph

51999 Commits

Author SHA1 Message Date
Russ Cox
2bbf383774 net/mail: improve detection of charset errors
The detection of the "unknown charset" case was too tailored
to one specific address parser. Make it generalize, so that custom
address parsers behave the same way as the default one
for character sets they do not handle.

Fixes #41625.

Change-Id: I347d4bb6844d0a1f23e908b776d21e8be5af3874
Reviewed-on: https://go-review.googlesource.com/c/go/+/283632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-25 19:04:59 +00:00
Cuong Manh Le
f25631b490 cmd/compile/internal/ir: remove NewClosureExpr
The only usage of NewClosureExpr is inside NewClosureFunc, which is its
alternative version. So just remove NewClosureExpr and inline it there.

Change-Id: I1900f4fbb48d7b4f6e6a857f7f7760cd27302671
Reviewed-on: https://go-review.googlesource.com/c/go/+/395855
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-25 18:19:09 +00:00
Maisem Ali
1d19cea740 net/http/httptest: fix race in Server.Close
When run with race detector the test fails without the fix.

Fixes #51799

Change-Id: I273adb6d3a2b1e0d606b9c27ab4c6a9aa4aa8064
GitHub-Last-Rev: a5ddd146a2
GitHub-Pull-Request: golang/go#51805
Reviewed-on: https://go-review.googlesource.com/c/go/+/393974
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2022-03-25 16:08:06 +00:00
Cuong Manh Le
3fd8b8627f cmd/compile: handle sole component for 1-byte type interface conversion
For 1-byte type, we have a special case for converting to interface
type. But we missed an optimization for sole component-ed types, this CL
add that one.

goos: linux
goarch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Benchmark_BoolField-8    	1000000000	         0.6473 ns/op
Benchmark_ByteField-8    	1000000000	         0.6094 ns/op
Benchmark_Uint8Field-8   	1000000000	         0.6385 ns/op
Benchmark_Int16Field-8   	785179434	         1.481 ns/op
Benchmark_Int32Field-8   	796127782	         1.539 ns/op
Benchmark_Int64Field-8   	718815478	         1.657 ns/op

Fixes #49879

Change-Id: Idc0e9d3ff738c8c8081b8e8d65093dacf2bcf392
Reviewed-on: https://go-review.googlesource.com/c/go/+/367755
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-25 15:15:57 +00:00
fanzha02
8ab42a945a cmd/compile: merge ANDconst and UBFX into UBFX on arm64
Add a new rewrite rule to merge ANDconst and UBFX into
UBFX.

Add test cases.

Change-Id: I24d6442d0c956d7ce092c3a3858d4a3a41771670
Reviewed-on: https://go-review.googlesource.com/c/go/+/377054
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-25 01:24:44 +00:00
Damien Neil
a10a209b23 net/http/httputil: ignore CloseNotify when a non-background context is present
If the http.Request passed to ReverseProxy.ServeHTTP has a context
with a non-nil Done channel, don't watch the ResponseWriter's
CloseNotify channel.

Avoids starting an extra background goroutine in the common case.

Change-Id: I1328f3e02d3025caa0f446a2f20dfc14ef604c64
Reviewed-on: https://go-review.googlesource.com/c/go/+/376415
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Damien Neil <dneil@google.com>
2022-03-24 21:51:49 +00:00
Robert Findley
b88600f926 go/types, types2: clean up a few typos, and an unused const
Change-Id: I01717cc52c9728b4eaaf2c996707f59a113bff9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/395434
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2022-03-24 21:50:14 +00:00
Matthew Dempsky
b95d332c7e test: compile source files as if from "test" module
This CL updates test/run.go to compile xxx.dir/x.go with a package
path of "test/x" instead of just "x". This prevents collisions with
standard library packages.

It also requires updating a handful of tests to account for the
updated package paths.

Fixes #25693.

Change-Id: I49208c56ab3cb229ed667d547cd6e004d2175fcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/395258
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-24 17:50:47 +00:00
Romanos Skiadas
b2643c6739 runtime: update framepointer_enabled doc
Change-Id: I69e64ebf8c11145ce32aa4c11178e3a47d22fb84
Reviewed-on: https://go-review.googlesource.com/c/go/+/394915
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2022-03-24 15:51:28 +00:00
Cherry Mui
cccfb8ffdb cmd/link: do not add label symbols for DWARF on Windows/ARM64
Label symbols are only useful for relocations from text. No need
to do it for DWARF. And the PE symbol table doesn't like them.

May fix #51903.

Change-Id: Ibe6ea880d8533ba1dcc017030072c7dffee0e9e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/395215
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-03-24 14:44:47 +00:00
Daniel Martí
0ed31eb73b cmd/gofmt: return a proper error for empty Go files
I was testing edge cases in gofumpt, a fork of gofmt,
and noticed that gofmt will return a bare io error on empty files,
as demonstrated by the added test case without a fix:

        > ! exec $GOROOT/bin/gofmt empty.go nopackage.go
        [stderr]
        EOF
        nopackage.go:1:1: expected 'package', found not

The problem is the code that detects concurrent modifications.
It relies on ReadFull and correctly deals with io.ErrUnexpectedEOF,
but it did not pay attention to io.EOF, which can happen when size==0.

Change-Id: I6092391721edad4584fb5922d3e3a8fb3da86493
Reviewed-on: https://go-review.googlesource.com/c/go/+/393757
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-24 09:17:34 +00:00
Robert Griesemer
9058080319 cmd/compile: clarify help message for -L flag
The file names reported in error messages by the compiler are
printed unchanged from the file names provided to the compiler;
the -L flag has no impact on the file names themselves, contrary
to what the old flag description suggested.

If an error is reported on a line that is affected by a //line
directive, an error message reports the file name and line as
controlled by the directive (i.e., the actual source position
is not known).

If the -L flag is provided, the actual source position is also
reported in square brackets.

This change documents this with an updated help string for the
flag.

For #36988.

Change-Id: I39ee35e6ff6cd5cfa44d87dabb05b8d78575d631
Reviewed-on: https://go-review.googlesource.com/c/go/+/395115
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-03-24 03:55:46 +00:00
Cuong Manh Le
209521c3e3 cmd/compile: refactor walkIndexMap
So all runtime map functions will use the same code path, make it easier
for future CL to handle stack object for map key.

Passes toolstash -cmp.

For #43753

Change-Id: I374fa4e351c1eba079e2ccb637b1ef5adad1488f
Reviewed-on: https://go-review.googlesource.com/c/go/+/321713
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-24 03:04:13 +00:00
Matthew Dempsky
60be4ec096 test: remove unused oldescape_linkname.dir directory
CL 187617 removed oldescape_linkname.go, but forgot to remove this
directory too.

Change-Id: I6d208c4d96d636b3df93adec1ee22fe1d4f5f61d
Reviewed-on: https://go-review.googlesource.com/c/go/+/395259
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-24 02:16:28 +00:00
Matthew Dempsky
d14c02a20c test: remove obsolete test case that misuses -p
bug302 compiles p.go with -p=p, and then manually creates a pp.a
archive, and imports it as both "p" and "pp". This is a misuse of
cmd/compile's -p flag, and it isn't representative of how any actual
Go build systems work anyway.

This test made sense back when cmd/compile still wrote out bare object
files, which was then split into separate __.PKGDEF and _go_.o archive
entries when added to a pack archive. But since CL 102236, cmd/compile
always writes out pack files.

Updates #51734.

Change-Id: I4b5de22d348ecc0a72c98b512351c2d267c77736
Reviewed-on: https://go-review.googlesource.com/c/go/+/393896
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-24 02:15:49 +00:00
Matthew Dempsky
999589e148 test: use dot-relative imports where appropriate
Currently, run.go's *dir tests allow "x.go" to be imported
interchangeably as either "x" or "./x". This is generally fine, but
can cause problems when "x" is the name of a standard library
package (e.g., "fixedbugs/bug345.dir/io.go").

This CL is an automated rewrite to change all `import "x"` directives
to use `import "./x"` instead. It has no effect today, but will allow
subsequent CLs to update test/run.go to resolve "./x" to "test/x" to
avoid stdlib collisions.

Change-Id: Ic76cd7140e83b47e764f8a499e59936be2b3c876
Reviewed-on: https://go-review.googlesource.com/c/go/+/395116
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-24 02:14:15 +00:00
Meng Zhuo
849e42f028 cmd/compile: update riscv64 CALL* ops
This CL allow the CALL ops to take variable number of arguments.

Change-Id: If84bb306c2f23a0a934e31dfeabbca7bed0c1796
Reviewed-on: https://go-review.googlesource.com/c/go/+/360216
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-24 01:26:58 +00:00
Cuong Manh Le
947bf333fc cmd/compile/internal/types: simplify AllowsGoVersion
After CL 394556, only LocalPkg is passed to AllowsGoVersion, so simplify
the code to not depend on Pkg anymore.

Change-Id: I8f9bfd4090100eec60cf3959c0d8fa92a26fc32a
Reviewed-on: https://go-review.googlesource.com/c/go/+/394954
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-23 19:31:59 +00:00
Cuong Manh Le
0eb2c77124 cmd/compile: remove types.Field.{Broken,SetBroken}
SetBroken is never called and Broken always returns false.

Updates #51691

Change-Id: I7e3fd3f2121268596d2e93a28c69e895bcf802ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/394558
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23 19:31:50 +00:00
Cuong Manh Le
2792a414c6 cmd/compile/internal/types: remove anyBroke
anyBroke now always return false, we can get rid of it.

Updates #51691

Change-Id: Idab5bc9f9f222cc63e50bdde2b23b9404a4bd74e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394557
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23 19:31:43 +00:00
Cuong Manh Le
810868c9f6 cmd/compile: remove AllowsGoVersion checks in old typechecker
types2 handles those checks instead.

The only exception is noder.checkEmbed, since when types2
have not known about "//go:embed" pragma yet.

Updates #51691

Change-Id: I74ded03536023fe838f23fa7421e04513f904f66
Reviewed-on: https://go-review.googlesource.com/c/go/+/394556
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-23 19:31:36 +00:00
Cuong Manh Le
489e4882ef cmd/compile: remove typecheck.FuncBody
CL 388535 removed the only usage of this function.

Change-Id: Ie5a61cce75b03d83162f62989fe52388b069c9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394576
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23 19:31:29 +00:00
Cuong Manh Le
c10fb50894 cmd/compile: remove ir.Node.SetDiag
And use base.Fatalf in code that use n.SetDiag(true) instead.

Updates #51691

Change-Id: Ib3c0b9c89b8d95717391cbe7d424240e288ada1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394575
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23 19:31:19 +00:00
Cuong Manh Le
515135f4c3 cmd/compile: remove types.Type.SetBroken
And use base.Fatalf in code that use t.SetBroke(true) instead.

Updates #51691

Change-Id: I9f3613379dd82d0dd069cdf7b61cbb281810e2e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/394574
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23 19:31:11 +00:00
Cuong Manh Le
7e0a1d340f cmd/compile: remove reportTypeLoop
reportTypeLoop used to be used to report invalid recursive types in old
typechecker.

However, types2 now reports this error, so this can be removed.

Updates #51691

Change-Id: I5e73369dadafb0cc56e682668b32cbd1e1210f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394554
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23 19:31:03 +00:00
Robert Griesemer
f9747b7f73 go/types, types2: report struct type for literals with too few/many elements
This change essentially matches the 1.17 compiler error message for
this error.

Fixes #51877.

Change-Id: I24ec2f9cc93d8cd2283d097332a39bc1a0eed3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394914
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-03-23 18:22:52 +00:00
Cherry Mui
dd211cf039 debug/gosym: skip non-real functions in LineToPC lookup
The code iterates through the func table to find a function with
a given file and line number. The code panics if it sees a non-
real function (e.g. go.buildid), because its CU offset is -1,
which causes an index-out-of-bounds error. The debug/gosym package
recovers the panic and returns "not found", without looping
through the rest of the entries.

Skip the non-real functions. They cannot be looked up by line
number anyway.

Fixes #51890.

Change-Id: I96f64c17b4a53ffdce047c8244b35a402a0d39ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/395074
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2022-03-23 17:12:00 +00:00
Cherry Mui
909a7a3213 cmd/compile: don't mark non-generic defined type symbol dupok
For a non-generic defined type, we generate its type descriptor
symbol only in the defining package. So there is no duplicate and
it doesn't need to be dupok.

For unnamed types and instantiated types, the type descriptor can
be generated in multiple packages and so still need to be dupok.

Change-Id: I92ed68c998ad68c5917b77b1dfd62eac4ced6bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/394636
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-23 16:12:07 +00:00
Cherry Mui
20ba3f5de5 cmd/compile: default to -p=main for main package
With the previous CL the compiler emits an unlinkable object if
the -p flag is not specified. It is actually okay (and convenient)
to omit the -p flag for (just) the main package. This CL makes it
so.

Change-Id: I978d54d14c45b3bb9ed7471e40a2c47f269b56f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/394834
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-23 14:57:56 +00:00
Robert Griesemer
1e34c00b4c go/types, types2: remove uses of "type list" and "operational type" (cleanup)
Fixes #49193.

Change-Id: Ief31ea6b3dddf9452efb94763c89b8639aa3ce9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394656
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-22 23:20:56 +00:00
Robert Findley
fd1b5904ae cmd/compile/internal/importer: key tparams by Package instead of pkgname
The importer type param index used package name type parameter key,
causing type parameters to be reused/overwritten if two packages in the
import graph had the same combination of (name, declaration name, type
parameter name).

Fix this by instead using the *Package in the key.

Fixes #51836

Change-Id: I881ceaf3cf7c1ab4e0835962350feb552e79b233
Reviewed-on: https://go-review.googlesource.com/c/go/+/394219
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2022-03-22 21:38:10 +00:00
Rhys Hiltner
212bda0669 runtime/pprof: rerun magnitude test on failure
Restructure TestCPUProfileMultithreadMagnitude so it will run again with
a longer duration on failure. Log the split between the user vs system
CPU time that rusage reports.

For #50232

Change-Id: Ice5b38ee7594dbee1eaa5686d32b968c306e3e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/393934
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2022-03-22 21:31:40 +00:00
Cherry Mui
ac3efc83e6 cmd/link: write output in temp dir in TestUnlinkableObj
For unlinkable object the link will fail, but it opens the output
file in writable mode first then delete it on failure. This fails
if the current directory is not writable. Write to the temporary
directory instead.

Change-Id: Iefd73b5cc8efdc0f11b12edc0920169a8ad3f37c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394755
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-22 21:04:24 +00:00
Paul E. Murphy
946167906e runtime: make static/dynamic startup detection work with musl on ppc64le
The glibc loader explicitly sets the first doubleword on the stack (R1)
to $0 to indicate it was dynamically loaded.

An ELFv2 ABI compliant loader will set R3/R4 to argc/argv when starting
the process, and R13 to TLS. musl is not compliant. Instead it passes
argc/argv like the kernel, but R3/R4 are in an undefined state and R13
is valid.

With the knowledge above, the startup code can be modified to
dynamically handle all three cases when linked internally.

Fixes #51787

Change-Id: I5de33862c161900d9161817388bbc13a65fdc69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394654
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Paul Murphy <murp@ibm.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2022-03-22 20:56:39 +00:00
eric fang
817d6ea2b3 runtime: delete useless TPIDR macro on arm64
The TPIDR macro in tls_arm64.h is not used anywhere, so remove it
to reduce confusion.

Change-Id: I04aa5e64ee30753f28f43bc67b44559d81d093c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/373357
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-03-22 20:46:22 +00:00
Cherry Mui
77680a0644 cmd/link: simplify content hashed symbol handling
Symbol's content hash used to depend on package path expansion in
symbol names, so we have special logic handling hashed symbols
when path expansion is needed. As we required -p in the compiler
the symbol names are now fully expanded. Remove that logic.

Change-Id: I888574f63ea3789455d96468a6abd500e0958230
Reviewed-on: https://go-review.googlesource.com/c/go/+/394218
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-22 19:39:12 +00:00
Cherry Mui
e853464055 cmd/compile, cmd/link: produce unlinkable object when compile without -p
CL 391014 requires the compiler to be invoked with the -p flag, to
specify the package path. People are used to run "go tool compile"
from the command line with the -p flag. This is mostly for simple
testing, or debugging the compiler. The produced object file is
almost never intended to be linked.

This CL makes the compiler allow "go tool compile" without the -p
flag again. It will produce an unlinkable object. If the linker
sees such an object it will error out.

Change-Id: I7bdb162c3cad61dadd5c456d903b92493a3df20f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394217
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-22 19:38:35 +00:00
Austin Clements
63ea27e9e0 cmd/compile: add short self-link to ABI spec
This makes the short link discoverable.

Change-Id: I9a2f091652bc096feebbbd79a854aa68efe702bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394634
Trust: Austin Clements <austin@google.com>
Reviewed-by: Eli Bendersky‎ <eliben@golang.org>
2022-03-22 16:51:29 +00:00
Ben Shi
38707059ab A+C: change email of Ben Shi (individual CLA)
Change-Id: Icff75d5fbbeae7aa5003a848ea49b79ddde9933a
GitHub-Last-Rev: 489a69fc6b
GitHub-Pull-Request: golang/go#51869
Reviewed-on: https://go-review.googlesource.com/c/go/+/394595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
2022-03-22 16:02:31 +00:00
hopehook
eca0d44cec net/http: fix nil body causing ParseMultipartForm to panic
ParseMultipartForm relies on a valid multipartReader, if the request body is nil,
the multipartReader should return an error. This way ParseMultipartForm can return
an error instead of causing mr.ReadForm(maxMemory) to panic

Fixes #48206

Change-Id: Ief906f2340c7ab29cacbd5f56892117202a0b911
Reviewed-on: https://go-review.googlesource.com/c/go/+/384454
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
2022-03-22 15:16:23 +00:00
Ian Lance Taylor
96567fb3cc os: skip TestOpenFileLimit on openbsd/mips64
For #46279
For #51713

Change-Id: I444f309999bf5576449a46a9808b23cf6537e7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/394094
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2022-03-22 14:34:01 +00:00
Cherry Mui
42d2d5e2b5 cmd/link: delete oReader.flags
Same information is provided from the fields of the embedded
goobj.Reader, and are accessed through it. Delete the flags field.

Change-Id: I7a4f5dca054e567443d719b2931fceff231d6efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394216
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-03-22 14:16:25 +00:00
Robert Findley
2da1e47fb0 go/types, types: add additional generic cases for the Selections API
Change-Id: Icc5240db7447846061d0d81f5e15f788758d4d64
Reviewed-on: https://go-review.googlesource.com/c/go/+/393372
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-22 13:07:38 +00:00
Byoungchan Lee
a8f019e956 cmd/link: add DT_NEEDED for all 64-bit ELF dynimplib
Also change the relevant test to be tested on the linux-arm64 platform
as well.

Fixes #49789

Change-Id: Id2eac7a45279f037957442862f8ed63838b8e929
Reviewed-on: https://go-review.googlesource.com/c/go/+/366855
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-22 10:00:16 +00:00
Jakub Ciolek
86c8075675 runtime: combine wbuf checks in tryGetFast and putFast
Less text and improves codegen a bit.

compilecmp on ARM64:

runtime
(*gcWork).putFast 160 -> 144  (-10.00%)
(*gcWork).tryGetFast 144 -> 128  (-11.11%)
scanobject 784 -> 752  (-4.08%)
greyobject 800 -> 784  (-2.00%)

AMD64:

runtime
greyobject 765 -> 748  (-2.22%)
(*gcWork).tryGetFast 102 -> 85  (-16.67%)
scanobject 837 -> 820  (-2.03%)
(*gcWork).putFast 102 -> 89  (-12.75%)

Change-Id: I6bb508afe1ba416823775c0bfc08ea9dc21de8a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/393754
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
2022-03-21 22:42:59 +00:00
Robert Griesemer
4b6debaf28 cmd/gofmt: don't descend into /testdata directories in tests (fix long builders)
Now that the go/types and types2 test files end in .go we must
avoid trying to format them as that won't work in general.

Change-Id: I05fdd95a0d26cbe746f6d618b22b48dc1f1ea749
Reviewed-on: https://go-review.googlesource.com/c/go/+/394295
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-21 22:33:09 +00:00
Robert Findley
4a46e6e44c go/types, types2: add an assertion that named type origin is idempotent
For #46794

Change-Id: I19edc19640a2dfa6bc7504dd8e1742a261ba29f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/393368
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-21 22:07:20 +00:00
Matthew Dempsky
adae6ec542 cmd/compile: replace Type.OrigSym with Type.OrigType
First law of cmd/compile frontend development: thou shalt not rely on
types.Sym.

This CL replaces Type.OrigSym with Type.OrigType, which semantically
matches what all of the uses within the frontend actually care about,
and avoids using types.Sym, which invariably leads to mistakes because
symbol scoping in the frontend doesn't work how anyone intuitively
expects it to.

Fixes #51765.

Change-Id: I4affe6ee0718103ce5006ab68aa7e1bb0cac6881
Reviewed-on: https://go-review.googlesource.com/c/go/+/394274
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: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2022-03-21 21:57:24 +00:00
Robert Griesemer
29866aa2b6 go/types, types2: remove predecl. test functions from ordinary tests
The type checker implements additional built-in functions (assert
and trace) that are useful for debugging. Only permit them in
manual tests (go test -run Manual), not for other tests where they
are not needed.

Change-Id: Idc7723d9e3f6b2c27769b34743561e9d0339565c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393659
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-03-21 19:10:57 +00:00
Robert Griesemer
4dc5553930 go/types, types2: rename testfile suffixes from .src to .go
Also, manually renamed some irregularly numbered files to
make their file names more regular.

With this rename, all test files now end uniformly in .go.

go fmt doesn't descend into testdata directories, so this
is fine and makes all test files behave like regular .go
files in editors with Go language support.

Change-Id: I3abde32c35c494b94b17787788cd3d7e35662296
Reviewed-on: https://go-review.googlesource.com/c/go/+/393658
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-03-21 19:10:53 +00:00