This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR bootstrap/55552: --enable-gold=default doesn't work with in-tree binutils
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Nov 2012 11:33:57 -0800
- Subject: [PATCH] PR bootstrap/55552: --enable-gold=default doesn't work with in-tree binutils
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
Toplevel configure supports:
# Handle --enable-gold, --enable-ld.
# --disable-gold [--enable-ld]
# Build only ld. Default option.
# --enable-gold [--enable-ld]
# Build both gold and ld. Install gold as "ld.gold", install ld
# as "ld.bfd" and "ld".
# --enable-gold=default [--enable-ld]
# Build both gold and ld. Install gold as "ld.gold" and "ld",
# install ld as "ld.bfd".
# --enable-gold[=default] --disable-ld
# Build only gold, which is then installed as both "ld.gold" and
# "ld".
# --enable-gold --enable-ld=default
# Build both gold (installed as "ld.gold") and ld (installed as "ld"
# and ld.bfd).
# In other words, ld is default
# --enable-gold=default --enable-ld=default
# Error.
However, gcc directory doesn't handle --enable-gold=default properly.
This patch fixes --enable-gold=default. Tested on Linux/x86-64 with
GCC + binutils using:
--enable-plugins --enable-threads --enable-gold=default
OK to to install?
Thanks.
H.J.
---
2012-11-30 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/55552
* configure.ac (install_gold_as_default): New. Set to yes for
--disable-ld or --enable-gold=default.
(gcc_cv_ld_gold_srcdir): New.
(gcc_cv_ld): Also check in-tree gold if install_gold_as_default
is yes.
* configure: Regenerated.
* exec-tool.in (dir) [collect-ld && ../gold/ld-new]: Set to gold.
(fast_install) [collect-ld && ../gold/ld-new]: Set to yes.
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c6f57bd..48191c8 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1999,6 +1999,34 @@ else
in_tree_gas=no
fi
+default_ld=
+AC_ARG_ENABLE(ld,
+[[ --enable-ld[=ARG] build ld [ARG={default,yes,no}]]],
+[case "${enableval}" in
+ no)
+ default_ld=ld.gold
+ ;;
+ esac])
+
+AC_ARG_ENABLE(gold,
+[[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]],
+[case "${enableval}" in
+ default)
+ install_gold_as_default=yes
+ ;;
+ yes)
+ if test x${default_ld} != x; then
+ install_gold_as_default=yes
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_gold_as_default=no])
+
# Identify the linker which will work hand-in-glove with the newly
# built GCC, so that we can examine its features. This is the linker
# which will be driven by the driver program.
@@ -2009,11 +2037,17 @@ fi
gcc_cv_gld_major_version=
gcc_cv_gld_minor_version=
gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld
+gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
AS_VAR_SET_IF(gcc_cv_ld,, [
if test -x "$DEFAULT_LINKER"; then
gcc_cv_ld="$DEFAULT_LINKER"
+elif test $install_gold_as_default = yes \
+ && test -f $gcc_cv_ld_gold_srcdir/configure.ac \
+ && test -f ../gold/Makefile \
+ && test x$build = x$host; then
+ gcc_cv_ld=../gold/ld-new$build_exeext
elif test -f $gcc_cv_ld_gld_srcdir/configure.in \
&& test -f ../ld/Makefile \
&& test x$build = x$host; then
diff --git a/gcc/exec-tool.in b/gcc/exec-tool.in
index 8a10775..6e1e710 100644
--- a/gcc/exec-tool.in
+++ b/gcc/exec-tool.in
@@ -44,7 +44,13 @@ case "$invoked" in
original=$ORIGINAL_LD_FOR_TARGET
fi
prog=ld-new$exeext
- dir=ld
+ if test "$original" = ../gold/ld-new$exeext; then
+ dir=gold
+ # No need to handle relink since gold doesn't use libtool.
+ fast_install=yes
+ else
+ dir=ld
+ fi
id=ld
;;
nm)
--
1.7.11.7