The Gold linker (ld.gold) is a ELF linker developed at Google and added to the binutils toolset that can be used in place of standard linker (ld) from binutils. The Gold linker offers faster object linking times for C++ programs, which is particularly attractive to large C++ code bases. Please follow this link (Linux Foundation) for an interesting read on how it works.
Most Linux platforms will default to using the standard linker, so below are a few options for overriding and using the ld.gold linker:
- Use the -fuse flag on gcc/g++: g++ -fuse-ld=gold test.cpp
- Setting “export LD=ld.gold” so that the $LD environment variable uses ld.gold rather than ld (this is useful for projects using makefiles)
- As the super user, running binutils-config –linker ld.gold to change the default