-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/dist: bootstrap of tip fails with GOEXPERIMENT=newinliner and added VERSION file #64189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Change https://go.dev/cl/542995 mentions this issue: |
OK, I think I have worked this out.
Here's what I think is happening: in the build part of https://go.googlesource.com/go/+/ff19f8e7636f0b5797f3b65cee69f41fb650b965/src/cmd/dist/build.go#1467 This code sets goInstall(toolenv(), goBootstrap, append([]string{"-pgo=off"}, toolchain...)...) The problem here is that at the point when we start building dependent packages needed for the toolchain, the installed compiler is not producing GOEXPERIMENT=newinliner objects, but the GOEXPERIMENT env variable is set. Thus any object produced at this point and entered into the cache will be bad (it will advertise itself as a newinliner object, but will not be one). I hacked up
which is coming out of the go-build cache. I looked through the "go build -x" output for the toolchain2 build, and the "crypto/subtle" is built and copied into the cache before the new I can think of a couple of ways to attack this. If we don't want to change the dist command at all, then we could change the Go command to compute hash keys not just with the GOEXPERIMENT setting but also the GOEXPERIMENT values baked into each of the components tools (compile, link, etc). Not sure this a great idea; seems like it would slow things down in the common case just to handle the weird corner cases where we're in the mid-experiment change. The other alternative would be to do some sort of cache cleaning in "dist" along the lines of what is in the CL that Cuong sent. Seems to me that the best place for the clean would be immediately after the toolchain2 build (if GOEXPERIMENT is set). Thoughts? |
Another possible fix: change the compiler to always read/write the func.Inl.Properties strings, but just write an empty string if the new inliner is turned off. This would result in a tiny increase in object file size for the nonewinliner case, but would make the object files compatible. |
Change https://go.dev/cl/543215 mentions this issue: |
Why is this happening? If we set GOEXPERIMENT=newinliner, then the newinliner should be enabled. This seems like a cmd/go issue. |
My (somewhat hazy) recollection is that for Go experiments that control what the compiler does, the value of the experiment is baked into the cmd/compile binary at build time (happy to be corrected if this is not right BTW). Hence if you install a GOEXPERIMENT=newinliner compiler, then run
you'll actually still be getting objects built with GOEXPERIMENT=newinliner. |
Change https://go.dev/cl/543196 mentions this issue: |
The GOEXPERIMENT environment variable is supposed to work the same as GOOS and GOARCH. That is, if you set it while running |
I looked several times and couldn't find any place where So I think the likely explanations are that either |
@bcmills Thanks for looking. I agree that I think it's actually a cmd/compile issue. (See my latest comment at https://go.dev/cl/543215 for details; tldr, we're using internal/goexperiment where we should use internal/buildcfg.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
Reported by Heschi: if you take a tip (1.22) Go repo and drop a VERSION file into it of the following form:
then run
GOEXPERIMENT=newinliner bash make.bash
the bootstrap build fails (works ok if no VERSION file).Symptom:
I've done a little poking around and it is indeed related to the goexperiment ; stack trace at the point of the failure appears to indicate that the compiler is trying to read the "function properties" string for an inlinable function from the object file and encountering an early EOF -- this would seem to point to some sort of mixup in object file flavors? Not clear. Representative trace at point of failure:
The text was updated successfully, but these errors were encountered: