]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile, cmd/link: produce unlinkable object when compile without -p
authorCherry Mui <cherryyz@google.com>
Mon, 21 Mar 2022 17:45:50 +0000 (13:45 -0400)
committerCherry Mui <cherryyz@google.com>
Tue, 22 Mar 2022 19:38:35 +0000 (19:38 +0000)
commite8534640557939755917edc3e6afc16d93b2e70b
tree084da621f83646a5be004bb7639021eeb7718c6b
parent63ea27e9e02e9ddf5845a32082013e7344134fd7
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>
src/cmd/compile/internal/base/flag.go
src/cmd/internal/goobj/objfile.go
src/cmd/internal/obj/objfile.go
src/cmd/link/internal/loader/loader.go
src/cmd/link/link_test.go