[clang] How can I make Linking clang faster?

Hi all

When I build llvm with clang, the linking is so slow and ld have a
high memory using, what can I do to solve this problem?
The linking age make my compute very slow for a long time, because
disk is reading/writing by ld.

--Liu

You can try "gold" linker (aka ld.gold) if you are not using it already.

Hi Liu,

If you use Gold as your linker, the link time memory usage is severely reduced.

I've also found CTRL-C'ing the build close to the link step and rebuilding with -j1 to help too, so linking isn't done in parallel.

Cheers,

James

Hi Liu,

If you use Gold as your linker, the link time memory usage is severely reduced.

I've also found CTRL-C'ing the build close to the link step and rebuilding with -j1 to help too, so linking isn't done in parallel.

Cheers,

James

Thank you, James.

Thank you, Konstantin.
I'll trying gold.

--Liu

Another option is to build with shared libraries. At least for LLVM this should remove the long final linking step. You pay for this with
slightly higher execution time of clang.

Cheers
Tobi