Closed znkr closed 2 weeks ago
This is known, and we went back and forth a few times in CL https://go.dev/cl/511475 , and that is partly the reason we don't always do this (if -B is not otherwise set).
The issue is that the GNU build ID, being part of the toolchain binary, is considered as input for the next compilation. So there is a convergence problem. There are probably ways to solve it, and we've discussed a lot on the CL. But it needs more thoughts.
If you really want it, maybe you can do go install -ldflags=-B=gobuildid cmd/...
after make.bash
. That will make the standard library packages become stale and will need rebuild at the next compilation, but that is probably okay.
Thanks Cherry. I gave that a spin, but ran into new issues after trying that and gave up. In the end, I solved it by specifying a fixed build id that's overridden with the hash sum of the binary in a separate step after make.bash.
Change https://go.dev/cl/618597 mentions this issue: cmd/internal/buildid: skip over Mach-O UUID from buildid computation
Change https://go.dev/cl/618600 mentions this issue: cmd/internal/buildid: skip over GNU build ID from buildid computation
Change https://go.dev/cl/618601 mentions this issue: cmd/link: on ELF, generate GNU build ID by default
Change https://go.dev/cl/621639 mentions this issue: cmd/link: don't pass --build-id to C linker on Solaris
This is a follow up to #41004 which added support for
-B gobuildid
to cmd/link. Unfortunately, this doesn't work when building the toolchain itself.What version of Go are you using (
go version
)?tip
What did you do?
What did you expect to see?
A successful build producing Go toolchain binaries that have
.note.gnu.build-id
ELF section.What did you see instead?