Live data from Hacker News

Zig got a new ELF linker and it's fast

github.com

1–10 of 51 posts

Re: Zig got a new ELF linker and it's fast

#5
The more I hear about Zig, the more I appreciate it. Its vertically integrated stack (with the custom linker and code-generation backends) stands out to me as a really compelling feature that enables interesting optimizations. The compiler is also much easier to interact with in a consistent way compared to C. I've been using it as an experimental backend for my language project with great results.

Re: Zig got a new ELF linker and it's fast

#6

If I recall correctly, this is one of the final pieces that allows zig to be used as a fully self-contained cross-compiling C toolchain (once its linker is enabled for more platforms / formats)

I might be misunderstanding, but I don’t think that's quite accurate. As I understand it, Zig ships a Clang frontend and wraps it with precompiled sysroots. Unless they're developing an LLVM backend, I'm not sure how it could serve as a completely self-contained toolchain.

Re: Zig got a new ELF linker and it's fast

#8

Between mold and this, the linker space appears to be going through a renaissance. Does anyone know if it’s reasonably easy to use elf2 as a standalone linker in a c/c++ toolchain? Or is it specially built just for Zig?

Looking in the source tree, it doesn't look like it has it's own entry point. Zig is heading in the direction of a very verticall integrated compilation stack (I believe this is where most of the speed up comes from), so I'm not really sure of the utility with using it outside of the Zig world.

https://github.com/jacobly0/zig/tree/4508c2543508e04253471e1... https://github.com/jacobly0/zig/blob/4508c2543508e04253471e1...

Re: Zig got a new ELF linker and it's fast

#9

If I recall correctly, this is one of the final pieces that allows zig to be used as a fully self-contained cross-compiling C toolchain (once its linker is enabled for more platforms / formats)

I might be misunderstanding, but I don’t think that's quite accurate. As I understand it, Zig ships a Clang frontend and wraps it with precompiled sysroots. Unless they're developing an LLVM backend, I'm not sure how it could serve as a completely self-contained toolchain.

Zig does have its own native x86_64 backend for debug compilation.

ref: https://ziglang.org/devlog/2025/#2025-06-08

Re: Zig got a new ELF linker and it's fast

#10

If I recall correctly, this is one of the final pieces that allows zig to be used as a fully self-contained cross-compiling C toolchain (once its linker is enabled for more platforms / formats)

I might be misunderstanding, but I don’t think that's quite accurate. As I understand it, Zig ships a Clang frontend and wraps it with precompiled sysroots. Unless they're developing an LLVM backend, I'm not sure how it could serve as a completely self-contained toolchain.

zig has a cross-compiler frontend (zig cc) which can be used as a drop-in replacement for a custom sysroot + binutils + gcc for several platforms. I've used it to build OCaml cross-compilers that only depend on zig itself (https://www.chrisarmstrong.dev/posts/ocaml-cross-compilation...).

There are other projects that have used it in a similar way too.

[1] https://actually.fyi/posts/zig-makes-rust-cross-compilation-... [2] https://jcbhmr.com/2024/07/19/zig-cc-cmake/

Post reply on HN