2 ms·
> 1/ Wouldn't that be considered "cheating" to basically commit precompiled compiler binaries to source control ? No, absolutely not. This is how Virgil bootst
by titzer 4y ago
> 1/ Wouldn't that be considered "cheating" to basically commit precompiled compiler binaries to source control ?
No, absolutely not. This is how Virgil bootstrapping works by design. There are 5 pre-compiled compiler binaries in the repo. The repo is completely self-contained so that any revision at any point can compile itself from source, except the very earliest versions that needed an interpreter in another language. The stable binaries are updated infrequently, about once every 3-6 months.
- pabs3 4y agoThis would definitely be considered "cheating" by the Bootstrappable Builds folks, who build everything from source, including generated binaries and generated code files. https://bootstrappable.org/ https://bootstrappable.org/
- cryptonector 4y agoThey can consider it cheating, but they themselves use previously-compiled compilers to build, do they not? The only difference is that their previously-compiled compilers are not in the same source repositories as the compilers they are used to build. That is no guarantee that the Thompson attack is defeated. The best way to defeat the Thompson attack is to insist on multiple distinct implementations -by different authors- of the implementations of each programming language, and even this only makes Thompson attacks a lot harder to pull off -but not impossible- for determined attackers. But one cannot insist on multiple distinct implementations for every new programming language, as that would simply make new programming language R&D to be prohibitively expensive. Zig could, and arguably should switch to an OpenJDK-style bootstrapping system to please the distros. Essentially this means that using new language features in the Zig compiler has to wait until those new language features appear in a released version. Whether this is realistic, idk. In any case, Zig can also keep the stage0 in the repository for use by developers (but not distros).
- pabs3 4y agoThey do not use previously-compiled compilers, no. Instead they are working on building an entire distro starting with ~512 bytes of machine code plus a ton of source. They aren't there yet, but are getting closer. The Thomson defeat you mention sounds like diverse double compiling, by David A. Wheeler. https://dwheeler.com/trusting-trust/ https://dwheeler.com/trusting-trust/ I don't think what OpenJDK has is something that Guix/Bootstrappable folks would like either, they had to bootstrap off the Jikes implementation in C++ instead: https://bootstrappable.org/projects/java.html https://bootstrappable.org/projects/java.html
- titzer 4y agoThe Virgil repo contains every stable compiler binary produced in an unbroken chain back to the first interpreter. You can literally check out every single one of the 2,200 commits and build the compiler from the source and binary checked into the repo. If that's not a bootstrappable build, I don't know what is.
- pabs3 4y agoA bootstrappable build (according to bootstrappable.org) is a bootstrap process where you don't use any binaries of the compiler itself to build the compiler. Unless the compiler already has a maintained source-only bootstrap, the usual way to do that is to write a smaller implementation in another language with just enough features that it can build the compiler. camlboot is an example of that. Another option is to build a chain of previous versions of the compiler that were written in other languages, before the compiler became self-hosting. https://github.com/Ekdohibs/camlboot https://github.com/Ekdohibs/camlboot