]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: set LocalPkg.Path to -p flag
authorMatthew Dempsky <mdempsky@google.com>
Thu, 17 Mar 2022 20:27:40 +0000 (13:27 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 16 May 2022 18:19:47 +0000 (18:19 +0000)
commitab8d7dd75ea4918cde5e71b4482ff5b4f0f69273
tree694f3fcae4f11f3abeeefd0cca39ecbf31b63278
parentdb875f4d1b125e41a3999e3dd5c30d6b1bce235c
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>
25 files changed:
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/importer/gcimporter_test.go
src/cmd/compile/internal/noder/unified.go
src/cmd/compile/internal/noder/writer.go
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/ssa/writebarrier.go
src/cmd/compile/internal/ssagen/abi.go
src/cmd/compile/internal/staticdata/data.go
src/cmd/compile/internal/staticinit/sched.go
src/cmd/compile/internal/types/fmt.go
src/cmd/internal/obj/dwarf.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/plist.go
src/cmd/link/link_test.go
src/go/internal/gcimporter/gcimporter_test.go
src/internal/reflectlite/all_test.go
test/codegen/clobberdead.go
test/codegen/comparisons.go
test/codegen/memcombine.go
test/codegen/memops.go
test/codegen/select.go
test/codegen/zerosize.go
test/fixedbugs/issue20014.out
test/fixedbugs/issue9355.go