public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* configuring gcc 4.6 to use gold for LTO plugin
@ 2011-06-07 11:42 Jonathan Wakely
  2011-06-07 13:39 ` Jonathan Wakely
  2011-06-07 13:58 ` Ian Lance Taylor
  0 siblings, 2 replies; 7+ messages in thread
From: Jonathan Wakely @ 2011-06-07 11:42 UTC (permalink / raw)
  To: gcc-help

I installed binutils with --enable-gold=default then I configured gcc
4.6-20110520 with the same prefix as the newly installed binutils.

config.log shows:

configure:13814: checking where to find the target ld
configure:13842: result: pre-installed in
/home/wakelj/tools/Linux-x86_64/lto/x86_64-unknown-linux-gnu/bin

and gcc/config.log shows:

configure:21077: checking whether we are using gold
configure:21086: result: yes
configure:21097: checking what linker to use
configure:21122: result:
/home/wakelj/tools/Linux-x86_64/lto/x86_64-unknown-linux-gnu/bin/ld

So it has found the desired binutils and $ld_is_gold=yes, but:

configure:23116: checking linker plugin support
configure:23136: result: no

This is because I don't have an in-tree ld and "ld --version 2>&1 |
fgrep plugin-opt" fails, so $gcc_cv_lto_plugin=no

So will this gcc use a linker plugin?

It looks like I could get it to by adding
--with-plugin-ld=blahblah/ld.bfd but then it uses ld.bfd not gold.

The test in gcc/configure on trunk is completely different and seems
to do what I expected (setting $gcc_cv_lto_plugin=yes based on the
version of ld/gold being used, not on whether grepping for plugin-opt
works)

If I want to use 4.6+LTO+plugin do I need an in-tree gold, or don't use gold?

And if I don't have an in-tree binutils but want gold+LTO+plugin I
need to use 4.7?

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: configuring gcc 4.6 to use gold for LTO plugin
  2011-06-07 11:42 configuring gcc 4.6 to use gold for LTO plugin Jonathan Wakely
@ 2011-06-07 13:39 ` Jonathan Wakely
  2011-06-07 14:00   ` Ian Lance Taylor
  2011-06-07 13:58 ` Ian Lance Taylor
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2011-06-07 13:39 UTC (permalink / raw)
  To: gcc-help

On 7 June 2011 12:16, Jonathan Wakely wrote:
> I installed binutils with --enable-gold=default then I configured gcc
> 4.6-20110520 with the same prefix as the newly installed binutils.
>
> config.log shows:
>
> configure:13814: checking where to find the target ld
> configure:13842: result: pre-installed in
> /home/wakelj/tools/Linux-x86_64/lto/x86_64-unknown-linux-gnu/bin
>
> and gcc/config.log shows:
>
> configure:21077: checking whether we are using gold
> configure:21086: result: yes
> configure:21097: checking what linker to use
> configure:21122: result:
> /home/wakelj/tools/Linux-x86_64/lto/x86_64-unknown-linux-gnu/bin/ld
>
> So it has found the desired binutils and $ld_is_gold=yes, but:
>
> configure:23116: checking linker plugin support
> configure:23136: result: no
>
> This is because I don't have an in-tree ld and "ld --version 2>&1 |
> fgrep plugin-opt" fails, so $gcc_cv_lto_plugin=no
>
> So will this gcc use a linker plugin?
>
> It looks like I could get it to by adding
> --with-plugin-ld=blahblah/ld.bfd but then it uses ld.bfd not gold.
>
> The test in gcc/configure on trunk is completely different and seems
> to do what I expected (setting $gcc_cv_lto_plugin=yes based on the
> version of ld/gold being used, not on whether grepping for plugin-opt
> works)
>
> If I want to use 4.6+LTO+plugin do I need an in-tree gold, or don't use gold?
>
> And if I don't have an in-tree binutils but want gold+LTO+plugin I
> need to use 4.7?

Oh ... or does all that configury only affect whether
-fuse-linker-plugin is enabled by default, and I can make it work with
gold by using -fuse-linker-plugin on the command line when I use
-flto?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: configuring gcc 4.6 to use gold for LTO plugin
  2011-06-07 11:42 configuring gcc 4.6 to use gold for LTO plugin Jonathan Wakely
  2011-06-07 13:39 ` Jonathan Wakely
@ 2011-06-07 13:58 ` Ian Lance Taylor
  2011-06-07 14:24   ` Jonathan Wakely
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2011-06-07 13:58 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

Jonathan Wakely <jwakely.gcc@gmail.com> writes:

> This is because I don't have an in-tree ld and "ld --version 2>&1 |
> fgrep plugin-opt" fails, so $gcc_cv_lto_plugin=no

You mean ld --help, don't you?  Does your gold --help show --plugin-opt?
It should.  If it doesn't, then that's the first thing to fix.  What
version of gold are you using?  You didn't somehow configure the
binutils with --disable-plugins, did you?

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: configuring gcc 4.6 to use gold for LTO plugin
  2011-06-07 13:39 ` Jonathan Wakely
@ 2011-06-07 14:00   ` Ian Lance Taylor
  2011-06-07 14:26     ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2011-06-07 14:00 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

Jonathan Wakely <jwakely.gcc@gmail.com> writes:

> Oh ... or does all that configury only affect whether
> -fuse-linker-plugin is enabled by default, and I can make it work with
> gold by using -fuse-linker-plugin on the command line when I use
> -flto?

Yes, that is the only effect of the configure test, and, yes, it should
work to use -fuse-linker-plugin by hand.

Ian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: configuring gcc 4.6 to use gold for LTO plugin
  2011-06-07 13:58 ` Ian Lance Taylor
@ 2011-06-07 14:24   ` Jonathan Wakely
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Wakely @ 2011-06-07 14:24 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On 7 June 2011 14:51, Ian Lance Taylor wrote:
> Jonathan Wakely <jwakely.gcc@gmail.com> writes:
>
>> This is because I don't have an in-tree ld and "ld --version 2>&1 |
>> fgrep plugin-opt" fails, so $gcc_cv_lto_plugin=no
>
> You mean ld --help, don't you?

Oops, sorry, yes.  I mean --help, which is the test used in
gcc/configure in the 4.6 branch:

  elif $ORIGINAL_PLUGIN_LD_FOR_TARGET --help 2>/dev/null | grep
plugin-opt > /dev/null; then

>  Does your gold --help show --plugin-opt?

No:

$ ~/tools/Linux-x86_64/lto/bin/ld --help | fgrep plugin
$ ~/tools/Linux-x86_64/lto/bin/ld.gold --help | fgrep plugin
$ ~/tools/Linux-x86_64/lto/bin/ld.gold --version
GNU gold (GNU Binutils 2.21) 1.10
Copyright 2010 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

But ld.bfd from the same build does:

$ ~/tools/Linux-x86_64/lto/bin/ld.bfd --help | fgrep plugin
  -plugin PLUGIN              Load named plugin
  -plugin-opt ARG             Send arg to last-loaded plugin

That's why I suggested I could solve my problem by using
--with-plugin-ld=blahblah/ld.bfd, because the "ld --help | fgrep
plugin-opt" test would work.

> It should.  If it doesn't, then that's the first thing to fix.  What
> version of gold are you using?  You didn't somehow configure the
> binutils with --disable-plugins, did you?

Not intentionally, no:

$ head ~/src/gcc/binutils-2.21/config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ ./configure --prefix=/home/wakelj/tools/Linux-x86_64/lto
--enable-lto --enable-gold=default


Thanks for the answers, I now know that what I'm seeing is indeed odd
so that's why I was surprised.  I'll try to get to the bottom of why
gold has plugins disabled but ld.bfd doesn't.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: configuring gcc 4.6 to use gold for LTO plugin
  2011-06-07 14:00   ` Ian Lance Taylor
@ 2011-06-07 14:26     ` Jonathan Wakely
  2011-06-07 17:57       ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2011-06-07 14:26 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On 7 June 2011 14:53, Ian Lance Taylor <iant@google.com> wrote:
> Jonathan Wakely <jwakely.gcc@gmail.com> writes:
>
>> Oh ... or does all that configury only affect whether
>> -fuse-linker-plugin is enabled by default, and I can make it work with
>> gold by using -fuse-linker-plugin on the command line when I use
>> -flto?
>
> Yes, that is the only effect of the configure test, and, yes, it should
> work to use -fuse-linker-plugin by hand.

I tried that and got an error from gold saying -plugin was an unknown
option, so somehow my binutils build disabled plugins for gold but not
bfd.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: configuring gcc 4.6 to use gold for LTO plugin
  2011-06-07 14:26     ` Jonathan Wakely
@ 2011-06-07 17:57       ` Jonathan Wakely
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Wakely @ 2011-06-07 17:57 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On 7 June 2011 15:19, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 7 June 2011 14:53, Ian Lance Taylor <iant@google.com> wrote:
>> Jonathan Wakely <jwakely.gcc@gmail.com> writes:
>>
>>> Oh ... or does all that configury only affect whether
>>> -fuse-linker-plugin is enabled by default, and I can make it work with
>>> gold by using -fuse-linker-plugin on the command line when I use
>>> -flto?
>>
>> Yes, that is the only effect of the configure test, and, yes, it should
>> work to use -fuse-linker-plugin by hand.
>
> I tried that and got an error from gold saying -plugin was an unknown
> option, so somehow my binutils build disabled plugins for gold but not
> bfd.

I was misled by the fact my ld.bfd supports (or claims to support)
plugins and assumed --enable-plugins was the default, but it's not.

After adding --enable-plugins I get a plugin-enabled ld and ld.gold as
well as a plugin-enabled ld.bfd.

Now to rebuild gcc to use it.

Thanks for your help, Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-07 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 11:42 configuring gcc 4.6 to use gold for LTO plugin Jonathan Wakely
2011-06-07 13:39 ` Jonathan Wakely
2011-06-07 14:00   ` Ian Lance Taylor
2011-06-07 14:26     ` Jonathan Wakely
2011-06-07 17:57       ` Jonathan Wakely
2011-06-07 13:58 ` Ian Lance Taylor
2011-06-07 14:24   ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).