1
0
mirror of https://github.com/golang/go synced 2024-11-06 13:46:16 -07:00
go/src/go
Matthew Dempsky ab8d7dd75e cmd/compile: set LocalPkg.Path to -p flag
Since CL 391014, cmd/compile now requires the -p flag to be set the
build system. This CL changes it to initialize LocalPkg.Path to the
provided path, rather than relying on writing out `"".` into object
files and expecting cmd/link to substitute them.

However, this actually involved a rather long tail of fixes. Many have
already been submitted, but a few notable ones that have to land
simultaneously with changing LocalPkg:

1. When compiling package runtime, there are really two "runtime"
packages: types.LocalPkg (the source package itself) and
ir.Pkgs.Runtime (the compiler's internal representation, for synthetic
references). Previously, these ended up creating separate link
symbols (`"".xxx` and `runtime.xxx`, respectively), but now they both
end up as `runtime.xxx`, which causes lsym collisions (notably
inittask and funcsyms).

2. test/codegen tests need to be updated to expect symbols to be named
`command-line-arguments.xxx` rather than `"".foo`.

3. The issue20014 test case is sensitive to the sort order of field
tracking symbols. In particular, the local package now sorts to its
natural place in the list, rather than to the front.

Thanks to David Chase for helping track down all of the fixes needed
for this CL.

Updates #51734.

Change-Id: Iba3041cf7ad967d18c6e17922fa06ba11798b565
Reviewed-on: https://go-review.googlesource.com/c/go/+/393715
Reviewed-by: David Chase <drchase@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>
2022-05-16 18:19:47 +00:00
..
ast go/ast, go/printer: recognize export and extern line directives 2022-04-11 22:03:44 +00:00
build go/build: replace ioutil.ReadDir with os.ReadDir 2022-05-11 13:52:09 +00:00
constant all: gofmt main repo 2022-04-11 16:34:30 +00:00
doc go/doc: remove unused top-level declarations from playable example 2022-05-10 23:13:45 +00:00
format go/format: skip go/ast's object resolution 2022-04-21 21:07:18 +00:00
importer go/importer: disable TestForCompiler/LookupCustom for GOEXPERIMENT=unified 2022-05-16 09:31:42 +00:00
internal cmd/compile: set LocalPkg.Path to -p flag 2022-05-16 18:19:47 +00:00
parser go/parser: accept all valid type parameter lists 2022-05-04 20:20:27 +00:00
printer go/printer: align expression list elements containing tabs 2022-05-10 19:22:49 +00:00
scanner all: gofmt main repo 2022-04-11 16:34:30 +00:00
token all: gofmt main repo 2022-04-11 16:34:30 +00:00
types go/types, types2: use a type lookup by identity in method lookup 2022-05-09 19:54:59 +00:00