Page MenuHomeSolus

Mold
Closed, ResolvedPublic

Description

Event Timeline

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.

GZGavinZhao added a comment.EditedMar 18 2022, 6:28 PM

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.

I don't necessarily know if it should be made the opt-out default quite yet but it should certainly be available for opt-in.

I don't necessarily know if it should be made the opt-out default quite yet but it should certainly be available for opt-in.

Yes, I see I was being too radical :P
So we give the option to use mold and the default will stay as the good old GNU ld.

joebonrichie triaged this task as Normal priority.Jun 7 2022, 1:01 PM
joebonrichie moved this task from Backlog to Accepted For Inclusion on the Package Requests board.

For future developers working on ypkg, note that mold doesn't yet support --copy-dt-needed-entries: https://github.com/rui314/mold/issues/530

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.