go: add a binary bootstrap package (1.12 series for now) and switch the compiler to it from 1.4 #16287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a
go1.12-bootstrap
package newly used instead ofgo1.4-bootstrap
to bootstrap the main Go compiler. The reason for this is to allow bootstrapping on platforms the ancient codebase does not support, particularlyppc64le
andaarch64
.The new bootstrap package can technically run on all the targets that are in the intersection of what the official compiler supports and what Void supports.
There is a problem that the official binaries require glibc (just its dynamic linker, the libc itself and libpthread). In order to deal with that on musl, fetch a binary copy of glibc from Debian (which is reproducibly built, so it should be trustable) and patch the official binaries so that they use the newly bundled libc and dynamic linker. This allows the compiler to execute in a musl system, and build the proper target compiler (which will use the musl dynamic linker and libc, of course).I chose the approach after evaluating all other choices, includinggcompat
andgccgo
; in the end this was the only thing that truly and reliably worked.I used gcompat to be able to run the compiler. In order for that to work, gcompat needs to be updated and patched, as in #16320. We still need to use patchelf to patch out the
lib64
requirement.The second part of this patchset switches the
go
package to use the new 1.12 bootstrap. Since 1.12,GOCACHE
must be not set when bootstrapping, so that line was removed. I also added newbroken
lines to disable the package on big endian PowerPC systems (ppc64 BE support uses incorrect ABI and requires POWER8 hardware, making it not safely distributable; 32-bit ppc was just never supported at all).Additionally, I also added a
broken
when cross-building on the same architecture to a different libc (e.g.x86_64
tox86_64-musl
). This is because the build system does not account for this scenario and just does not cross build; this creates a package without failing but the contained compiler is just a compiler for the host system and will not function on the target. So at least until this problem is taken care of, disable it in order to not silently build broken packages.If this is accepted, we can drop the
go1.4-bootstrap
package afterwards.@the-maldridge @nilium