MEP-42 Linker and Runtime Recommendation
One paragraph each, Phase 1 vs Phase 2.
83 notes
One paragraph each, Phase 1 vs Phase 2.
Gatekeeper, notarytool, SmartScreen, Authenticode, and the real cost of shipping a desktop binary.
One-paragraph recommendation, plus reasoning, for which naive-emission technique Mochi MEP-42 should adopt as the first cut.
Statically linked, position-independent, ASLR-friendly, and no dynamic loader required.
A conceptual essay on where Mochi MEP-42 should sit on the curve from "compile slowly, run fast" (LLVM -O3) through "compile and run at medium speed" (Cranelift, B3) to "compile instantly, run okay" (copy-and-patch, Sparkplug). Includes a back-of-envelope budget derived from MEP-17 and MEP-23 bench numbers.
Comparison table and Phase 1 / Phase 2 recommendation for Mochi's native code-generation backend.
Cross-cutting patterns from twelve production AOT pipelines, with a recommendation for which one Mochi should learn from most.
The "honorable mentions" beyond LLVM/Cranelift/MIR/QBE.
What it takes to write a valid ELF/Mach-O/COFF from a backend's raw bytes.
Fat Mach-O wrapping arm64 + x86_64, the lipo tool, and the end of x86_64 support.
The published material a Mochi engineer should keep open while implementing MEP-42 phase 1. Cooper/Torczon 3rd ed for the canonical theory, Nystrom for a hands-on bytecode compiler walkthrough, Appel for the verified-compiler-curious, plus 2024-2026 course materials covering naive backends.
The two competing approaches to debugging Wasm, and why DWARF won inside Chrome.
Single-page roll-up of every (target ISA x OS) combination Mochi MEP-42 could ship, with status and engineering complexity recommendations.
Meta's typed Python subset that can be AOT-aware, the Cinder JIT, and CPython 3.13+'s experimental copy-and-patch JIT.
Apple's Swift in two modes: full LLVM-driven AOT for app platforms, and a stripped Embedded Swift mode for microcontrollers and freestanding binaries.
The Glasgow Haskell Compiler's native code generator: hand-written, x86_64 / aarch64 / risc-v, alongside an LLVM alternative.
Python-syntax systems language built on MLIR, with both AOT and JIT pipelines, on the path to 1.0 in H1 2026.
A single binary that is simultaneously a valid ELF, Mach-O, PE, and BSD a.out.
The .wasm container, plus the component model binary and WAT text format.
The most actively researched mid-tier compiler backend of the 2020s. ISLE for instruction selection, proof-carrying code for Wasm-sandbox memory accesses, and VeriISLE for verified instruction-lowering rules. Where the "design and implementation of a portable codegen framework" line of work currently lives.
The Windows executable and object format.
The Apple object/executable format: macOS, iOS, iPadOS, tvOS, watchOS, visionOS.
Microsoft's native debug format, the sidecar PDB file, and the pain of producing one on Linux.
The universal Unix object/executable format: Linux, *BSD, Solaris, Haiku, embedded.
"Mochi → Wasm → wasmtime compile → native": skip the backend, use the wasm ecosystem.
"How small can a useful native backend be?"
The lowest-cognitive-load path: emit C, let GCC/Clang do the rest.
Multi-Level IR, dialect framework, the foundation under Mojo, IREE, and OpenXLA.
The Triton dialect (OpenAI, GPU codegen), the IREE dialect (Google, ML compiler), Mojo's MLIR-based KGEN compiler, and the broader trend of language frontends as MLIR dialects. The "if we wanted to be ambitious" backend story for Mochi.
Recent foundational work from POPL and its co-located CPP (Certified Programs and Proofs) workshop on verified compilation, secure calling conventions, and packet-filter codegen. Less directly applicable to a "naive emitter" than PLDI, but instructive for the verification story MEP-42 may eventually want.
The cross-platform binary debug format, its current standard, and where the next version is going.
Direct syscalls on Linux, why this is impossible on macOS, and the APE alternative.
Recent work from the flagship PL conference on lightweight backends, baseline JIT design, superoptimization for stack bytecode, and library composition that sidesteps heavyweight compilation.
A 14k-LOC SSA compiler backend by Quentin Carbonneaux that targets x86-64, arm64, and riscv64 from a textual SSA IR. The "70% of LLVM in 10% of the code" pitch. The natural fallback if writing our own emitter feels too risky.
JIT-first scientific language adding a real AOT path via juliac and a trimming-based static binary mechanism.
Statically-typed Go-influenced language that defaults to emitting C, with experimental native and LLVM backends and a multi-mode memory model.
Tiny systems language built on QBE, deliberately constrained, BSD/Linux-only, manual memory.
Static, GC-by-default systems language that emits C (or C++, JavaScript, LLVM) and inherits the host toolchain's optimiser.
cgo, c-shared, c-archive: keep vm3 in Go and call into it from native code.
One binary, six operating systems, two ISAs. The APE format and cosmocc toolchain.
Go's internal assembler exported as a library, already used by Mochi's vm2jit.
Mike Pall's preprocessor-driven assembler with runtime patching; LuaJIT's secret weapon.
Rui Ueyama's ~10k LOC C compiler that emits x86-64 GAS assembly directly from a recursive-descent parser. The clearest published example of a single-pass codegen pipeline that produces correct code with no IR, no SSA, no register allocator. The right educational template for a "naive AOT" pass of MEP-42.
Stencil-based binary stitching from OOPSLA 2021, now shipping in CPython 3.13/3.14.
GCC as a shared library, used by Emacs native compilation, GCC Rust, GDC, Cython.
The default Linux libc, and the reasons "fully static linking" is officially unsupported.
Survey of niche or specialized architectures that MEP-42 should be aware of but probably defer.
Wasm 3.0 (2025) as the stable target, plus WASI Preview 2/3 and the component model.
The general pattern that Sparkplug, Liftoff, JSC Baseline, and the HotSpot template interpreter all instantiate. Per-op native template, fixed register convention, stub calls for slow paths, optional inline caches as patchable code regions. Specifically considered here as an engineering implementation in pure Go without cgo.
A converged design pattern across three independent implementations: per-opcode template emission, a virtual operand stack with lazy register promotion, no IR, no global optimization. The current state of the art in "fast and simple" Wasm code generation.
The general-purpose 64-bit RISC-V baseline plus vector and recent extensions.
Windows 11 on Snapdragon X / X2 Elite, Surface Pro X lineage, and ARM64EC interop.
The static-friendly C library that makes "build once, ship anywhere" actually work on Linux.
Emitting a self-contained executable from the compiler, no external linker required.
Ruby-syntax statically-typed language with global type inference, LLVM backend, and Boehm GC.
Tree-walk to tuples to native assembly. The textbook recipe from the Dragon Book and Cooper/Torczon, still the right starting point when you want correctness before performance.
Systems language rebuilding its compiler around its own native backends, with LLVM demoted to an optional path.
Stencil-driven code generation that harvests pre-compiled opcode snippets at build time and stitches them into native code at runtime via relocation patches. No IR, no register allocator, no instruction selector. The technique CPython 3.13+ ships in production.
Microsoft's production successor to CoreRT: trimmed CoreCLR plus RyuJIT-as-AOT, shipping single-file native binaries.
Closed-world AOT compilation that turns a managed JVM application into a self-contained native executable.
Vladimir Makarov's lightweight JIT+AOT, fast compile times, lazy basic-block versioning.
The historical Linux workhorse and its dying sibling.
Quentin Carbonneaux's deliberately tiny SSA backend, "70% of LLVM in 10% of the code."
The closed-source Mach-O linker that ships in Xcode 15 and later.
Bytecode Alliance's Rust-native SSA backend, ISLE-driven, ~10x faster compile than LLVM.
The workhorse SSA infrastructure, version 20 era, evaluated for MEP-42.
The base 64-bit Arm calling standard, with Apple and Microsoft deltas called out.
The 4-register fast-call convention used by every Windows-on-AMD64 binary.
The fastest production ELF linker, single-author, MIT licensed.
Apple WebKit's original template-style baseline compiler, the longest-running production baseline JIT for a dynamic language, and the design template for every modern four-tier VM.
The default 64-bit Unix ABI: Linux, macOS, FreeBSD, OpenBSD, NetBSD, illumos.
A single-pass, IR-free transpiler from Ignition bytecode to native machine code, designed to add a fast tier between an interpreter and an optimizer with minimal engineering cost.
PLDI 2024-2025 codegen, POPL 2024-2025 compiler papers, MLIR dialects 2026, Cranelift design, compiler textbooks 2026, compile-time vs runtime tradeoff.
One binary, four object formats, cross-link from any host.
DWARF 5, CodeView / PDB, source maps for Wasm.
musl static, glibc, Cosmopolitan libc, Go runtime as library, no-libc freestanding, universal binaries, static-PIE, signing and notarization.
LLD, mold, Apple ld_prime, GNU ld + gold, the no-linker path, summary recommendation.
ELF, Mach-O, PE/COFF, Wasm module, APE / Cosmopolitan polyglot binary.
x86_64 SysV, x86_64 Windows, AArch64 AAPCS, AArch64 Windows, RISC-V 64, Wasm 3.0, other ISAs, summary matrix.
Sparkplug, JSC Baseline, copy-and-patch (Xu+Kjolstad PLDI 2021), single-pass classic, Wasm baseline, per-opcode template JIT, chibicc walkthrough, QBE for naive emit.
GraalVM Native Image, .NET NativeAOT, Zig self-hosted, Crystal, Nim, Hare, V, Julia juliac, Mojo, GHC NCG, Embedded Swift, Static Python / CPython 3.13 JIT.
Research substrate for Mochi MEP-42 (May 2026). A 73-file deep dive into how managed-language runtimes lower typed IR to native machine code: code generation backends, AOT case studies, naive emission techniques, target ISAs and ABIs, object formats, linkers, runtime and libc, debug info, and recent PLDI/POPL papers.
LLVM, Cranelift, QBE, MIR, libgccjit, copy-and-patch, DynASM, golang-asm, MLIR, C-as-target, TCC/chibicc, Wasmtime AOT, direct object emission, JIT library survey.