rustc in userland
summary
Claim: a rustc install exposes rustc internals in userland so user code can parse, transform and emit objects. Practicals: using nightly feature gates, the rust LLVM bindings and LLVM via rust bindings to drive codegen and linking, or the rustc driver hacks. Built examples: a naive brainfuck→x86 codegen and interpreter that emits object files (30,000‑byte tape in BSS), which runs real tests but needs a specific nightly rustc and accepts fragility around internal API and platform assumptions.
AI-written summary · about
chapters (22)
- 0:00richo who is this guy
- 1:30Whyfor we're here
- 2:26The tiniest rust compiler
- 3:45Under the hood
- 4:25and why do I want one?
- 7:11Assembly
- 7:22Linkage
- 9:04Quick Wins brainfuck
- 9:51Naive Interpreter
- 15:32Naive Compiler Real like.. actual native code
- 16:17First step, fixing codegen
- 17:24clang
- 17:42LLVM Low Level Virtual Machine
- 19:19Aside: goddamit rust Why you ruin my talk in this way
- 21:30Ok but like building things
- 24:34Cheap thrills
- 25:31Let's build a thing!
- 26:03Pattern match like a champ
- 28:43POW! Data
- 29:04Conclusions
- 30:00neat ideas going forward
- 31:42Questions?
related talks
01h 14mRust: A Friendly Introduction
09mRustc: How I Learned to Respect the Compiler
16mHacking rustc: Contributing to the Compiler
12mWhy you should be checking out Rust
28mC2Rust: Migrating Legacy Code to Rust
28mrustc_codegen_gcc: A gcc codegen for the Rust compiler
28mInterfacing Rust with Xen
30mIntegrating Rust into Tor: Successes and Challenges
