Gold Linker

It is a bit strange that the Gold linker is still not the default linker on Red Hat, Fedora or Ubuntu or any of their downstream distributions. Gold has been around for a number of years, having been first released to the open source community in early 2008. It was developed by Ian Lance Taylor and a small team at Google.

Gold is drop-in replacement for the traditional BFD (Binary File Descriptor) based linker on X86 and X86_64 platforms. It links object files up to five times faster than the BFD linker. On very large builds such as the Chromium browser (which Google Chrome is based on), this can significantly reduce the build time. Some of the reasons that it is faster are that (1) it only supports ELF (Executable and Linking Format) objects and (2) only runs on Unix-like operating systems.

You can use the alternatives utility to change the default linker to Gold on Fedora, Red Hat and CentOS.

lrwxrwxrwx. 1 root root      20 Aug 29 08:36 ld -> /etc/alternatives/ld
-rwxr-xr-x. 1 root root  767008 Jul 12 11:17 ld.bfd
-rwxr-xr-x. 1 root root 2613328 Jul 12 11:17

On ubuntu and it’s derivatives, you can use the update-alternatives command.

lrwxrwxrwx 1 root root       7 2011-08-30 02:11 ld ->
-rwxr-xr-x 1 root root  531716 2010-09-17 17:36 ld.bfd
-rwxr-xr-x 1 root root 1652984 2010-09-17 17:36

If you do not want use the alternatives or update-alternatives utilities, simply set up the correct soft link yourself. This is want I normally do.

If you want to know more about linkers and Gold in particular Ian Lance Taylor has a twenty-part series about linker internals on his blog.

Comments are closed.