Using gold in the place of ld as a system linker on fedora
Asked Answered
V

2

8

I want to use gold as my system linker instead of ld as ld doesn't support -fPIC and -shared. I followed this particular url to do so, gold-plugin As per the documentation, I ran gcc -v filename.c to find out what link command gcc would run. Then it tells me to check for line that runs collect2 and replace it with -plugin /path/to/LLVMgold.so. But gcc and collect2 are binary files. I studied a bit..and understood gcc calls collect2 ,in turn collect2 calls system linker ld by searching for ld-linux.so.2. I have rpm packeage of gcc4.4.4 installed on my fedora...how can I change my configuration.

How can I make gcc call ld-new/gold instead of collect2?

Vandiver answered 10/11, 2012 at 11:26 Comment(0)
I
12

I'm a bit late to answer, but I realised Fedora comes out with gold distributed with binutils. The command is ld.gold. You can select it as the default linker using alternatives :

# alternatives --config ld

There is 2 program that provides 'ld'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/bin/ld.bfd
   2           /usr/bin/ld.gold

Enter to keep the current selection[+], or type selection number: 2
Indian answered 3/8, 2014 at 20:22 Comment(0)
C
0

As I read standard tools like ld or ar can't be renamed or have extension like ld_1.6 or whatever. maybe you can change name of ld_new to ld and put its address before PATH in .login.user file or add temporally in command line. Then when ever any program calls ld you can be sure your ld will be invoked first, its the way that I am using ld-gold without changing bin/ld.

Centeno answered 14/3, 2013 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.