GNU C++ and Gold Linker

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:

  1.  Use the -fuse flag on gcc/g++:  g++ -fuse-ld=gold test.cpp
  2. Setting “export LD=ld.gold” so that the $LD environment variable uses ld.gold rather than ld (this is useful for projects using makefiles)
  3. As the super user, running binutils-config –linker ld.gold to change the default
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s