I Built a Rust Compiler for a 20-Year-Old Mac (Borrow Checker and All)
Modern Rust does not compile for PowerPC Mac OS X Tiger. The newest compiler that runs natively on Tiger is GCC 4.0.1 from 2005. LLVM abandoned PowerPC years ago. The official Rust compiler has never targeted this platform. So I wrote one. rust-ppc-tiger is a Rust-to-PowerPC compiler written in C. It parses Rust source code, enforces ownership and borrowing rules, and emits native PowerPC assembly with AltiVec SIMD optimizations. It runs ON Tiger, compiled with that ancient GCC 4.0.1. And it works on real hardware. $ ./rustc_ppc hello.rs > hello.s $ as -o hello.o hello.s $ gcc -o hello hello.o $ ./hello Hello from Rust on PowerPC G4! Test hardware: Power Mac G4 Dual 1.25 GHz, Mac OS X Tiger 10.4.12, 2GB RAM. This article covers why, how, and what comes next. The Problem: A Dead Platform That Refuses to Die Tiger shipped in 2005. Apple abandoned PowerPC in 2006. Every modern tool chain has moved on. But millions of these machines still exist in closets, schools, basements, and labs like
Continue reading on Dev.to
Opens in a new tab

