zld 0.0.3
A complete MachO driver rewrite + ELF x86_64 support
- MachO driver has been fully redesigned mainly so that we can easily plug it in into Zig much like we did with the ELF driver.
- This is the first tagged release of the ELF x86_64 driver.
- Thanks to @Luukdegram we also get some Wasm linker support 🎉
Better MachO link times (on Apple Silicon)
Seems we have regressed in link times prior to the MachO rewrite. Below you will find a quick benchmark of linking Zig's stage4 binary. You can also see what Rui meant when he mentioned that Apple stepped up their game - Apple's stock linker crushed zld before and after the rewrite and so it did with LLVM's LLD. That's good though - it's something we can strive for. The results are also good news for us since the rewrite is significantly faster than what we had before (zld_old is based on 19ccd5cacbca0895d6f0444835225415fc1ed7e6 FWIW), and I haven't yet even started thinking about parallelising parsing input objects, etc., a trick that all three linkers currently employ (Apple's ld, ld64.lld and Rui's sold linker).
$ hyperfine ./zld ./zld_old ./lld ./ld64
Benchmark 1: ./zld
Time (mean ± σ): 3.236 s ± 0.014 s [User: 3.460 s, System: 0.750 s]
Range (min … max): 3.219 s … 3.269 s 10 runs
Benchmark 2: ./zld_old
Time (mean ± σ): 4.419 s ± 0.011 s [User: 4.671 s, System: 0.761 s]
Range (min … max): 4.398 s … 4.430 s 10 runs
Benchmark 3: ./lld
Time (mean ± σ): 1.497 s ± 0.019 s [User: 1.700 s, System: 0.308 s]
Range (min … max): 1.457 s … 1.529 s 10 runs
Benchmark 4: ./ld64
Time (mean ± σ): 627.0 ms ± 7.2 ms [User: 2140.1 ms, System: 385.3 ms]
Range (min … max): 617.8 ms … 639.4 ms 10 runs
Summary
./ld64 ran
2.39 ± 0.04 times faster than ./lld
5.16 ± 0.06 times faster than ./zld
7.05 ± 0.08 times faster than ./zld_old