]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: parse command-line flags earlier
authorMatthew Dempsky <mdempsky@google.com>
Thu, 12 May 2022 21:06:31 +0000 (14:06 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 13 May 2022 21:12:06 +0000 (21:12 +0000)
This CL moves the call to base.ParseFlags() earlier in compiler
startup. This is necessary so CL 393715 can use base.Ctxt.Pkgpath to
construct types.LocalPkg.

Updates #51734.

Change-Id: I9f5f75dc9d5fd1b1d22e98523efc95e6cec64385
Reviewed-on: https://go-review.googlesource.com/c/go/+/406055
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/compile/internal/gc/main.go

index 1f547130ad5af0e4e6fd718ccba092b17063b648..e9483decaac13afffbe213d8bdad7bd852a21c5e 100644 (file)
@@ -70,6 +70,9 @@ func Main(archInit func(*ssagen.ArchInfo)) {
        // See bugs 31188 and 21945 (CLs 170638, 98075, 72371).
        base.Ctxt.UseBASEntries = base.Ctxt.Headtype != objabi.Hdarwin
 
+       base.DebugSSA = ssa.PhaseOption
+       base.ParseFlags()
+
        types.LocalPkg = types.NewPkg("", "")
        types.LocalPkg.Prefix = "\"\""
 
@@ -100,9 +103,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
        // pseudo-package used for methods with anonymous receivers
        ir.Pkgs.Go = types.NewPkg("go", "")
 
-       base.DebugSSA = ssa.PhaseOption
-       base.ParseFlags()
-
        // Record flags that affect the build result. (And don't
        // record flags that don't, since that would cause spurious
        // changes in the binary.)