Testing the new “gold” linker from binutils

After reading Diego’s post on linkers, I got curious (and interested) by this new linker (also mentioned in LWN and other sites).

Developed by Ian Lance Taylor (from Google), the gold linker is now in binutils, and promises link times divided at least by 5. The code I develop at work is a big C++ project, and takes a looooot of time linking indeed (especially in debug…). So let’s see how to try this new linker

First, a big warning: this is still heavily experimental, I do not recommend to use it for your system itself. It only works on x86/amd64, does NOT link a kernel correctly for now. Keep a stable binutils, and use it for all your emerge operations. UPDATE: see Diego’s warnings too, Remember that I only test gold on C++ debug binaries, not on system packages or other important compilations.

You have been warned 😉 Now let’s see how to install a gold-enabled binutils in parallel with your stable one:

First step: enable multislot for binutils (so you’ll have both unstable/gold binutils and stable binutils available with binutils-config)

4 thoughts on “Testing the new “gold” linker from binutils”

I did not have time yet for thorough benchmarks (release time is not good for these), but for example one of the programs now links in about 15-20 seconds, instead of more than a minute. So it’s 3x-4x faster for sure 🙂

I haven’t had time to test gold yet, but at least Bernard saved me from finding out how to do so 🙂 I plan on doing it today, as I just finished a script, based again on my ruby-elf, that calculates how much space is saved by collapsing duplicated s…

Okay yet another post writing about the gold linker. I finally checked out what I wanted: indeed gold does not do the collapse of duplicated substring: my script reports this: flame@enterprise ruby-elf % ruby -Ilib tools/assess_duplicate_save.rb…