Comment by ibejoeb
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.
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.
Right, but I think that's what the question of "Why is the linker too late?" is getting at. With zig libc, the compiler can do it, so you don't need fat objects and all that.
---
expanding: so, this means that you can do cross-boundary optimizations without LTO and with pre-built artifacts. I think.
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.