+2011-05-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac (gcc_cv_lto_plugin): Determine lto plugin support
+ from plugin linker.
+ * configure: Regenerate.
+
2011-05-30 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/49199
$as_echo_n "checking linker plugin support... " >&6; }
gcc_cv_lto_plugin=0
if test -f liblto_plugin.la; then
- if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
- if 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=2
- elif test "$ld_is_gold" = yes -a "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -eq 20; then
- gcc_cv_lto_plugin=1
+ save_ld_ver="$ld_ver"
+ save_ld_vers_major="$ld_vers_major"
+ save_ld_vers_minor="$ld_vers_minor"
+ save_ld_is_gold="$ld_is_gold"
+
+ ld_is_gold=no
+ if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
+ ld_ver="GNU ld"
+ # FIXME: ld_is_gold?
+ ld_vers_major="$gcc_cv_gld_major_version"
+ ld_vers_minor="$gcc_cv_gld_minor_version"
+ else
+ # Determine plugin linker version.
+ # FIXME: Partial duplicate from above, generalize.
+ ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q`
+ if echo "$ld_ver" | grep GNU > /dev/null; then
+ if echo "$ld_ver" | grep "GNU gold" > /dev/null; then
+ ld_is_gold=yes
+ ld_vers=`echo $ld_ver | sed -n \
+ -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
+ else
+ ld_vers=`echo $ld_ver | sed -n \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
+ fi
+ ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
+ ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
fi
- elif test x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld" && echo "$ld_ver" | grep GNU > /dev/null; then
+ fi
+
+ # Determine plugin support.
+ if echo "$ld_ver" | grep GNU > /dev/null; then
# Require GNU ld or gold 2.21+ for plugin support by default.
if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then
gcc_cv_lto_plugin=2
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
+
+ ld_ver="$save_ld_ver"
+ ld_vers_major="$save_ld_vers_major"
+ ld_vers_minor="$save_ld_vers_minor"
+ ld_is_gold="$save_ld_is_gold"
fi
cat >>confdefs.h <<_ACEOF
AC_MSG_CHECKING(linker plugin support)
gcc_cv_lto_plugin=0
if test -f liblto_plugin.la; then
- if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
- if 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=2
- elif test "$ld_is_gold" = yes -a "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -eq 20; then
- gcc_cv_lto_plugin=1
+ save_ld_ver="$ld_ver"
+ save_ld_vers_major="$ld_vers_major"
+ save_ld_vers_minor="$ld_vers_minor"
+ save_ld_is_gold="$ld_is_gold"
+
+ ld_is_gold=no
+ if test $in_tree_ld = yes -a x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld"; then
+ ld_ver="GNU ld"
+ # FIXME: ld_is_gold?
+ ld_vers_major="$gcc_cv_gld_major_version"
+ ld_vers_minor="$gcc_cv_gld_minor_version"
+ else
+ # Determine plugin linker version.
+ # FIXME: Partial duplicate from above, generalize.
+changequote(,)dnl
+ ld_ver=`$ORIGINAL_PLUGIN_LD_FOR_TARGET --version 2>/dev/null | sed 1q`
+ if echo "$ld_ver" | grep GNU > /dev/null; then
+ if echo "$ld_ver" | grep "GNU gold" > /dev/null; then
+ ld_is_gold=yes
+ ld_vers=`echo $ld_ver | sed -n \
+ -e 's,^[^)]*[ ]\([0-9][0-9]*\.[0-9][0-9]*[^)]*\)) .*$,\1,p'`
+ else
+ ld_vers=`echo $ld_ver | sed -n \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
+ fi
+ ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
+ ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
fi
- elif test x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" = x"$gcc_cv_ld" && echo "$ld_ver" | grep GNU > /dev/null; then
+changequote([,])dnl
+ fi
+
+ # Determine plugin support.
+ if echo "$ld_ver" | grep GNU > /dev/null; then
# Require GNU ld or gold 2.21+ for plugin support by default.
if test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -ge 21; then
gcc_cv_lto_plugin=2
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
+
+ ld_ver="$save_ld_ver"
+ ld_vers_major="$save_ld_vers_major"
+ ld_vers_minor="$save_ld_vers_minor"
+ ld_is_gold="$save_ld_is_gold"
fi
AC_DEFINE_UNQUOTED(HAVE_LTO_PLUGIN, $gcc_cv_lto_plugin,
[Define to the level of your linker's plugin support.])