cmd/asm,cmd/dist,cmd/go: remove asm -compiling-runtime flag

Currently, dist and go pass a -compiling-runtime flag to asm if
they're compiling a runtime package. However, now that we always pass
the package path to asm, it can make that determination just as well
as its callers can. This CL moves that check into asm and drops the
flag.

This in turn makes dist's copy of IsRuntimePackagePath unnecessary, so
we delete it.

Change-Id: I6ecf2d50b5b83965012af34dbe5f9a973ba0778b
Reviewed-on: https://go-review.googlesource.com/c/go/+/521697
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Austin Clements 2023-06-30 16:33:49 -04:00
parent 596120fdc6
commit 72946ae867
9 changed files with 23 additions and 55 deletions

View file

@ -35,6 +35,7 @@ func main() {
if architecture == nil {
log.Fatalf("unrecognized architecture %s", GOARCH)
}
compilingRuntime := objabi.IsRuntimePackagePath(*flags.Importpath)
ctxt := obj.Linknew(architecture.LinkArch)
ctxt.Debugasm = flags.PrintOut
@ -79,9 +80,9 @@ func main() {
var ok, diag bool
var failedFile string
for _, f := range flag.Args() {
lexer := lex.NewLexer(f)
lexer := lex.NewLexer(f, compilingRuntime)
parser := asm.NewParser(ctxt, architecture, lexer,
*flags.CompilingRuntime)
compilingRuntime)
ctxt.DiagFunc = func(format string, args ...interface{}) {
diag = true
log.Printf(format, args...)