top | item 46863120

(no title)

meisel | 28 days ago

> It’s kind of like enabling LTO (Link-Time Optimization) across the libc boundary, except it’s done properly in the frontend instead of too late, in the linker

Why is the linker too late? Is Zig able to do optimizations in the frontend that, e.g., a linker working with LLVM IR is not?

discuss

order

ibejoeb|28 days ago

Seems like it ought to be able to do inlining and dead code stripping which, I think, wouldn't be viable at link time against optimized static libraries.

comex|28 days ago

It is viable against the IR that static libraries contain when LTO is enabled.

LTO essentially means “load the entire compiler backend into the linker and do half of the compilation work at link time”.

It’s a great big hack, but it does work.