- Mold: A modern linker
- A significantly faster drop-in replacement for existing unix linkers written by the original author of LLVM lld. Would help speed up builds that spend a not-insignificant amount of time linking
- It is open-source
Copying the most recent comment by @GZGavinZhao:
mold is current (sort of) blocked by intel-tbb (T10092). I worked around this by statically linking against the provided intel-tbb in the mold source tree.
I've been using mold with my solbuild for the past few weeks and it has been working well :)
I took a look at the linked issue blocking the update of intel-tbb and it appears that it won't be resolved in the 2022 calendar year (due to the VFX platform only seeing yearly updates). I think mold might be a worthwhile improvement enough that Gavin's workaround might be an acceptable interim solution.
Note about integrating it into the packaging process:
- C/C++: append -B/usr/libexec/mold to CFLAGS and CXXFLAGS.
- Rust: export RUSTFLAGS="-C link-arg=-B/usr/libexec/mold".
- Go: export CGO_LDFLAGS=-B/usr/libexec/mold.
(All of the -B/usr/libexec/mold can be changed to -fuse-ld=mold after GCC 12.1.0.
We also might need to add an additional key to package.yml in case some packages are not compatible with mold, perhaps something like linker: ld/gold/lld/mold.
Neither do gold or lld afair, ypkg will try to strip that flag out when building with clang. That logic could be extended to strip it if any other linker apart from ld.bfd is used. I do want to get rid of --copy-dt-needed-entries long-term but we'll basically have to rebuild the world to do it.