[SERVER-17995] prefer the gold linker if it is available Created: 10/Apr/15  Updated: 21/Jun/16  Resolved: 26/Aug/15

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.1.8

Type: Bug Priority: Major - P3
Reporter: Adam Midvidy Assignee: Jonathan Reams
Resolution: Done Votes: 0
Labels: build-jbr
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-19089 Automatically use the gold linker if ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

build with CCFLAGS=-fuse-ld=gold

Sprint: Build 7 08/10/15, Build 8 08/31/15
Participants:

 Description   

gold seems to be noticeably faster than GNU ld.

We should use TryLink with gold, and prefer it if a system has it.



 Comments   
Comment by Githook User [ 26/Aug/15 ]

Author:

{u'username': u'jbreams', u'name': u'Jonathan Reams', u'email': u'jbreams@mongodb.com'}

Message: SERVER-17995 Prefer gold linker if available
Branch: master
https://github.com/mongodb/mongo/commit/0012f709633712156046ba9080a6b668dbe203ca

Comment by Adam Midvidy [ 10/Aug/15 ]

As this is a clear win, and most people don't care to customize their build flags beyond the bare minimum, I'm inclined to say yes, unless it is complex to implement.

Comment by Andrew Morrow (Inactive) [ 10/Aug/15 ]

Do we still think this is useful now that command line or mongo_custom_variables.py can just say LINKFLAGS="-fuse-ld=gold" or whatever?

Comment by Eric Milkie [ 13/Apr/15 ]

Clang doesn't have --use-ld (presumably because that is a GNU-specific option to select which GNU linker to use). For Clang users, you can select which linker it uses via alternatives(8):

/data/: sudo alternatives --config ld
 
There are 2 programs which provide 'ld'.
 
  Selection    Command
-----------------------------------------------
*+ 1           /usr/bin/ld.bfd
   2           /usr/bin/ld.gold
 
Enter to keep the current selection[+], or type selection number: 2

So I think this TryLink effort will only benefit gcc users. Should we encourage developers to switch to gold?
Also curious if the llvm linker lld is ready for prime-time yet.

Comment by Andrew Morrow (Inactive) [ 10/Apr/15 ]

This would require that we add support for AddFlagIfSupported for linker targeted flags in SCons, which is something that we want. Basically, we need to try to compile/link with -fuse-ld=gold. If it works, add it to CCFLAGS.

Generated at Thu Feb 08 03:46:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.