When trying to use mold on a (USE=hardened?) musl system, I always get link failures: $ gcc -fuse-ld=mold main.c mimalloc: warning: unable to allocate aligned OS memory directly, fall back to over-allocation (size: 0x2000000 bytes, address: 0x003F7F000000, alignment: 0x2000000, commit: 1) mold: fatal: library not found: ssp_nonshared collect2: error: ld returned 1 exit status (the mimalloc warning is unimportant). If I dump the linker command, it looks like this comes from the musl-specific addition of -lssp_nonshared by 50_all_libssp_unconditionally.patch. Problem is, mold doesn't have a default search path, and gcc doesn't pass its own default path (/usr/lib, in this case) as part of the link command. So while /usr/lib/libssp_nonshared.a exists, -lssp_nonshared fails with mold. My first guess would be to include -L${libdir} in the link command, but maybe there's a better solution.
By remarkable coincidence, this might have been fixed on trunk a few days ago: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=3fb90724cec7e76b60fb910fa98b4ebec9912a31.
Yep can't reproduce on hardened musl
This is fixed in 15. I may backport it.