mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd: simplify some handling of package paths
We have obj.Link.Pkgpath, so we don't need to pass it redundantly in places where we already have an *obj.Link. Also, renaming the parser's "compilingRuntime" field to "allowABI", to match the "AllowAsmABI" name used by objabi.LookupPkgSpecial. Finally, push the handling of GOEXPERIMENT_* flags up to cmd/asm's main entry point, by simply appending them to flags.D. Change-Id: I6ada134522b0cbc90d35bcb145fbe045338fefb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/523297 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
f7f1c4f86d
commit
eaae2d45c7
16 changed files with 85 additions and 91 deletions
|
|
@ -35,8 +35,6 @@ func main() {
|
|||
if architecture == nil {
|
||||
log.Fatalf("unrecognized architecture %s", GOARCH)
|
||||
}
|
||||
compilingRuntime := objabi.LookupPkgSpecial(*flags.Importpath).AllowAsmABI
|
||||
|
||||
ctxt := obj.Linknew(architecture.LinkArch)
|
||||
ctxt.Debugasm = flags.PrintOut
|
||||
ctxt.Debugvlog = flags.DebugV
|
||||
|
|
@ -77,12 +75,19 @@ func main() {
|
|||
fmt.Fprintf(buf, "!\n")
|
||||
}
|
||||
|
||||
// Set macros for GOEXPERIMENTs so we can easily switch
|
||||
// runtime assembly code based on them.
|
||||
if objabi.LookupPkgSpecial(ctxt.Pkgpath).AllowAsmABI {
|
||||
for _, exp := range buildcfg.Experiment.Enabled() {
|
||||
flags.D = append(flags.D, "GOEXPERIMENT_"+exp)
|
||||
}
|
||||
}
|
||||
|
||||
var ok, diag bool
|
||||
var failedFile string
|
||||
for _, f := range flag.Args() {
|
||||
lexer := lex.NewLexer(f, compilingRuntime)
|
||||
parser := asm.NewParser(ctxt, architecture, lexer,
|
||||
compilingRuntime)
|
||||
lexer := lex.NewLexer(f)
|
||||
parser := asm.NewParser(ctxt, architecture, lexer)
|
||||
ctxt.DiagFunc = func(format string, args ...interface{}) {
|
||||
diag = true
|
||||
log.Printf(format, args...)
|
||||
|
|
@ -94,7 +99,7 @@ func main() {
|
|||
pList.Firstpc, ok = parser.Parse()
|
||||
// reports errors to parser.Errorf
|
||||
if ok {
|
||||
obj.Flushplist(ctxt, pList, nil, *flags.Importpath)
|
||||
obj.Flushplist(ctxt, pList, nil)
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue