RC RANDOM CHAOS

Zig's New ELF Linker Gains Incremental Builds, Now Self-Hosts the Compiler

· via Hacker News

Original source

Zig ELF Linker Improvements Devlog

Hacker News →

Zig contributor Matthew Lugg reports that the new ELF linker introduced in 0.16.0 has matured enough to build the self-hosted Zig compiler with LLVM and LLD enabled, a significant step beyond its initial Zig-only scope. The linker remains opt-in via -fnew-linker, but on x86_64 Linux it now supports fast incremental compilation even when linking against external libraries and C sources, with no measurable performance penalty. Rebuild times for projects like the Zig compiler itself drop from tens of seconds to a few hundred milliseconds, making print-debugging workflows dramatically tighter. DWARF debug info for Zig code is the main remaining gap and is next on the roadmap.

In a separate entry, Andrew Kelley describes a major rework of the build system that splits the old monolithic build process into a small debug-mode “configurer” and an optimized “maker” that executes a serialized build graph. The maker compiles once per Zig version and is cached globally, while the configurer skips re-running build.zig logic when nothing has changed. The result is roughly a 10x speedup on commands like zig build —help (150ms down to 14ms) and headroom for adding features like —watch, —fuzz, and —webui without bloating every invocation. The change is mostly API-compatible; the main migration is replacing b.args handling with run_cmd.addPassthruArgs(). Both changes are landing ahead of the imminent 0.17.0 release.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.