Commit b52db19b authored by Austin Clements's avatar Austin Clements

cmd/compile: create "init" symbol earlier

We create the "init" symbol and mark it as a function before compiling
to SSA because SSA can initialize this symbol, but it turns out we do
it slightly too late. peekitabs, at least, can also create the "init"
LSym. Move this initialization to just after type-checking.

Fixes the linux-amd64-ssacheck and the android-arm64-wiko-fever
builders.

Updates #27539.

Change-Id: If145952c79d39f75c93b24e35e67fe026dd08329
Reviewed-on: https://go-review.googlesource.com/c/149137
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 891f99eb
...@@ -557,6 +557,11 @@ func Main(archInit func(*Arch)) { ...@@ -557,6 +557,11 @@ func Main(archInit func(*Arch)) {
errorexit() errorexit()
} }
// The "init" function is the only user-spellable symbol that
// we construct later. Mark it as a function now before
// anything can ask for its Linksym.
lookup("init").SetFunc(true)
// Phase 4: Decide how to capture closed variables. // Phase 4: Decide how to capture closed variables.
// This needs to run before escape analysis, // This needs to run before escape analysis,
// because variables captured by value do not escape. // because variables captured by value do not escape.
...@@ -649,11 +654,6 @@ func Main(archInit func(*Arch)) { ...@@ -649,11 +654,6 @@ func Main(archInit func(*Arch)) {
Curfn = nil Curfn = nil
peekitabs() peekitabs()
// The "init" function is the only user-spellable symbol that
// we construct later. Mark it as a function now before
// anything can ask for its Linksym.
lookup("init").SetFunc(true)
// Phase 8: Compile top level functions. // Phase 8: Compile top level functions.
// Don't use range--walk can add functions to xtop. // Don't use range--walk can add functions to xtop.
timings.Start("be", "compilefuncs") timings.Start("be", "compilefuncs")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment