This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)
- From: Michael Matz <matz at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>, Richard Guenther <rguenther at suse dot de>
- Date: Sat, 26 Mar 2011 03:51:06 +0100 (CET)
- Subject: Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944)
Hi,
[sorry for breaking the threading I've deleted the mails I'm answering
already]
In any case, citing from
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01250.html
> Here's the patch I came up with. It is on top of the previous one, so
> if we want to backport to 4.6 later, both are necessary.
>
> It also fixes a typo in the in_tree_ld case, which can never have
> worked.
>
> Tested by i386-pc-solaris2.11 bootstraps with either Sun ld or gld 2.21,
> and by configuring with Sun ld --with-plugin-ld=gld-2.21 and obvserving
> HAVE_LTO_PLUGIN being set to 1.
...
> @@ -3207,6 +3207,10 @@
> elif test "$ld_is_gold" = yes -a "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 20; then
> gcc_cv_lto_plugin=1
> fi
> + elif test x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" != x"$gcc_cv_ld"; then
> + # Allow -fuse-linker-plugin if plugin linker differs from
> + # default/specified linker.
> + gcc_cv_lto_plugin=1
> fi
> fi
And this '1' is a problem. Even if I specify
--with-plugin-ld=some-good-ld (i.e. it can be reasonably assumed that I
know what I'm doing) the above forces me to still have to use
-fuse-linker-plugin when I really want to use it. This is because the
introduction of three levels of HAVE_LTO_PLUGIN: 0 (-fuse-linker-plugin
not allowed), 1 (allowed but not default for -flto), 2 (allowed and
default to on with -flto).
I think if the plugin linker is different from the normal linker we should
set HAVE_LTO_PLUGIN to 2.
Ciao,
Michael.