TL;DR
Zig’s latest ELF linker update introduces support for rapid incremental rebuilding, significantly improving development speed. The feature is now functional on x86_64 Linux, with further enhancements planned.
Zig’s new ELF linker now supports building the compiler with LLVM and LLD, and enables fast incremental compilation on x86_64 Linux, marking a significant step forward in build performance.
Developer Matthew Lugg detailed recent progress on the ELF linker introduced in Zig 0.16.0. The updated linker now successfully builds the self-hosted Zig compiler with LLVM and LLD, a complex task that was previously unsupported.
One of the key features of this new linker is its support for fast incremental rebuilds. On x86_64 Linux, developers can now perform rebuilds that include external libraries and C sources in as little as 30 milliseconds, with the process showing no additional performance overhead.
Currently, the main limitation is the lack of support for generating DWARF debug information, which Lugg identified as his next priority. Despite this, the current improvements significantly enhance development workflows, especially for debugging and iterative testing.
Why It Matters
This update matters because it drastically reduces build times during development, enabling quicker testing and debugging cycles. For large projects, the ability to rebuild in milliseconds can substantially increase productivity and reduce iteration delays.
Furthermore, the support for incremental compilation aligns Zig with modern compiler expectations, potentially making it more attractive for developers seeking efficient build systems. The ongoing development indicates a focus on improving developer experience and compiler robustness.
Linux incremental build tools
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Background
The ELF linker improvements follow earlier work in Zig 0.16.0, which introduced the initial implementation. Since then, the development team has focused on expanding its capabilities, with recent milestones including building the compiler itself with LLVM and LLD.
Incremental compilation has become a key focus, as it is a common feature in modern build systems to reduce development time. The current progress on the ELF linker is part of a broader effort to optimize Zig’s build performance and tooling.
“The new ELF linker now supports building the Zig compiler with LLVM and LLD, and enables fast incremental rebuilds on x86_64 Linux.”
— Matthew Lugg
“The biggest missing feature is support for DWARF debug info, which is my next priority.”
— Matthew Lugg
LLVM LLD linker for development
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
What Remains Unclear
It is not yet clear when DWARF debugging support will be fully implemented or how broadly the new linker will be adopted across different platforms beyond x86_64 Linux. Ongoing testing and user feedback are expected to shape future updates.
fast build system for C projects
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
What’s Next
Next steps include implementing DWARF debug info support, expanding platform compatibility, and gathering user feedback to refine incremental rebuild features. Developers are encouraged to test the new linker in their projects and report issues.
debugging tools for Zig compiler
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Key Questions
What is the main benefit of the new ELF linker in Zig?
The main benefit is support for fast incremental compilation, enabling rebuilds in milliseconds on x86_64 Linux, which accelerates development workflows.
Does the new linker support debugging features?
Currently, it does not support generating DWARF debug information, but this is planned as the next development priority.
Is this feature available in stable releases of Zig?
No, it is available in the latest master branch and is still under active development. Users should test it with caution and report bugs.
Will this feature work on platforms other than Linux?
Support is currently confirmed for x86_64 Linux; support for other platforms remains to be developed and announced.
How can I try out the new linker?
Use the master branch of Zig and enable the new linker with the -fnew-linker flag during build. Developers are encouraged to test it in their projects and provide feedback.
Source: Hacker News