diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index aeb58a33104..8483c87a38d 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -16,6 +16,7 @@ import ( "cmd/compile/internal/ir" "cmd/compile/internal/logopt" "cmd/compile/internal/noder" + "cmd/compile/internal/pkginit" "cmd/compile/internal/reflectdata" "cmd/compile/internal/ssa" "cmd/compile/internal/ssagen" @@ -223,7 +224,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { base.ExitIfErrors() // Build init task. - if initTask := fninit(); initTask != nil { + if initTask := pkginit.Task(); initTask != nil { typecheck.Export(initTask) } diff --git a/src/cmd/compile/internal/gc/init.go b/src/cmd/compile/internal/pkginit/init.go similarity index 96% rename from src/cmd/compile/internal/gc/init.go rename to src/cmd/compile/internal/pkginit/init.go index a299b8688b2..f964edee883 100644 --- a/src/cmd/compile/internal/gc/init.go +++ b/src/cmd/compile/internal/pkginit/init.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package gc +package pkginit import ( "cmd/compile/internal/base" @@ -13,13 +13,13 @@ import ( "cmd/internal/obj" ) -// fninit makes and returns an initialization record for the package. +// Task makes and returns an initialization record for the package. // See runtime/proc.go:initTask for its layout. // The 3 tasks for initialization are: // 1) Initialize all of the packages the current package depends on. // 2) Initialize all the variables that have initializers. // 3) Run any init functions. -func fninit() *ir.Name { +func Task() *ir.Name { nf := initOrder(typecheck.Target.Decls) var deps []*obj.LSym // initTask records for packages the current package depends on diff --git a/src/cmd/compile/internal/gc/initorder.go b/src/cmd/compile/internal/pkginit/initorder.go similarity index 99% rename from src/cmd/compile/internal/gc/initorder.go rename to src/cmd/compile/internal/pkginit/initorder.go index 4ac468fb4e5..d63c5a4717d 100644 --- a/src/cmd/compile/internal/gc/initorder.go +++ b/src/cmd/compile/internal/pkginit/initorder.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package gc +package pkginit import ( "bytes"