Zig ELF Linker Improvements Devlog

kristoff_it1 pts0 comments

Devlog<br>Zig Programming Language

Download

Learn

News

Source<br>Join a Community

ZSF

Devlog

Devlog

This page contains a curated list of recent changes to main branch Zig.

Also available as an<br>RSS feed.

This page contains entries for the year 2026. Other years are available in<br>the Devlog archive page.

May 30, 2026<br>ELF Linker Improvements

Author: Matthew Lugg<br>I’ve spent the past few weeks working on our new ELF linker which debuted in 0.16.0 release. At the time of the 0.16.0 release, this linker implementation was in its fairly early stages, and only really supported linking Zig-only code without any external libraries (even libc)—hence why it was (and still is) disabled by default (it can be enabled with -fnew-linker). However, quite a lot of progress has been made since that initial release!<br>Here’s a nice milestone—as of my latest PR, the new ELF linker is capable of building the self-hosted Zig compiler with LLVM and LLD libraries enabled, a task which requires quite a few features under the hood.<br>[mlugg@nebula master]$ # Build the Zig compiler using the new linker:<br>[mlugg@nebula master]$ zig build -Dno-lib -Dnew-linker -Denable-llvm<br>[mlugg@nebula master]$ # Use that compiler to build something with LLVM and LLD:<br>[mlugg@nebula master]$ ./zig-out/bin/zig build-exe ~/hello.zig -fllvm -flld<br>[mlugg@nebula master]$ ./hello<br>Hello, World!<br>[mlugg@nebula master]$

Of course, an ELF linker isn’t necessarily the most exciting thing in the world, which is why the headline feature of this new linker is its support for fast incremental compilation. After the recent enhancements, it is now possible (on x86_64 Linux) to perform incremental rebuilds while linking external libraries, C sources, etc—without any additional performance overhead! Here’s a clip of me trying it out on Andrew’s Tetris clone:

A few silly changes to Andrew’s Tetris clone being built in around 30ms each.<br>Oh, and fast incremental rebuilds also work nicely on the Zig compiler itself:<br>[mlugg@nebula master]$ zig build -Dno-lib -Denable-llvm -fincremental --watch<br>Build Summary: 4/4 steps succeeded<br>install success<br>└─ install zig success<br>└─ compile exe zig Debug native success 36s

Build Summary: 4/4 steps succeeded<br>install success<br>└─ install zig success<br>└─ compile exe zig Debug native success 244ms

Build Summary: 4/4 steps succeeded<br>install success<br>└─ install zig success<br>└─ compile exe zig Debug native success 228ms

Build Summary: 4/4 steps succeeded<br>install success<br>└─ install zig success<br>└─ compile exe zig Debug native success 288ms

Build Summary: 4/4 steps succeeded<br>install success<br>└─ install zig success<br>└─ compile exe zig Debug native success 283ms<br>The biggest missing feature of this linker implementation right now is that it still does not yet support generating DWARF debug information for Zig code—that’s definitely my next priority. But even without that support, it’s amazing just how useful instant rebuilds can be, for example in any situation where you’re doing a lot of print debugging.<br>If you’re using the master branch of Zig and you’re on x86_64 Linux, consider trying out incremental compilation with the new ELF linker if it previously wasn’t working with your project! I expect many codebases to already work great with it, unlocking the ability to rebuild your project in milliseconds. Of course, if you come across any bugs, please do open an issue.<br>And if you’re currently sticking to tagged releases of Zig, don’t worry—as Andrew mentioned in his last devlog, Zig 0.17.0 is just around the corner, so it won’t be long before you can try this too!

May 26, 2026<br>Build System Reworked

Author: Andrew Kelley<br>Big branch just landed: separate the maker process from the configurer process<br>This devlog entry is essentially a preview of the upcoming release notes, but serves as an advanced notice to those who want to help test out the new features and provide feedback that will guide the Zig project moving forward.<br>Before, build.zig files plus the build system implementation were all compiled into one bloated process, in Debug mode. After build.zig logic finished constructing a build graph in memory, the “build runner” code executed it.<br>Now, build.zig files are compiled into a small process (the “configurer”) in debug mode. After this logic finishes constructing a build graph in memory, it is serialized to a binary configuration file. The parent zig build process is aware of this file and caches it for next time. While waiting for all that, it asynchronously compiles the build graph execution process (the “maker”) in release mode. Once the configuration file is available and the maker process is finished compiling, the maker process is executed, passing it the configuration file. The maker process only needs to be compiled once per zig version thanks to the global cache. The maker process then executes the build graph, which is contained within the serialized configuration file.<br>The primary motivation of this change was to make zig build faster,...

build success linker install process master

Related Articles