mold
- Depends on 
tbb - Uses 12 GB when building and basically freezes the build process (mold should speed up linking times and reduce the overall bootstrap time but building mold takes up all the saved time and more…)
 - Segfaults at random
 - Used to add 
libgccto all linked binaries - Used to not be able to link the kernel
 - Used to not support LTO
 - Don’t forget to include 
moldin your compiler’s custom search directory 
References
Section titled “References”- You can pass linker flags like this by using a single 
-Wl, checkoutput.txt: 
gcc -v main.c -o test -Wl,-s,--as-needed,--build-id,sha256,--compress-debug-sections,zstd,--gc-sections,--hash-style=gnu,-z,now,-z,noexecstack,-z,relro 2> output.txt- MOLD flags:
 
RAD_FLAGS_LINKER* = "-fuse-ld=mold -Wl,-s,--as-needed,--compress-debug-sections=zstd,--gc-sections,--hash-style=gnu,-z,now,-z,noexecstack,-z,relro"- BFD flags:
 
RAD_FLAGS_LINKER* = "-Wl,-O1,-s,-z,noexecstack,-z,now,-z,relro,-z,x86-64-v3,--as-needed,--gc-sections,--sort-common,--hash-style=gnu,--compress-debug-sections=zstd"Custom GCC Search Directory
Section titled “Custom GCC Search Directory”- Custom built GCCs have custom search directories. Even though I have version 
12.2.0, adding-fuse-ld=moldwas not sufficient for my customgccto find the host’smold(provided by distribution’s package manager) or my custommold(as I was getting the following errorcollect2: fatal error: cannot find 'ld' mold, which is why I had to add-B/path/to/directory/where/custom/mold/isto myCFLAGSalong with-fuse-ld=moldto get it working. - Most packages linked just fine, until I stumbled upon packages which used 
autoreconfandlibtoolto create.lafiles. Apparentlylibtoollikes to strip flags when linking. This was troublesome because I am passing-B/path/to/directory/where/custom/mold/isin myCFLAGSand it was being removed, so my customgcccould no longer findmold, giving the same error as above. - You can workaround this by modifying 
GCC_EXEC_PREFIXwhich is not desirable for many reasons. - The solution I found was to provide a symbolic link to 
moldin the search directories of the custom builtgcc(which can be listed by runninggcc -print-search-dirs). - The symbolic link was installed in 
/custom/toolchain/tuple/binwherebinutilsalready keeps its hardlinks to../../binincludingld.bfd, which is why I issued the commandln -fs ../../bin/mold /custom/toolchain/tuple/bin/ld.mold.