v0.1.0
zld is now bold
I have renamed zld and then emerald to bold and made it a Mach-O only linker. I needed to face the harsh reality that I will not be able to develop and maintain multiple drivers at the same time and so I've decided to focus on Mach-O only. If anyone is interested in carrying on the work with the other drivers however, the source code is archived and available in kubkon/emerald-old repo. I also think that bold being 100% Mach-O only can be a nice complement to the mold linker (which is ELF-only). Wishful thinking, I know, maybe one day ;-)
Some numbers
Since landing #143, bold is now competing with LLVM lld while still playing catch up with the new Apple linker. Some benchmark results that track the time it takes to link stage3-zig compiler which includes linking LLVM statically:
$ hyperfine ./bold.sh ./ld.sh ./ld_legacy.sh ./lld.sh
Benchmark 1: ./bold.sh
Time (mean ± σ): 1.088 s ± 0.018 s [User: 3.174 s, System: 1.004 s]
Range (min … max): 1.039 s … 1.104 s 10 runs
Benchmark 2: ./ld.sh
Time (mean ± σ): 491.8 ms ± 19.5 ms [User: 1891.5 ms, System: 304.7 ms]
Range (min … max): 458.1 ms … 509.9 ms 10 runs
Benchmark 3: ./ld_legacy.sh
Time (mean ± σ): 2.132 s ± 0.013 s [User: 3.242 s, System: 0.256 s]
Range (min … max): 2.104 s … 2.150 s 10 runs
Benchmark 4: ./lld.sh
Time (mean ± σ): 1.160 s ± 0.021 s [User: 1.329 s, System: 0.247 s]
Range (min … max): 1.133 s … 1.208 s 10 runs
Summary
./ld.sh ran
2.21 ± 0.10 times faster than ./bold.sh
2.36 ± 0.10 times faster than ./lld.sh
4.33 ± 0.17 times faster than ./ld_legacy.sh
In the results
bold.shcallsboldld.shcalls the rewritten Apple linkerld_legacy.shcallsld -ld_classicthe legacy Apple linkerlld.shcalls the LLVM lld linker
What's Changed
I'm only going to list the most notable changes:
- output produced by the linker is now more compatible with Apple tooling; An example of this is sorting all relocs in descending order (an unwritten rule required by Apple) - https://github.com/kubkon/bold/pull/101
- some fixes for macOS 11 have also landed. I want
boldto support as many older versions of macOS as possible but testing it is now a problem since GitHub is deprecating runners with older macOS versions - https://github.com/kubkon/bold/pull/103 - add support for VisionOS - https://github.com/kubkon/bold/pull/129
- add support for merging cstrings and literals. This should produce output that has mergeable literals deduped and is thus smaller in size - https://github.com/kubkon/bold/pull/137
- speed up the linker by embracing multi-threaded approach, which is probably the biggest woop of this release. We are now on par with LLVM lld linker. Next target will be to beat the new Apple linker - https://github.com/kubkon/bold/pull/143
- handle DWARF v1 all the way to v5 - https://github.com/kubkon/bold/pull/161
- handle enough flags to be able to link Roc compiler with
bold- https://github.com/kubkon/bold/pull/163 - handle
-arch_multipleand-final_outputflags, which effectively makes the linker compatible withlipoinvoked directly byclang- https://github.com/kubkon/bold/pull/166 and https://github.com/kubkon/bold/pull/167
New Contributors
- @theoparis made their first contribution in https://github.com/kubkon/bold/pull/135
- @der-teufel-programming made their first contribution in https://github.com/kubkon/bold/pull/141
- @Rexicon226 made their first contribution in https://github.com/kubkon/bold/pull/151
Full Changelog: https://github.com/kubkon/bold/compare/v0.0.4...v0.1.0