Uploaded image for project: 'Snowstorm'
  1. Snowstorm
  2. STORM-819

[VWR-24254] Add support for ld.gold on linux.


    • Type: Story
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
    • Environment:


      ld.gold comes with every linux distribution: it's part of the package binutils that also contains the default linker /usr/bin/ld. The big difference is that while the latter is based upon libbfd which supports every thinkable linkage format and their mother, ld.gold is aimed exclusively on linux' own standard: ELF.. and speed (I'm not aware why it still isn't the default linker on linux, although the below might be a reason: it SHOULD be a 'drop in' replacement for ld, but apparently, it isn't).

      ld.gold is twice as fast as ld: the final linking stage takes 8 seconds instead of 19 seconds on my box,
      but that is provided you don't start to swap with ld. More important is that ld.gold uses 2 Gigabytes less
      RAM during the final linkage of the viewer! On machine with less than 4 GB that makes a HUGE difference!

      In order to use it, you just have to pass the linker option -use-gold to gcc.
      In other words, configure the viewer with: -DCMAKE_EXE_LINKER_FLAGS:STRING="-Wl,-use-gold"

      Unfortunately, currently the viewer doesn't compile then: ld.gold doesn't always find the right
      libraries that are needed by other libraries and we have to explicitly tell it to link with
      libthread.so here and there (and librt.so at one point). I also needed to add libfontconfig

      Obviously, this has no effect whatsoever if you are not using ld.gold - on linux or not (although
      these extra dependencies are only added on linux).




            • Assignee:
              aleric.inglewood Aleric Inglewood
              Extended Group Visibility:
            • Watchers:
              0 Start watching this issue


              • Created: