Makefile.in: Regenerate.
* Makefile.in: Regenerate. * Makefile.def (gcc host module) and soft dependency on lto-plugin and configure dependency on lto-plugin configure. (lto-plugin module): Remove dependency on GCC; add dependency on liniberty. * doc/invoke.texi: (-flto, -fuse-linker-plugin): Update defaults and no longer claim that gold is required for linker plugin. * configure: Regenerate. * gcc.c (PLUGIN_COND): New macro. (LINK_COMMAND_SPEC): Use it. (main): Default to plugin enabled with HAVE_LTO_PLUGIN is set. * config.in (HAVE_LTO_PLUGIN): New. * configure.ac (--with-lto-plugin): New parameter; autodetect HAVE_LTO_PLUGIN. From-SVN: r168593
This commit is contained in:
parent
f35cafc9ff
commit
96bdf9b403
@ -1,3 +1,11 @@
|
||||
2011-01-07 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* Makefile.in: Regenerate.
|
||||
* Makefile.def (gcc host module) and soft dependency on lto-plugin
|
||||
and configure dependency on lto-plugin configure.
|
||||
(lto-plugin module): Remove dependency on GCC; add dependency on
|
||||
liniberty.
|
||||
|
||||
2011-01-07 William Schmidt <wschmidt@linux.vnet.ibm.com>
|
||||
|
||||
* MAINTAINERS (Write After Approval): Add myself.
|
||||
|
@ -321,6 +321,7 @@ dependencies = { module=all-build-fixincludes; on=all-build-libiberty; };
|
||||
|
||||
// Host modules specific to gcc.
|
||||
dependencies = { module=configure-gcc; on=configure-intl; };
|
||||
dependencies = { module=configure-gcc; on=configure-lto-plugin; };
|
||||
dependencies = { module=configure-gcc; on=all-binutils; };
|
||||
dependencies = { module=configure-gcc; on=all-gas; };
|
||||
dependencies = { module=configure-gcc; on=all-ld; };
|
||||
@ -344,6 +345,7 @@ dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
|
||||
dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
|
||||
dependencies = { module=all-gcc; on=all-libiberty; };
|
||||
dependencies = { module=all-gcc; on=all-fixincludes; };
|
||||
dependencies = { module=all-gcc; on=all-lto-plugin; };
|
||||
dependencies = { module=info-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=dvi-gcc; on=all-build-libiberty; };
|
||||
dependencies = { module=pdf-gcc; on=all-build-libiberty; };
|
||||
@ -360,7 +362,7 @@ dependencies = { module=all-fixincludes; on=all-libiberty; };
|
||||
|
||||
dependencies = { module=all-gnattools; on=all-target-libada; };
|
||||
|
||||
dependencies = { module=all-lto-plugin; on=all-gcc; };
|
||||
dependencies = { module=all-lto-plugin; on=all-libiberty; };
|
||||
|
||||
dependencies = { module=configure-mpfr; on=all-gmp; };
|
||||
dependencies = { module=configure-mpc; on=all-mpfr; };
|
||||
|
30
Makefile.in
30
Makefile.in
@ -60260,6 +60260,14 @@ configure-stage3-gcc: maybe-configure-stage3-intl
|
||||
configure-stage4-gcc: maybe-configure-stage4-intl
|
||||
configure-stageprofile-gcc: maybe-configure-stageprofile-intl
|
||||
configure-stagefeedback-gcc: maybe-configure-stagefeedback-intl
|
||||
configure-gcc: maybe-configure-lto-plugin
|
||||
|
||||
configure-stage1-gcc: maybe-configure-stage1-lto-plugin
|
||||
configure-stage2-gcc: maybe-configure-stage2-lto-plugin
|
||||
configure-stage3-gcc: maybe-configure-stage3-lto-plugin
|
||||
configure-stage4-gcc: maybe-configure-stage4-lto-plugin
|
||||
configure-stageprofile-gcc: maybe-configure-stageprofile-lto-plugin
|
||||
configure-stagefeedback-gcc: maybe-configure-stagefeedback-lto-plugin
|
||||
configure-gcc: maybe-all-binutils
|
||||
|
||||
configure-stage1-gcc: maybe-all-stage1-binutils
|
||||
@ -60437,6 +60445,14 @@ all-stage4-gcc: maybe-all-stage4-libiberty
|
||||
all-stageprofile-gcc: maybe-all-stageprofile-libiberty
|
||||
all-stagefeedback-gcc: maybe-all-stagefeedback-libiberty
|
||||
all-gcc: maybe-all-fixincludes
|
||||
all-gcc: maybe-all-lto-plugin
|
||||
|
||||
all-stage1-gcc: maybe-all-stage1-lto-plugin
|
||||
all-stage2-gcc: maybe-all-stage2-lto-plugin
|
||||
all-stage3-gcc: maybe-all-stage3-lto-plugin
|
||||
all-stage4-gcc: maybe-all-stage4-lto-plugin
|
||||
all-stageprofile-gcc: maybe-all-stageprofile-lto-plugin
|
||||
all-stagefeedback-gcc: maybe-all-stagefeedback-lto-plugin
|
||||
info-gcc: maybe-all-build-libiberty
|
||||
|
||||
info-stage1-gcc: maybe-all-build-libiberty
|
||||
@ -60505,14 +60521,14 @@ all-stageprofile-libcpp: maybe-all-stageprofile-intl
|
||||
all-stagefeedback-libcpp: maybe-all-stagefeedback-intl
|
||||
all-fixincludes: maybe-all-libiberty
|
||||
all-gnattools: maybe-all-target-libada
|
||||
all-lto-plugin: maybe-all-gcc
|
||||
all-lto-plugin: maybe-all-libiberty
|
||||
|
||||
all-stage1-lto-plugin: maybe-all-stage1-gcc
|
||||
all-stage2-lto-plugin: maybe-all-stage2-gcc
|
||||
all-stage3-lto-plugin: maybe-all-stage3-gcc
|
||||
all-stage4-lto-plugin: maybe-all-stage4-gcc
|
||||
all-stageprofile-lto-plugin: maybe-all-stageprofile-gcc
|
||||
all-stagefeedback-lto-plugin: maybe-all-stagefeedback-gcc
|
||||
all-stage1-lto-plugin: maybe-all-stage1-libiberty
|
||||
all-stage2-lto-plugin: maybe-all-stage2-libiberty
|
||||
all-stage3-lto-plugin: maybe-all-stage3-libiberty
|
||||
all-stage4-lto-plugin: maybe-all-stage4-libiberty
|
||||
all-stageprofile-lto-plugin: maybe-all-stageprofile-libiberty
|
||||
all-stagefeedback-lto-plugin: maybe-all-stagefeedback-libiberty
|
||||
configure-mpfr: maybe-all-gmp
|
||||
|
||||
configure-stage1-mpfr: maybe-all-stage1-gmp
|
||||
|
@ -1,3 +1,15 @@
|
||||
2011-01-07 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* doc/invoke.texi: (-flto, -fuse-linker-plugin): Update defaults
|
||||
and no longer claim that gold is required for linker plugin.
|
||||
* configure: Regenerate.
|
||||
* gcc.c (PLUGIN_COND): New macro.
|
||||
(LINK_COMMAND_SPEC): Use it.
|
||||
(main): Default to plugin enabled with HAVE_LTO_PLUGIN is set.
|
||||
* config.in (HAVE_LTO_PLUGIN): New.
|
||||
* configure.ac (--with-lto-plugin): New parameter; autodetect
|
||||
HAVE_LTO_PLUGIN.
|
||||
|
||||
2011-01-07 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR tree-optimization/46367
|
||||
|
@ -1142,6 +1142,10 @@
|
||||
#undef HAVE_LDFCN_H
|
||||
#endif
|
||||
|
||||
/* Define if your linker supports plugin. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
#undef HAVE_LTO_PLUGIN
|
||||
#endif
|
||||
|
||||
/* Define if your linker supports --as-needed and --no-as-needed options. */
|
||||
#ifndef USED_FOR_TARGET
|
||||
|
23
gcc/configure
vendored
23
gcc/configure
vendored
@ -23093,6 +23093,29 @@ $as_echo "#define HAVE_LD_DEMANGLE 1" >>confdefs.h
|
||||
$as_echo "$gcc_cv_ld_demangle" >&6; }
|
||||
fi
|
||||
|
||||
if test -f ../lto-plugin/Makefile ; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker plugin support" >&5
|
||||
$as_echo_n "checking linker plugin support... " >&6; }
|
||||
gcc_cv_lto_plugin=no
|
||||
if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET=" = x"$gcc_cv_ld"; then
|
||||
if test x"$ld_is_gold" = xyes; then
|
||||
gcc_cv_lto_plugin=yes
|
||||
elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then \
|
||||
gcc_cv_lto_plugin=yes
|
||||
fi
|
||||
# Check if the linker supports --plugin-opt option
|
||||
elif $ORIGINAL_PLUGIN_LD_FOR_TARGET --help 2>/dev/null | grep plugin-opt > /dev/null; then
|
||||
gcc_cv_lto_plugin=yes
|
||||
fi
|
||||
if test x"$gcc_cv_lto_plugin" = xyes; then
|
||||
|
||||
$as_echo "#define HAVE_LTO_PLUGIN 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_lto_plugin" >&5
|
||||
$as_echo "$gcc_cv_lto_plugin" >&6; }
|
||||
fi
|
||||
|
||||
case "$target" in
|
||||
# All TARGET_ABI_OSF targets.
|
||||
alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
|
||||
|
@ -3149,6 +3149,26 @@ if test x"$demangler_in_ld" = xyes; then
|
||||
AC_MSG_RESULT($gcc_cv_ld_demangle)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(linker plugin support)
|
||||
gcc_cv_lto_plugin=no
|
||||
if test -f ../lto-plugin/Makefile ; then
|
||||
if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET=" = x"$gcc_cv_ld"; then
|
||||
if test x"$ld_is_gold" = xyes; then
|
||||
gcc_cv_lto_plugin=yes
|
||||
elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2; then \
|
||||
gcc_cv_lto_plugin=yes
|
||||
fi
|
||||
# Check if the linker supports --plugin-opt option
|
||||
elif $ORIGINAL_PLUGIN_LD_FOR_TARGET --help 2>/dev/null | grep plugin-opt > /dev/null; then
|
||||
gcc_cv_lto_plugin=yes
|
||||
fi
|
||||
fi
|
||||
if test x"$gcc_cv_lto_plugin" = xyes; then
|
||||
AC_DEFINE(HAVE_LTO_PLUGIN, 1,
|
||||
[Define if your linker supports plugin.])
|
||||
fi
|
||||
AC_MSG_RESULT($gcc_cv_lto_plugin)
|
||||
|
||||
case "$target" in
|
||||
# All TARGET_ABI_OSF targets.
|
||||
alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*)
|
||||
|
@ -7587,23 +7587,21 @@ types in separate translation units to be linked together (undefined
|
||||
behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
|
||||
issued. The behavior is still undefined at runtime.
|
||||
|
||||
If object files containing GIMPLE bytecode are stored in a library
|
||||
archive, say @file{libfoo.a}, it is possible to extract and use them
|
||||
in an LTO link if you are using @command{gold} as the linker (which,
|
||||
in turn requires GCC to be configured with @option{--enable-gold}).
|
||||
To enable this feature, use the flag @option{-fuse-linker-plugin} at
|
||||
link-time:
|
||||
If object files containing GIMPLE bytecode are stored in a library archive, say
|
||||
@file{libfoo.a}, it is possible to extract and use them in an LTO link if you
|
||||
are using a linker with linker plugin support. To enable this feature, use
|
||||
the flag @option{-fuse-linker-plugin} at link-time:
|
||||
|
||||
@smallexample
|
||||
gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
|
||||
@end smallexample
|
||||
|
||||
With the linker plugin enabled, @command{gold} will extract the needed
|
||||
With the linker plugin enabled, the linker will extract the needed
|
||||
GIMPLE files from @file{libfoo.a} and pass them on to the running GCC
|
||||
to make them part of the aggregated GIMPLE image to be optimized.
|
||||
|
||||
If you are not using @command{gold} and/or do not specify
|
||||
@option{-fuse-linker-plugin} then the objects inside @file{libfoo.a}
|
||||
If you are not using a linker with linker plugin support and/or do not
|
||||
enable linker plugin then the objects inside @file{libfoo.a}
|
||||
will be extracted and linked as usual, but they will not participate
|
||||
in the LTO optimization process.
|
||||
|
||||
@ -7667,13 +7665,20 @@ files in LTO mode (via @option{-flto}).
|
||||
Disabled by default.
|
||||
|
||||
@item -fuse-linker-plugin
|
||||
Enables the extraction of objects with GIMPLE bytecode information
|
||||
from library archives. This option relies on features available only
|
||||
in @command{gold}, so to use this you must configure GCC with
|
||||
@option{--enable-gold}. See @option{-flto} for a description on the
|
||||
effect of this flag and how to use it.
|
||||
Enables the use of linker plugin during link time optimization. This option
|
||||
relies on the linker plugin support in linker that is available in @code{gold}
|
||||
or in GNU ld 2.21.51 or newer..
|
||||
|
||||
Disabled by default.
|
||||
This option enables the extraction of object files with GIMPLE bytecode out of
|
||||
library archives. This improves the quality of optimization by exposing more
|
||||
code the the link time optimizer. This information specify what symbols
|
||||
can be accessed externally (by non-LTO object or during dynamic linking).
|
||||
Resulting code quality improvements on binaries (and shared libaries that do
|
||||
use hidden visibility) is similar to @code{-fwhole-program}. See
|
||||
@option{-flto} for a description on the effect of this flag and how to use it.
|
||||
|
||||
Enabled by default when LTO support in GCC is enabled and GCC was compiled
|
||||
with linker supporting plugins (GNU ld or @code{gold}).
|
||||
|
||||
@item -fcprop-registers
|
||||
@opindex fcprop-registers
|
||||
|
18
gcc/gcc.c
18
gcc/gcc.c
@ -621,6 +621,13 @@ proper position among the other output files. */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Conditional to test whether plugin is used or not. */
|
||||
#ifdef HAVE_LTO_PLUGIN
|
||||
#define PLUGIN_COND "!fno-use-linker-plugin"
|
||||
#else
|
||||
#define PLUGIN_COND "fuse-linker-plugin"
|
||||
#endif
|
||||
|
||||
|
||||
/* -u* was put back because both BSD and SysV seem to support it. */
|
||||
/* %{static:} simply prevents an error message if the target machine
|
||||
@ -634,7 +641,7 @@ proper position among the other output files. */
|
||||
#define LINK_COMMAND_SPEC "\
|
||||
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
|
||||
%(linker) \
|
||||
%{fuse-linker-plugin: \
|
||||
%{"PLUGIN_COND": \
|
||||
-plugin %(linker_plugin_file) \
|
||||
-plugin-opt=%(lto_wrapper) \
|
||||
-plugin-opt=-fresolution=%u.res \
|
||||
@ -6779,7 +6786,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2)
|
||||
{
|
||||
int tmp = execution_count;
|
||||
#ifdef HAVE_LTO_PLUGIN
|
||||
const char *fno_use_linker_plugin = "fno-use-linker-plugin";
|
||||
#else
|
||||
const char *fuse_linker_plugin = "fuse-linker-plugin";
|
||||
#endif
|
||||
|
||||
/* We'll use ld if we can't find collect2. */
|
||||
if (! strcmp (linker_name_spec, "collect2"))
|
||||
@ -6789,8 +6800,13 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
linker_name_spec = "ld";
|
||||
}
|
||||
|
||||
#ifdef HAVE_LTO_PLUGIN
|
||||
if (!switch_matches (fno_use_linker_plugin,
|
||||
fno_use_linker_plugin + strlen (fno_use_linker_plugin), 0))
|
||||
#else
|
||||
if (switch_matches (fuse_linker_plugin,
|
||||
fuse_linker_plugin + strlen (fuse_linker_plugin), 0))
|
||||
#endif
|
||||
{
|
||||
linker_plugin_file_spec = find_a_file (&exec_prefixes,
|
||||
LTOPLUGINSONAME, R_OK,
|
||||
|
Loading…
x
Reference in New Issue
Block a user