golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
120.72k stars 17.34k forks source link

build: make.bash fails for GOOS=plan9 GOARCH=386 #67502

Open dmitshur opened 1 month ago

dmitshur commented 1 month ago

As reported by the plan9-386-0intro builder and legacy misc-compile-plan9-386 trybot, the plan9/386 port fails to bootstrap:

gotip $ git rev-parse HEAD
e7bf9959fd9ea649e1513cef16f91f81b136045f
gotip $ cd src                           
src $ GOOS=plan9 GOARCH=386 ./make.bash
Building Go cmd/dist using /usr/local/go. (go1.22.3 darwin/arm64)
Building Go toolchain1 using /usr/local/go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building commands for host, darwin/arm64.
Building packages and commands for target, plan9/386.
go tool dist: unexpected stale targets reported by /Users/gopher/gotip/pkg/tool/darwin_arm64/go_bootstrap list -gcflags="" -ldflags="" for [cmd/asm cmd/cgo cmd/compile cmd/link cmd/preprofile] (consider rerunning with GOMAXPROCS=1 GODEBUG=gocachehash=1):
    STALE cmd/compile: not installed but available in build cache

src $ echo $?
2

Also see https://build.golang.org/log/f237bed35a32f61819468d4cfd1b28946cb3e4d1 and https://storage.googleapis.com/go-build-log/ecc40e66/misc-compile-plan9-386_f210191c.log.

This doesn't happen for other ports. It also doesn't happen for other GOARCH values of GOOS=plan9 like plan9/amd64 and plan9/arm, only for plan9/386.

CC @golang/plan9.

0intro commented 1 month ago

It looks like it's broken since CL 577935.

CC @millerresearch

0intro commented 1 month ago

This change works around the issue:

--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -7316,7 +7316,7 @@ func genssa(f *ssa.Func, pp *objw.Progs) {
        //   good for amd64
        //   not helpful for Apple Silicon
        //
-       case "amd64", "386":
+       case "amd64":
            // Align to 64 if 31 or fewer bytes remain in a cache line
            // benchmarks a little better than always aligning, and also
            // adds slightly less to the (PGO-compiled) binary size.

The question is now why it doesn't work for plan9/386?

gopherbot commented 4 weeks ago

Change https://go.dev/cl/586775 mentions this issue: dashboard: remove misc-compile-plan9-386

gopherbot commented 4 weeks ago

Change https://go.dev/cl/586835 mentions this issue: cmd/compile: disable AlignHot on plan9/386

gopherbot commented 2 weeks ago

Change https://go.dev/cl/589656 mentions this issue: dashboard: restore misc-compile-plan9-386

dmitshur commented 2 weeks ago

The bootstrap failure is now resolved via CL 586835, which is what the original report was about. Perhaps it would work well to close this issue and open a separate one to investigate why AlignHot breaks plan9/386 bootstrapping, and possibly track re-enabling it.