Skip to content

v0.1.0

Latest
Compare
Choose a tag to compare
@kubkon kubkon released this 27 Dec 11:31
· 1 commit to main since this release

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.sh calls bold
  • ld.sh calls the rewritten Apple linker
  • ld_legacy.sh calls ld -ld_classic the legacy Apple linker
  • lld.sh calls the LLVM lld linker

What's Changed

I'm only going to list the most notable changes:

  1. 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) - #101
  2. some fixes for macOS 11 have also landed. I want bold to 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 - #103
  3. add support for VisionOS - #129
  4. add support for merging cstrings and literals. This should produce output that has mergeable literals deduped and is thus smaller in size - #137
  5. 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 - #143
  6. handle DWARF v1 all the way to v5 - #161
  7. handle enough flags to be able to link Roc compiler with bold - #163
  8. handle -arch_multiple and -final_output flags, which effectively makes the linker compatible with lipo invoked directly by clang - #166 and #167

New Contributors

Full Changelog: v0.0.4...v0.1.0