LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Using gold as the default linker (https://www.linuxquestions.org/questions/linux-from-scratch-13/using-gold-as-the-default-linker-4175537007/)

corbis_demon 03-17-2015 09:16 AM

Using gold as the default linker
 
Hi,
Has anyone here had success with using ld.gold? If yes, it'd be great if I could get a few pointers:

1. I primarily use the CLFS book to set-up an x86_64-64 build. Would I need to add gold support in the temporary toolchain as well? In chapter 10.18 of the book, I configured binutils with "--enable-gold" and it compiled fine. I linked /usr/bin/ld to ld.gold and proceeded to compile gcc. But I get this error:
Code:

/tools/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/../../../../x86_64-unknown-linux-gnu/bin/ld: /tmp/ccWICiMC.ltrans0.ltrans.o: relocation R_X86_64_PC32 against undefined symbol `__do_global_dtors_aux' can not be used when making a shared object; recompile with -fPIC
/tools/lib/gcc/x86_64-unknown-linux-gnu/4.8.4/../../../../x86_64-unknown-linux-gnu/bin/ld: final link failed: Bad value

So, at this stage, is the ld from the temp toolchain being used or the one in /usr/bin? If the former is true, then linking to gold was futile, and gold support should have been added earlier?

2. Is it alright to use the LFS book instead of CLFS, for x86_64-64, when both host and target arch are the same? I ask this because I had been advised to use the CLFS book for 64-bit, supposedly because it produced a more stable build.

Thanks in advance. :)

hendrickxm 03-17-2015 01:11 PM

tuxbg recompiles his slackware and uses ld gold.
There is some stuff you find find in this topic:
http://www.linuxquestions.org/questi...648/page3.html

Before trying LFS, I recbuild archlinux, slackware and created hybrids of slackware, 0linux, ...

corbis_demon 03-17-2015 02:23 PM

Hmmm...That looked to me like the stock slackbuild for binutils, only with the default linker switched to gold. My question, though, was whether I need to compile the temporary toolchain with support for gold as well. In the error code I cited above, the linker failed with a suggestion to compile with PIC, despite not having enabled -pie -fPIE or even partial relro.

hendrickxm 03-17-2015 02:26 PM

Quote:

Originally Posted by corbis_demon (Post 5333583)
Hmmm...That looked to me like the stock slackbuild for binutils, only with the default linker switched to gold. My question, though, was whether I need to compile the temporary toolchain with support for gold as well. In the error code I cited above, the linker failed with a suggestion to compile with PIC, despite not having enabled -pie -fPIE or even partial relro.

I have no experience myself but I do not think your temporary toolchain needs support for gold.

corbis_demon 03-17-2015 02:38 PM

Ok, thank you for your input. I'll start an experimental setup over the weekend, first building a CLFS system with support for gold, and then building an LFS system with the CLFS build as the host. Will try out different things, especially some toolchain hardening with Gentoo's patches and see how that works out. I'll keep this post open until after a successful build. Thanks again.


All times are GMT -5. The time now is 04:54 PM.