Hasty Briefsbeta

Bilingual

Retrobootstrapping Rust for some reason

a year ago
  • #rust
  • #compiler
  • #bootstrapping
  • Rust's initial compiler, rustboot, was written in OCaml and emitted 32-bit i386 machine code.
  • The transition to rustc (using LLVM) involved a bootstrap process: stage0 (rustboot on rustc), stage1 (stage0 on rustc), and stage2 (stage1 on rustc) for verification.
  • Bitrot issues complicate retrobootstrapping due to changes in tools, compilers, and libraries over 14 years.
  • Debian's EOL Docker images provide a viable environment for retrobootstrapping Rust's initial bootstrap and fixpoint.
  • The correct Rust commit for the fixpoint is 6daf440037cb10baab332fde2b471712a3a42c76 from April 2011.
  • LLVM version 45e1a53efd40a594fa8bb59aee75bb0984770d29 (or equivalent SVN commit) is required for compatibility.
  • Performance observations: stage0 (rustboot) was faster to build but produced slower code, with LLVM providing a 2x speed boost at 3x the binary size.
  • Modern Rust's bootstrap is slower due to increased codebase size (600kloc vs. initial 25kloc).