[PATCH 0 of 3] Add support for using gold instead of ld

Arnaud Lacombe lacombar@gmail.com
Tue Dec 28 19:31:00 GMT 2010


Hi,

On Tue, Dec 28, 2010 at 2:11 PM, Bryan Hundven <bryanhundven@gmail.com> wrote:
> On Tue, Dec 28, 2010 at 10:02 AM, Yann E. MORIN
> <yann.morin.1998@anciens.enib.fr> wrote:
>> Bryan, Arnaud, All,
>>
>> On Tuesday 28 December 2010 01:18:06 Bryan Hundven wrote:
>>> On Mon, Dec 27, 2010 at 3:58 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
>>> > That is incomplete You also need to pass --enable-gold to gcc's
>>> > configure to build the linker plugin.
>>> Right. Is this only when ld.gold is ld?
>>> Or just when gold is enabled at all.
>>
>> Indeed, what happens if binutils is configured with both ld and gold, but
>> ld is the default? Or when I configure binutils without gold, but configure
>> gcc to enable gold?
>>
>> Does gcc directly calls to ld.gold, or still calls to ld?
>>
>> Defintitely, the gcc documentation is not explicit...
>
> It sounds like we have some testing to do, or if anyone out there can
> explain this behavior it will save some cpu cycles...
>
... and a patch to send to complete the documentation so that other
does not have to re-iterate through same search.

That said, it would seem that the default linker depends. As I'd
understand it so far, gcc maintain its own set of tools in its
internal directory structure (the one containing "as", "ld", ...) use
them to access the actual linker. It looks it can be overridden by the
DEFAULT_LINKER configure time environment variable (accessible at
configure time through the --with-ld=bla switch).

More info seem to be available in gcc/collect2.c, more specifically
the part of main() after "Try to discover a valid linker/nm/strip to
use." around line 1300.

>> For now, I'll consider that --enable-gold will only build the lto plugin...
>
> Again. --enable-gold has been in gcc since 4.4, so --enable-gold just
> makes gcc use the gold linker.
>
well, that's still to be checked as binutils, gcc and gdb share the
same top level configure.ac/makefile.am. I have not found anything
conclusive yesterday about this, so I would be tempted to reach the
same conclusion as Yann.

> If it isn't available, I'd guess that gcc's configure would bomb out
> because either ld.gold doesn't exist or ld doesn't look like a gold
> linker.
>
> LTO is in gcc 4.5 and greater, and it just so happens that binutils
> gained support for building linker plugins in 2.21...
>
AFAIK, LTO does not make the linker plugin mandatory.

> Maybe specific versions of binutils should be paired with specific
> versions of gcc.
>
Unless proven otherwise, I am doubtful, that would be a huge regression.

 - Arnaud

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list