* RFA/RFC: Enable both gold and ld in a single toolchain
@ 2010-03-04 19:26 Nick Clifton
2010-03-04 20:47 ` H.J. Lu
` (3 more replies)
0 siblings, 4 replies; 44+ messages in thread
From: Nick Clifton @ 2010-03-04 19:26 UTC (permalink / raw)
To: gcc-patches; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 3202 bytes --]
Hi Guys,
I have created a patch (attached) that enables both GOLD and LD to be
built and used in a single toolchain. This allows easy comparison of
the two linkers with just a single command line switch to choose
between them.
I suspect that the patch may not be approved, but I wanted to
contribute it in case anyone else was interested in this facility.
In order to build both linkers it is necessary to run the top level
configure script with the switch:
--enable-gold=both
Then once the linkers are built/installed you can add:
-Luse-gold
to a gcc command line to use the GOLD linker. Otherwise the LD linker
(aka gld) will be used.
There is one special caveat though. When installing the two linkers
it is necessary to install gold before ld as otherwise the ld linker
will be overwritten. Ie run:
make ... install-gold install-ld ...
The choice of -Luse-gold as the switch to select the gold linker is a
hack. One of the requirements for programs and scripts that sit
between gcc and the linker, (such as collect2 and collect-ld), is that
gcc must continue to work if they are not there and the linker is
invoked directly. Thus any options that are intended for the
intermediate programs/scripts must be disguised in some fashion.
Collect2 uses environment variables to get its options but this is,
IMHO, heinous. So instead I chose to use the -L switch. This can
take an arbitrary text argument and it will not cause the linker to
complain if the argument is not recognised or the so called library
search path does not actually exist. In theory it could break a link
if there really is a sub-directory of the current directory called
"use-gold" and this directory contains subtly invalid binaries, but
this is very unlikely to happen.
Comments welcome, and if the gcc maintainers feel that this feature is
actually wanted in the mainstream sources I will happy to apply my
patch and maintain it in the future.
Tested with i686-pc-linux-gnu, sparc-elf and arm-eabi toolchains, and
an x86 bootstrap. (That is bootstrapping without gold enabled, just
to make sure that I did not break anything).
Cheers
Nick
./ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.ac (--enable-gold): Accept a value of "both". If
this value is given then configure both ld and gold.
* configure: Regenerate.
gcc/ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.ac (gcc_cv_gold_srcdir): New cached variable -
contains the location of the gold sources.
(ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
the name of the locally built gold executable.
* configure: Regenerate.
* collect2.c (main): Detect the -Luse-gold switch and select the
gold linker, if found.
* exec-tool.in: Detect the -Luse-gold switch and select the gold
linker, if found. Add support for -v switch. Report problems
locating linker executable.
gold/ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* Makefile.am (install-exec-local): Also install the executable
as a binary named 'gold'.
* Makefile.in: Regenerate.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gold-and-ld.patch --]
[-- Type: text/x-patch, Size: 10368 bytes --]
Index: gold/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/Makefile.am,v
retrieving revision 1.60
diff -c -3 -p -r1.60 Makefile.am
*** gold/Makefile.am 3 Feb 2010 05:36:55 -0000 1.60
--- gold/Makefile.am 4 Mar 2010 15:08:22 -0000
*************** install-exec-local: ld-new$(EXEEXT)
*** 185,190 ****
--- 185,197 ----
ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
|| $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
fi
+ n=`echo gold | sed '$(transform)'`; \
+ $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/gold$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/gold$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/gold$(EXEEXT); \
+ fi
# We want install to imply install-info as per GNU standards, despite
# the cygnus option.
Index: configure.ac
===================================================================
--- configure.ac (revision 157226)
+++ configure.ac (working copy)
@@ -320,7 +320,7 @@
[ --enable-gold use gold instead of ld],
ENABLE_GOLD=$enableval,
ENABLE_GOLD=no)
-if test "${ENABLE_GOLD}" = "yes"; then
+if test "${ENABLE_GOLD}" = "yes" -o "${ENABLE_GOLD}" = "both"; then
# Check for ELF target.
is_elf=no
case "${target}" in
@@ -340,7 +340,11 @@
# Check for target supported by gold.
case "${target}" in
i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ if test "${ENABLE_GOLD}" = "both"; then
+ configdirs="${configdirs} gold"
+ else
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ fi
;;
esac
fi
@@ -2653,7 +2657,9 @@
esac
case "$enable_bootstrap:$ENABLE_GOLD: $configdirs :,$stage1_languages," in
+ yes:both:*\ gold\ *:*,c++,* | \
yes:yes:*\ gold\ *:*,c++,*) ;;
+ yes:both:*\ gold\ *:* | \
yes:yes:*\ gold\ *:*)
AC_MSG_ERROR([in a combined tree, bootstrapping with --enable-gold requires c++ in stage1_languages])
;;
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 157226)
+++ gcc/configure.ac (working copy)
@@ -1923,6 +1923,17 @@
AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
fi])
+gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
+
+AS_VAR_SET_IF(gcc_cv_gold,, [
+if test -f $gcc_cv_ld_gold_srcdir/configure.ac \
+ && test -f ../gold/Makefile \
+ && test x$build = x$host; then
+ gcc_cv_gold=../gold/ld-new$build_exeext
+else
+ gcc_cv_gold=''
+fi])
+
ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
PLUGIN_LD=`basename $gcc_cv_ld`
AC_ARG_WITH(plugin-ld,
@@ -1941,6 +1952,9 @@
*) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
esac
+ORIGINAL_GOLD_FOR_TARGET=$gcc_cv_gold
+AC_SUBST(ORIGINAL_GOLD_FOR_TARGET)
+
AC_MSG_CHECKING(what linker to use)
if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext; then
# Single tree build which includes ld. We want to prefer it
Index: gcc/exec-tool.in
===================================================================
--- gcc/exec-tool.in (revision 157226)
+++ gcc/exec-tool.in (working copy)
@@ -21,11 +21,13 @@
ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@"
ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_FOR_TARGET@"
+ORIGINAL_GOLD_FOR_TARGET="@ORIGINAL_GOLD_FOR_TARGET@"
ORIGINAL_PLUGIN_LD_FOR_TARGET="@ORIGINAL_PLUGIN_LD_FOR_TARGET@"
ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@"
exeext=@host_exeext@
fast_install=@enable_fast_install@
objdir=@objdir@
+version="1.1"
invoked=`basename "$0"`
case "$invoked" in
@@ -35,15 +37,47 @@
dir=gas
;;
collect-ld)
- # when using a linker plugin, gcc will always pass '-plugin' as the
- # first option to the linker.
- if test x"$1" = "x-plugin"; then
- original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
- else
- original=$ORIGINAL_LD_FOR_TARGET
+ prog=ld-new$exeext
+ # Look for the magic library paths "-Luse-gold" and
+ # "-Luse-ld". If present then select the indicated
+ # linker. Otherwise if -plugin is specified then
+ # choose a plugin-capable linker, otherwise use the
+ # default.
+ case "${1+$@} " in
+ *-Luse-gold\ *)
+ original=$ORIGINAL_GOLD_FOR_TARGET
+ dir=gold
+ ;;
+ *-Luse-ld\ *)
+ original=$ORIGINAL_LD_FOR_TARGET
+ dir=ld
+ ;;
+ *-plugin\ *)
+ original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
+ dir=ld
+ ;;
+ *)
+ original=$ORIGINAL_LD_FOR_TARGET
+ dir=ld
+ ;;
+ esac
+
+ # If the selected linker has not been configured then
+ # try using the others, in the order PLUGIN-LD, LD, GOLD.
+ if test x"$original" == x; then
+ if test x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" != x; then
+ original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
+ dir=ld
+ elif test x"$ORIGINAL_LD_FOR_TARGET" != x; then
+ original=$ORIGINAL_LD_FOR_TARGET
+ dir=ld
+ elif test x"$ORIGINAL_GOLD_FOR_TARGET" != x; then
+ original=$ORIGINAL_GOLD_FOR_TARGET
+ dir=gold
+ # Otherwise do nothing - the case statement below
+ # will issue an error message for us.
+ fi
fi
- prog=ld-new$exeext
- dir=ld
;;
nm)
original=$ORIGINAL_NM_FOR_TARGET
@@ -52,36 +86,65 @@
;;
esac
-case "$original" in
- ../*)
- # compute absolute path of the location of this script
+case x"$original" in
+ x../*)
+ # Compute absolute path to the location of this script.
tdir=`dirname "$0"`
scriptdir=`cd "$tdir" && pwd`
if test -x $scriptdir/../$dir/$prog; then
- test "$fast_install" = yes || exec $scriptdir/../$dir/$prog ${1+"$@"}
+ if test "$fast_install" = yes; then
+ # If libtool did everything it needs to do, there's a fast path.
+ lt_prog=$scriptdir/../$dir/$objdir/lt-$prog
- # if libtool did everything it needs to do, there's a fast path
- lt_prog=$scriptdir/../$dir/$objdir/lt-$prog
- test -x $lt_prog && exec $lt_prog ${1+"$@"}
-
- # libtool has not relinked ld-new yet, but we cannot just use the
- # previous stage (because then the relinking would just never happen!).
- # So we take extra care to use prev-ld/ld-new *on recursive calls*.
- test x"$LT_RCU" = x"1" && exec $scriptdir/../prev-$dir/$prog ${1+"$@"}
-
- LT_RCU=1; export LT_RCU
- $scriptdir/../$dir/$prog ${1+"$@"}
- result=$?
- exit $result
-
+ if test -x $lt_prog; then
+ original=$lt_prog
+ else
+ # Libtool has not relinked ld-new yet, but we cannot just use the
+ # previous stage (because then the relinking would just never happen!).
+ # So we take extra care to use prev-ld/ld-new *on recursive calls*.
+ if test x"$LT_RCU" = x"1"; then
+ original=$scriptdir/../prev-$dir/$prog
+ else
+ LT_RCU=1; export LT_RCU
+ case "${1+$@} " in
+ *-v\ *)
+ echo "$invoked version $version"
+ echo $scriptdir/../$dir/$prog ${1+"$@"}
+ ;;
+ esac
+ $scriptdir/../$dir/$prog ${1+"$@"}
+ result=$?
+ exit $result
+ fi
+ fi
+ else
+ original=$scriptdir/../$dir/$prog
+ fi
else
- exec $scriptdir/../prev-$dir/$prog ${1+"$@"}
+ original=$scriptdir/../prev-$dir/$prog
fi
;;
- *)
- exec "$original" ${1+"$@"}
+ x)
+ echo "$invoked: executable not configured"
+ exit -1
;;
esac
+# If -v has been used then display our version number
+# and then echo the command we are about to invoke.
+case "${1+$@} " in
+ *-v\ *)
+ echo "$invoked version $version"
+ echo $original ${1+"$@"}
+ ;;
+esac
+if test -x $original; then
+ exec "$original" ${1+"$@"}
+else
+ echo "$invoked: unable to locate executable: $original"
+ exit -1
+fi
+
+
Index: gcc/collect2.c
===================================================================
--- gcc/collect2.c (revision 157226)
+++ gcc/collect2.c (working copy)
@@ -1111,6 +1111,7 @@
main (int argc, char **argv)
{
static const char *const ld_suffix = "ld";
+ static const char *const gold_suffix = "gold";
static const char *const plugin_ld_suffix = PLUGIN_LD;
static const char *const real_ld_suffix = "real-ld";
static const char *const collect_ld_suffix = "collect-ld";
@@ -1130,6 +1131,8 @@
const char *const full_ld_suffix =
concat(target_machine, "-", ld_suffix, NULL);
+ const char *const full_gold_suffix =
+ concat (target_machine, "-", gold_suffix, NULL);
const char *const full_plugin_ld_suffix =
concat(target_machine, "-", plugin_ld_suffix, NULL);
const char *const full_nm_suffix =
@@ -1146,6 +1149,7 @@
concat (target_machine, "-", gstrip_suffix, NULL);
#else
const char *const full_ld_suffix = ld_suffix;
+ const char *const full_gold_suffix = gold_suffix;
const char *const full_plugin_ld_suffix = plugin_ld_suffix;
const char *const full_nm_suffix = nm_suffix;
const char *const full_gnm_suffix = gnm_suffix;
@@ -1168,6 +1172,7 @@
char **ld1_argv;
const char **ld1;
bool use_plugin = false;
+ bool use_gold = false;
/* The kinds of symbols we will have to consider when scanning the
outcome of a first pass link. This is ALL to start with, then might
@@ -1256,6 +1261,8 @@
use_verbose = true;
lto_mode = LTO_MODE_NONE;
}
+ else if (! strcmp (argv[i], "-Luse-gold"))
+ use_gold = true;
#ifdef COLLECT_EXPORT_LIST
/* since -brtl, -bexport, -b64 are not position dependent
also check for them here */
@@ -1356,6 +1363,8 @@
ld_file_name = find_a_file (&cpath,
use_plugin
? plugin_ld_suffix
+ : use_gold
+ ? gold_suffix
: ld_suffix);
/* Search the ordinary system bin directories
for `ld' (if native linking) or `TARGET-ld' (if cross). */
@@ -1363,6 +1372,8 @@
ld_file_name = find_a_file (&path,
use_plugin
? full_plugin_ld_suffix
+ : use_gold
+ ? full_gold_suffix
: full_ld_suffix);
#ifdef REAL_NM_FILE_NAME
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-04 19:26 RFA/RFC: Enable both gold and ld in a single toolchain Nick Clifton
@ 2010-03-04 20:47 ` H.J. Lu
2010-03-09 10:09 ` Nick Clifton
2010-03-05 1:05 ` Ralf Wildenhues
` (2 subsequent siblings)
3 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-03-04 20:47 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Thu, Mar 4, 2010 at 11:21 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Guys,
>
> I have created a patch (attached) that enables both GOLD and LD to be
> built and used in a single toolchain. This allows easy comparison of
> the two linkers with just a single command line switch to choose
> between them.
>
> I suspect that the patch may not be approved, but I wanted to
> contribute it in case anyone else was interested in this facility.
>
> In order to build both linkers it is necessary to run the top level
> configure script with the switch:
>
> --enable-gold=both
>
> Then once the linkers are built/installed you can add:
>
> -Luse-gold
>
> to a gcc command line to use the GOLD linker. Otherwise the LD linker
> (aka gld) will be used.
>
> There is one special caveat though. When installing the two linkers
> it is necessary to install gold before ld as otherwise the ld linker
> will be overwritten. Ie run:
>
> make ... install-gold install-ld ...
>
>
> The choice of -Luse-gold as the switch to select the gold linker is a
> hack. One of the requirements for programs and scripts that sit
> between gcc and the linker, (such as collect2 and collect-ld), is that
> gcc must continue to work if they are not there and the linker is
> invoked directly. Thus any options that are intended for the
> intermediate programs/scripts must be disguised in some fashion.
>
> Collect2 uses environment variables to get its options but this is,
> IMHO, heinous. So instead I chose to use the -L switch. This can
> take an arbitrary text argument and it will not cause the linker to
> complain if the argument is not recognised or the so called library
> search path does not actually exist. In theory it could break a link
> if there really is a sub-directory of the current directory called
> "use-gold" and this directory contains subtly invalid binaries, but
> this is very unlikely to happen.
>
> Comments welcome, and if the gcc maintainers feel that this feature is
> actually wanted in the mainstream sources I will happy to apply my
> patch and maintain it in the future.
>
> Tested with i686-pc-linux-gnu, sparc-elf and arm-eabi toolchains, and
> an x86 bootstrap. (That is bootstrapping without gold enabled, just
> to make sure that I did not break anything).
>
> Cheers
> Nick
>
> ./ChangeLog
> 2010-03-04 Nick Clifton <nickc@redhat.com>
>
> * configure.ac (--enable-gold): Accept a value of "both". If
> this value is given then configure both ld and gold.
> * configure: Regenerate.
>
> gcc/ChangeLog
> 2010-03-04 Nick Clifton <nickc@redhat.com>
>
> * configure.ac (gcc_cv_gold_srcdir): New cached variable -
> contains the location of the gold sources.
> (ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
> the name of the locally built gold executable.
> * configure: Regenerate.
> * collect2.c (main): Detect the -Luse-gold switch and select the
> gold linker, if found.
> * exec-tool.in: Detect the -Luse-gold switch and select the gold
> linker, if found. Add support for -v switch. Report problems
> locating linker executable.
>
> gold/ChangeLog
> 2010-03-04 Nick Clifton <nickc@redhat.com>
>
> * Makefile.am (install-exec-local): Also install the executable
> as a binary named 'gold'.
> * Makefile.in: Regenerate.
>
>
Here is another approach to enable both ld and gold:
http://sourceware.org/ml/binutils/2010-01/msg00275.html
It will install both linkers, as ld.bfd and ld.gold, and allow to choose
either ld.bfd or ld.gold as the default linker. Is that possible to
combine your approach with mine?
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-04 19:26 RFA/RFC: Enable both gold and ld in a single toolchain Nick Clifton
2010-03-04 20:47 ` H.J. Lu
@ 2010-03-05 1:05 ` Ralf Wildenhues
[not found] ` <20100304205859.GE22496__42407.8206219294$1267753343$gmane$org@gmx.de>
2010-03-09 17:13 ` Paolo Bonzini
3 siblings, 0 replies; 44+ messages in thread
From: Ralf Wildenhues @ 2010-03-05 1:05 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
Hello Nick,
just curious, what does your patch offer over H.J.'s patch?
A few nits:
* Nick Clifton wrote on Thu, Mar 04, 2010 at 08:21:45PM CET:
> In order to build both linkers it is necessary to run the top level
> configure script with the switch:
>
> --enable-gold=both
>
> Then once the linkers are built/installed you can add:
>
> -Luse-gold
FWIW, I don't consider abusing existing APIs like this to be a good
idea. Collect2 is something GCC controls, so you can adjust it; that
doesn't justify in-band signaling in user APIs if you ask me.
BTW, installation order requirements can (and should IMVHO) be
formalized in the toplevel Makefile.def, so parallel make does not fail.
> --- configure.ac (revision 157226)
> +++ configure.ac (working copy)
> @@ -320,7 +320,7 @@
> [ --enable-gold use gold instead of ld],
> ENABLE_GOLD=$enableval,
> ENABLE_GOLD=no)
> -if test "${ENABLE_GOLD}" = "yes"; then
> +if test "${ENABLE_GOLD}" = "yes" -o "${ENABLE_GOLD}" = "both"; then
test -o is not POSIX, please use test || test instead.
> --- gcc/exec-tool.in (revision 157226)
> +++ gcc/exec-tool.in (working copy)
> @@ -35,15 +37,47 @@
> dir=gas
> ;;
> collect-ld)
> - # when using a linker plugin, gcc will always pass '-plugin' as the
> - # first option to the linker.
> - if test x"$1" = "x-plugin"; then
> - original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
> - else
> - original=$ORIGINAL_LD_FOR_TARGET
> + prog=ld-new$exeext
> + # Look for the magic library paths "-Luse-gold" and
> + # "-Luse-ld". If present then select the indicated
> + # linker. Otherwise if -plugin is specified then
> + # choose a plugin-capable linker, otherwise use the
> + # default.
> + case "${1+$@} " in
${1+$@} is only necessary in places where zero arguments need to be
detected as such, and it is only correct if the quotes are around the $@
alone. In a case statement, plain $* is sufficient (and more portable):
case " $* " in ...
but I would usually prefer iterating over the positional parameters:
for arg
do
case $arg in
-plugin) ...
;;
esac
done
> + *-Luse-gold\ *)
Without leading space, this also matches unrelated arguments that only
happen to end in this string.
> + original=$ORIGINAL_GOLD_FOR_TARGET
> + dir=gold
> + ;;
[...]
> + # If the selected linker has not been configured then
> + # try using the others, in the order PLUGIN-LD, LD, GOLD.
> + if test x"$original" == x; then
test == is a bashism, = is portable.
> @@ -52,36 +86,65 @@
> ;;
> esac
>
> -case "$original" in
> - ../*)
> - # compute absolute path of the location of this script
> +case x"$original" in
Why that x here? The x used in "test" is to avoid leading hyphens
to let old test programs confuse them with options like -f. This is not
needed for case.
> + x../*)
> + # Compute absolute path to the location of this script.
> tdir=`dirname "$0"`
> scriptdir=`cd "$tdir" && pwd`
>
> if test -x $scriptdir/../$dir/$prog; then
> - test "$fast_install" = yes || exec $scriptdir/../$dir/$prog ${1+"$@"}
> + if test "$fast_install" = yes; then
> + # If libtool did everything it needs to do, there's a fast path.
> + lt_prog=$scriptdir/../$dir/$objdir/lt-$prog
>
> - # if libtool did everything it needs to do, there's a fast path
> - lt_prog=$scriptdir/../$dir/$objdir/lt-$prog
> - test -x $lt_prog && exec $lt_prog ${1+"$@"}
> -
> - # libtool has not relinked ld-new yet, but we cannot just use the
> - # previous stage (because then the relinking would just never happen!).
> - # So we take extra care to use prev-ld/ld-new *on recursive calls*.
> - test x"$LT_RCU" = x"1" && exec $scriptdir/../prev-$dir/$prog ${1+"$@"}
> -
> - LT_RCU=1; export LT_RCU
> - $scriptdir/../$dir/$prog ${1+"$@"}
> - result=$?
> - exit $result
> -
> + if test -x $lt_prog; then
> + original=$lt_prog
> + else
> + # Libtool has not relinked ld-new yet, but we cannot just use the
> + # previous stage (because then the relinking would just never happen!).
> + # So we take extra care to use prev-ld/ld-new *on recursive calls*.
> + if test x"$LT_RCU" = x"1"; then
> + original=$scriptdir/../prev-$dir/$prog
> + else
> + LT_RCU=1; export LT_RCU
> + case "${1+$@} " in
> + *-v\ *)
See above.
> + echo "$invoked version $version"
This is not a GCS-compatible version output.
> + echo $scriptdir/../$dir/$prog ${1+"$@"}
> + ;;
> + esac
> + $scriptdir/../$dir/$prog ${1+"$@"}
> + result=$?
> + exit $result
> + fi
> + fi
> + else
> + original=$scriptdir/../$dir/$prog
> + fi
> else
> - exec $scriptdir/../prev-$dir/$prog ${1+"$@"}
> + original=$scriptdir/../prev-$dir/$prog
> fi
> ;;
> - *)
> - exec "$original" ${1+"$@"}
> + x)
> + echo "$invoked: executable not configured"
> + exit -1
I don't know whether -1 is portable for shell exit.
> ;;
> esac
>
> +# If -v has been used then display our version number
> +# and then echo the command we are about to invoke.
> +case "${1+$@} " in
> + *-v\ *)
See above.
> + echo "$invoked version $version"
> + echo $original ${1+"$@"}
> + ;;
> +esac
>
> +if test -x $original; then
> + exec "$original" ${1+"$@"}
> +else
> + echo "$invoked: unable to locate executable: $original"
> + exit -1
> +fi
Cheers,
Ralf
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
[not found] ` <20100304205859.GE22496__42407.8206219294$1267753343$gmane$org@gmx.de>
@ 2010-03-05 10:06 ` Andreas Schwab
0 siblings, 0 replies; 44+ messages in thread
From: Andreas Schwab @ 2010-03-05 10:06 UTC (permalink / raw)
To: Ralf Wildenhues; +Cc: Nick Clifton, gcc-patches, binutils
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
>> @@ -52,36 +86,65 @@
>> ;;
>> esac
>>
>> -case "$original" in
>> - ../*)
>> - # compute absolute path of the location of this script
>> +case x"$original" in
>
> Why that x here? The x used in "test" is to avoid leading hyphens
> to let old test programs confuse them with options like -f. This is not
> needed for case.
And you don't even need the quotes.
>> + x)
>> + echo "$invoked: executable not configured"
>> + exit -1
>
> I don't know whether -1 is portable for shell exit.
POSIX only knows about 0-255 anyway.
Andreas.
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-04 20:47 ` H.J. Lu
@ 2010-03-09 10:09 ` Nick Clifton
2010-03-09 13:54 ` Matthias Klose
2010-03-09 14:10 ` H.J. Lu
0 siblings, 2 replies; 44+ messages in thread
From: Nick Clifton @ 2010-03-09 10:09 UTC (permalink / raw)
To: gcc-patches; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]
Hi Guys,
Thanks very much for the feedback on my original patch. Attached
below is a revised version in which I have tried to take into account
all of the suggestions that were made.
H.J. - I apologise for forgetting that you had already submitted a
patch that does basically the same thing as my patch. I have adopted
most of the ideas from your patch into this revised version, but with a
few changes:
* I named the BFD based linker "gld" rather than "ld.bfd". I thought
that this was more intuitive, and it also matches how the linker is
referred in various bits of documentation.
* I made the --enable-gold=both still have the original linker (gld)
as the default rather than gold. My reasoning here was that if a
toolchain builder wants to have both linkers then they are going to want
to compare them and they would expect to start with the already
established linker, rather than the new one. Configuring with
--enable-gold=both/gold will make gold the default linker.
Other changes in this version of the patch include:
* I have added a dependency to Makefile.def so that gold will be
installed before ld if both exist in the build tree.
* "test ... -o ..." has been replaced by "test ... || test ..." and
"test ... == ..." by "test ... = ...".
* I am still matching command line switches using regular
expressions, since I think that it is neater, but the testing should be
more efficient now and less prone to false positives.
* I have removed the x prefix when checking the original linker path.
* The output from the --version option now conforms to the GCD.
* I use "exit 1" as an error return rather than "exit -1".
Apart from that the patch is the same as before. I have retested it
with a full bootstrap and it still is OK.
So - (finger's crossed) - is the patch OK to apply ?
Cheers
Nick
[-- Attachment #2: gold-and-ld.patch.2 --]
[-- Type: application/x-troff-man, Size: 43108 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-09 10:09 ` Nick Clifton
@ 2010-03-09 13:54 ` Matthias Klose
2010-03-11 7:41 ` Ryan Hill
2010-03-09 14:10 ` H.J. Lu
1 sibling, 1 reply; 44+ messages in thread
From: Matthias Klose @ 2010-03-09 13:54 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On 09.03.2010 10:28, Nick Clifton wrote:
> Hi Guys,
>
> Thanks very much for the feedback on my original patch. Attached below
> is a revised version in which I have tried to take into account all of
> the suggestions that were made.
>
> H.J. - I apologise for forgetting that you had already submitted a patch
> that does basically the same thing as my patch. I have adopted most of
> the ideas from your patch into this revised version, but with a few
> changes:
>
> * I named the BFD based linker "gld" rather than "ld.bfd". I thought
> that this was more intuitive, and it also matches how the linker is
> referred in various bits of documentation.
please don't. the gld name is already used in the binary namespace (although
it's in /usr/sbin).
http://packages.debian.org/search?searchon=contents&keywords=gld&mode=path&suite=unstable&arch=any
Not sure how many distributions already did use H.J's patch, but at least Debian
and Ubuntu will keep these names from this patch for the next release.
Matthias
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-09 10:09 ` Nick Clifton
2010-03-09 13:54 ` Matthias Klose
@ 2010-03-09 14:10 ` H.J. Lu
2010-03-09 15:08 ` Richard Guenther
1 sibling, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-03-09 14:10 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Tue, Mar 9, 2010 at 1:28 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Guys,
>
> Thanks very much for the feedback on my original patch. Attached below is
> a revised version in which I have tried to take into account all of the
> suggestions that were made.
>
> H.J. - I apologise for forgetting that you had already submitted a patch
> that does basically the same thing as my patch. I have adopted most of the
> ideas from your patch into this revised version, but with a few changes:
>
I really don't like "-Luse-gold"/"-Luse-ld". It is asking for trouble. What if
I have a library called `libuse-gold.so"? Why can't we add a real new
option? Also gold may be installed as `ld'. How about -muse-gold/use-gld
or -muse-ld.gold/-muse-ld.bfd?
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-09 14:10 ` H.J. Lu
@ 2010-03-09 15:08 ` Richard Guenther
0 siblings, 0 replies; 44+ messages in thread
From: Richard Guenther @ 2010-03-09 15:08 UTC (permalink / raw)
To: H.J. Lu; +Cc: Nick Clifton, gcc-patches, binutils
On Tue, Mar 9, 2010 at 3:00 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Mar 9, 2010 at 1:28 AM, Nick Clifton <nickc@redhat.com> wrote:
>> Hi Guys,
>>
>> Thanks very much for the feedback on my original patch. Attached below is
>> a revised version in which I have tried to take into account all of the
>> suggestions that were made.
>>
>> H.J. - I apologise for forgetting that you had already submitted a patch
>> that does basically the same thing as my patch. I have adopted most of the
>> ideas from your patch into this revised version, but with a few changes:
>>
>
> I really don't like "-Luse-gold"/"-Luse-ld". It is asking for trouble. What if
> I have a library called `libuse-gold.so"? Why can't we add a real new
> option? Also gold may be installed as `ld'. How about -muse-gold/use-gld
> or -muse-ld.gold/-muse-ld.bfd?
-fuse-linker-plugin and --with-plugin-ld works just fine for me.
Richard.
>
> --
> H.J.
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-04 19:26 RFA/RFC: Enable both gold and ld in a single toolchain Nick Clifton
` (2 preceding siblings ...)
[not found] ` <20100304205859.GE22496__42407.8206219294$1267753343$gmane$org@gmx.de>
@ 2010-03-09 17:13 ` Paolo Bonzini
3 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2010-03-09 17:13 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On 03/04/2010 08:21 PM, Nick Clifton wrote:
> When installing the two linkers
> it is necessary to install gold before ld as otherwise the ld linker
> will be overwritten. Ie run:
>
> make ... install-gold install-ld ...
Adding this to Makefile.def:
dependencies = { module=install-ld; on=install-gold; };
should make it (dependencies are not "hard" by default).
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-09 13:54 ` Matthias Klose
@ 2010-03-11 7:41 ` Ryan Hill
2010-03-11 14:53 ` Nick Clifton
0 siblings, 1 reply; 44+ messages in thread
From: Ryan Hill @ 2010-03-11 7:41 UTC (permalink / raw)
To: gcc-patches; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On Tue, 09 Mar 2010 11:09:07 +0100
Matthias Klose <doko@ubuntu.com> wrote:
> Not sure how many distributions already did use H.J's patch, but at least Debian
> and Ubuntu will keep these names from this patch for the next release.
We do and we've changed our build system 3 times now because every second
release renamed everything. It'd be nice to settle on something soon.
--
fonts, by design, by neglect
gcc-porting, for a fact or just for effect
wxwidgets @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-11 7:41 ` Ryan Hill
@ 2010-03-11 14:53 ` Nick Clifton
2010-03-11 15:07 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: Nick Clifton @ 2010-03-11 14:53 UTC (permalink / raw)
To: gcc-patches; +Cc: binutils
[-- Attachment #1: Type: text/plain, Size: 2307 bytes --]
Hi Guys,
OK - I have revised the patch yet again. This version uses H.J.'s
name for the bfd based linker (ld.bfd) and changes the switches that
selects between gold and ld.bfd to be -fuse-gold and -fuse-ld (or
-fuse-ld.bfd).
x86 bootstrapping is still OK.
Any more suggestions or comments ?
Cheers
Nick
./ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.ac (--enable-gold): Accept a parameter of "both",
"both/gold" or "both/ld". If any of these values are given
then configure both ld and gold.
* configure: Regenerate.
gcc/ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.ac (gcc_cv_gold_srcdir): New cached variable -
contains the location of the gold sources.
(ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
the name of the locally built gold executable.
* configure: Regenerate.
* collect2.c (main): Detect the -use-gold and -use-ld switches
and select the appropriate linker, if found.
* exec-tool.in: Detect the -use-gold and -use-ld switches and
select the appropriate linker, if found.
Add support for -v switch.
Report problems locating linker executable.
* gcc.c (LINK_COMMAND_SPEC): Translate -fuse-gold into
-use-gold and -fuse-ld into -use-ld.
* common.opt: Add fuse-gold, fuse-ld and fuse-ld.bfd
* opts.c (comman_handle_option): Ignore -fuse-gold, -fuse-ld
and -fuse-ld.bfd.
* doc/invoke.texi: Document the new options.
gold/ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
unless --enable-gold or --enable-gold=both/gold has been
specified.
* configure: Regenerate.
* Makefile.am (install-exec-local): Install the executable as
"gold". If install_as_default is true then also install it as
"ld".
* Makefile.in: Regenerate.
ld/ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
unless --enable-gold=both/gold has been specified.
* configure: Regenerate.
* Makefile.am (transform): Use ld.bfd as the default name of
the linker.
(install-exec-local): Also install the executable as a binary
named 'ld' if install_as_default is true.
* Makefile.in: Regenerate.
[-- Attachment #2: gold-and-ld.patch.3 --]
[-- Type: application/x-troff-man, Size: 24512 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-11 14:53 ` Nick Clifton
@ 2010-03-11 15:07 ` H.J. Lu
2010-03-16 17:34 ` Nick Clifton
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-03-11 15:07 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Thu, Mar 11, 2010 at 6:45 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Guys,
>
> OK - I have revised the patch yet again. This version uses H.J.'s name for
> the bfd based linker (ld.bfd) and changes the switches that selects between
> gold and ld.bfd to be -fuse-gold and -fuse-ld (or -fuse-ld.bfd).
-fuse-ld is misleading. ld may be gold. How about "-fuse-ld=[gold|bfd]" which
is consistent with linker names and configure options.
H.J.
---
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-11 15:07 ` H.J. Lu
@ 2010-03-16 17:34 ` Nick Clifton
2010-03-16 17:49 ` H.J. Lu
` (4 more replies)
0 siblings, 5 replies; 44+ messages in thread
From: Nick Clifton @ 2010-03-16 17:34 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches, binutils
[-- Attachment #1: Type: text/plain, Size: 2410 bytes --]
Hi H.J.
> -fuse-ld is misleading. ld may be gold. How about "-fuse-ld=[gold|bfd]" which
> is consistent with linker names and configure options.
A good point. I have attached a revised patch with the option named as
you suggest. I also omitted to include your name and Roland's in the
ChangeLog entries, so I have updated those as well.
Any other issues with the patch ?
Cheers
Nick
./ChangeLog
2010-01-05 Roland McGrath <roland@redhat.com>
H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (--enable-gold): Support both, both/gold and
both/bfd to add gold to configdirs without removing ld.
* configure: Regenerated.
gold/ChangeLog
2010-01-05 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
unless --enable-gold or --enable-gold=both/gold has been
specified.
* configure: Regenerate.
* Makefile.am (install-exec-local): Install the executable as
"gold". If install_as_default is true then also install it as
"ld".
* Makefile.in: Regenerated.
ld/ChangeLog
2010-01-05 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
unless --enable-gold=both/gold has been specified.
* configure: Regenerate.
* Makefile.am (transform): Use ld.bfd as the default name of
the linker.
(install-exec-local): Also install the executable as a binary
named 'ld' if install_as_default is true.
* Makefile.in: Regenerate.
gcc/ChangeLog
2010-03-04 Nick Clifton <nickc@redhat.com>
* configure.ac (gcc_cv_gold_srcdir): New cached variable -
contains the location of the gold sources.
(ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
the name of the locally built gold executable.
* configure: Regenerate.
* collect2.c (main): Detect the -use-gold and -use-ld switches
and select the appropriate linker, if found.
* exec-tool.in: Detect the -use-gold and -use-ld switches and
select the appropriate linker, if found.
Add support for -v switch.
Report problems locating linker executable.
* gcc.c (LINK_COMMAND_SPEC): Translate -fuse-ld=gold into
-use-gold and -fuse-ld=bfd into -use-ld.
* common.opt: Add fuse-ld=gold and fuse-ld=bfd.
* opts.c (comman_handle_option): Ignore -fuse-ld=gold and
-fuse-ld=bfd.
* doc/invoke.texi: Document the new options.
[-- Attachment #2: gold-and-ld.patch.4 --]
[-- Type: application/x-troff-man, Size: 26834 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:34 ` Nick Clifton
@ 2010-03-16 17:49 ` H.J. Lu
2010-03-16 17:56 ` Nick Clifton
2010-03-17 16:27 ` H.J. Lu
` (3 subsequent siblings)
4 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-03-16 17:49 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Tue, Mar 16, 2010 at 10:25 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H.J.
>
>> -fuse-ld is misleading. ld may be gold. How about "-fuse-ld=[gold|bfd]"
>> which
>> is consistent with linker names and configure options.
>
> A good point. I have attached a revised patch with the option named as you
> suggest. I also omitted to include your name and Roland's in the ChangeLog
> entries, so I have updated those as well.
>
> Any other issues with the patch ?
>
> Cheers
> Nick
>
> ./ChangeLog
> 2010-01-05 Roland McGrath <roland@redhat.com>
> H.J. Lu <hongjiu.lu@intel.com>
>
> * configure.ac (--enable-gold): Support both, both/gold and
> both/bfd to add gold to configdirs without removing ld.
> * configure: Regenerated.
>
> gold/ChangeLog
> 2010-01-05 H.J. Lu <hongjiu.lu@intel.com>
> Nick Clifton <nickc@redhat.com>
>
> * configure.ac (install_as_default): Define and set to false
> unless --enable-gold or --enable-gold=both/gold has been
> specified.
> * configure: Regenerate.
> * Makefile.am (install-exec-local): Install the executable as
> "gold". If install_as_default is true then also install it as
> "ld".
> * Makefile.in: Regenerated.
>
> ld/ChangeLog
> 2010-01-05 H.J. Lu <hongjiu.lu@intel.com>
> Nick Clifton <nickc@redhat.com>
>
> * configure.in (install_as_default): Define and set to true
> unless --enable-gold=both/gold has been specified.
> * configure: Regenerate.
> * Makefile.am (transform): Use ld.bfd as the default name of
> the linker.
> (install-exec-local): Also install the executable as a binary
> named 'ld' if install_as_default is true.
> * Makefile.in: Regenerate.
>
> gcc/ChangeLog
> 2010-03-04 Nick Clifton <nickc@redhat.com>
>
> * configure.ac (gcc_cv_gold_srcdir): New cached variable -
> contains the location of the gold sources.
> (ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
> the name of the locally built gold executable.
> * configure: Regenerate.
> * collect2.c (main): Detect the -use-gold and -use-ld switches
> and select the appropriate linker, if found.
> * exec-tool.in: Detect the -use-gold and -use-ld switches and
> select the appropriate linker, if found.
> Add support for -v switch.
> Report problems locating linker executable.
> * gcc.c (LINK_COMMAND_SPEC): Translate -fuse-ld=gold into
> -use-gold and -fuse-ld=bfd into -use-ld.
> * common.opt: Add fuse-ld=gold and fuse-ld=bfd.
> * opts.c (comman_handle_option): Ignore -fuse-ld=gold and
> -fuse-ld=bfd.
> * doc/invoke.texi: Document the new options.
>
Is that possible to pass -fuse-ld=XXX directly collect2 so that you
don't need to change exec-tool.in?
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:49 ` H.J. Lu
@ 2010-03-16 17:56 ` Nick Clifton
2010-03-16 17:59 ` H.J. Lu
2010-03-16 18:40 ` Vladimir Simonov
0 siblings, 2 replies; 44+ messages in thread
From: Nick Clifton @ 2010-03-16 17:56 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches, binutils
Hi H.J.
> Is that possible to pass -fuse-ld=XXX directly to collect2
Sure, but ...
> so that you don't need to change exec-tool.in?
exec-tool will still need to be updated. It is still invoked (as
"collect-ld") and it still needs to be able to understand the
-use-gold/-use-ld options.
Cheers
Nick
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:56 ` Nick Clifton
@ 2010-03-16 17:59 ` H.J. Lu
2010-03-17 8:55 ` Nick Clifton
2010-03-16 18:40 ` Vladimir Simonov
1 sibling, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-03-16 17:59 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Tue, Mar 16, 2010 at 10:49 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H.J.
>
>> Is that possible to pass -fuse-ld=XXX directly to collect2
>
> Sure, but ...
>
>> so that you don't need to change exec-tool.in?
>
> exec-tool will still need to be updated. It is still invoked (as
> "collect-ld") and it still needs to be able to understand the
> -use-gold/-use-ld options.
>
Aren't they passed to collect2 directly with "${1+"$@"}"?
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:56 ` Nick Clifton
2010-03-16 17:59 ` H.J. Lu
@ 2010-03-16 18:40 ` Vladimir Simonov
2010-03-17 8:37 ` Nick Clifton
2010-03-18 3:13 ` Ian Lance Taylor
1 sibling, 2 replies; 44+ messages in thread
From: Vladimir Simonov @ 2010-03-16 18:40 UTC (permalink / raw)
To: Nick Clifton; +Cc: H.J. Lu, gcc-patches, binutils
On 03/16/2010 08:49 PM, Nick Clifton wrote:
> Hi H.J.
>
>> Is that possible to pass -fuse-ld=XXX directly to collect2
>
> Sure, but ...
>
>> so that you don't need to change exec-tool.in?
>
> exec-tool will still need to be updated. It is still invoked (as
> "collect-ld") and it still needs to be able to understand the
> -use-gold/-use-ld options.
>
> Cheers
> Nick
>
>
>
>
Hi all,
One, may be stupid, question.
As I understand gcc checks linker properties in configure scripts
to adjust code-generation. You are suggesting to build a toolchain
with 2 linkers(bfd/gold). So question, which linker will be used
in gcc configure? What if another linker has other properties?
In the last case generated code will not correspond used linker.
Simple grep of crosstools build log shows the following:
checking dynamic linker characteristics... GNU/Linux ld.so
checking if the linker
(/home/sv/work/build_root/x86_64-gcc-4.4.3-glibc-2.3.2-0.43/build/build-gcc/./gcc/collect-ld
-m elf_x86_64) is GNU ld... yes
checking linker --as-needed support... yes
checking linker -Bstatic/-Bdynamic option... yes
checking linker EH-compatible garbage collection of sections... yes
checking linker for .hidden support... yes
checking linker position independent executable support... yes
checking linker PT_GNU_EH_FRAME support... yes
checking linker read-only and read-write section mixing... read-write
checking linker --sysroot support... yes
Are gold and bfd linkers similar in above aspects?
It was very simple grep, what if other linker properties
affects gcc code?
Thanks in advance
Vladimir Simonov
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 18:40 ` Vladimir Simonov
@ 2010-03-17 8:37 ` Nick Clifton
2010-03-17 8:58 ` Steven Bosscher
2010-03-17 13:24 ` Vladimir Simonov
2010-03-18 3:13 ` Ian Lance Taylor
1 sibling, 2 replies; 44+ messages in thread
From: Nick Clifton @ 2010-03-17 8:37 UTC (permalink / raw)
To: Vladimir Simonov; +Cc: H.J. Lu, gcc-patches, binutils
Hi Vladimir,
> One, may be stupid, question.
Not stupid at - it is perfectly reasonable.
> As I understand gcc checks linker properties in configure scripts
> to adjust code-generation.
Correct.
> You are suggesting to build a toolchain
> with 2 linkers(bfd/gold).
Yes.
> So question, which linker will be used in gcc configure?
The bfd linker, if configuring gcc in a combined source tree along with
the binutils, otherwise the linker found in the system's search path.
This is actually a bug which I had not considered, albeit a minor one.
Even if the use configures with --enable-gold or --enable-gold=both/gold
then the gold sources will *not* be the ones examined for the capability
tests performed by gcc's configure scripts. This should not matter
though, because of ...
> What if another linker has other properties?
That would be bad.
> Are gold and bfd linkers similar in above aspects?
... Yes. In fact this is one of the main design goals of gold - to be
able to act as a drop in replacement for ld with all the same features
and capabilities.
One of the reasons that I created this patch in the first place was that
I wanted toolchain builders to be able to experiment with the new linker
(gold) whilst retaining the ability to use the known-good linker (ld.bfd).
Cheers
Nick
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:59 ` H.J. Lu
@ 2010-03-17 8:55 ` Nick Clifton
2010-03-17 13:54 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: Nick Clifton @ 2010-03-17 8:55 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches, binutils
Hi H.J.
>> exec-tool will still need to be updated. It is still invoked (as
>> "collect-ld") and it still needs to be able to understand the
>> -use-gold/-use-ld options.
> Aren't they passed to collect2 directly with "${1+"$@"}"?
No it works the other way around:
gcc invokes collect2.
collect2 invokes collect-ld. (In a built but not installed toolchain)
collect-ld invokes ld-new.
Thus the decision as to which linker executable to use is made by the
collect-ld script, not the collect2 binary.
In the case of installed toolchain the sequence is different. Here gcc
invokes collect2 which then invokes the linker directly. Hence collect2
must also know about the -use-gold -use-ld switches.
Cheers
Nick
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-17 8:37 ` Nick Clifton
@ 2010-03-17 8:58 ` Steven Bosscher
2010-03-17 13:24 ` Vladimir Simonov
1 sibling, 0 replies; 44+ messages in thread
From: Steven Bosscher @ 2010-03-17 8:58 UTC (permalink / raw)
To: Nick Clifton; +Cc: Vladimir Simonov, H.J. Lu, gcc-patches, binutils
On Wed, Mar 17, 2010 at 8:57 AM, Nick Clifton <nickc@redhat.com> wrote:
>> So question, which linker will be used in gcc configure?
>
> The bfd linker, if configuring gcc in a combined source tree along with the
> binutils, otherwise the linker found in the system's search path.
Does a build with -whopr and the linker plugin still work, then? (I
mean, it doesn't work for me at the moment, but for those with Really
Big Iron to play with...)
Ciao!
Steven
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-17 8:37 ` Nick Clifton
2010-03-17 8:58 ` Steven Bosscher
@ 2010-03-17 13:24 ` Vladimir Simonov
1 sibling, 0 replies; 44+ messages in thread
From: Vladimir Simonov @ 2010-03-17 13:24 UTC (permalink / raw)
To: Nick Clifton; +Cc: H.J. Lu, gcc-patches, binutils
On 03/17/2010 10:57 AM, Nick Clifton wrote:
> Hi Vladimir,
>
>> One, may be stupid, question.
>
> Not stupid at - it is perfectly reasonable.
>
>> As I understand gcc checks linker properties in configure scripts
>> to adjust code-generation.
>
> Correct.
>
>> You are suggesting to build a toolchain
>> with 2 linkers(bfd/gold).
>
> Yes.
>
>> So question, which linker will be used in gcc configure?
>
> The bfd linker, if configuring gcc in a combined source tree along with
> the binutils, otherwise the linker found in the system's search path.
>
> This is actually a bug which I had not considered, albeit a minor one.
> Even if the use configures with --enable-gold or --enable-gold=both/gold
> then the gold sources will *not* be the ones examined for the capability
> tests performed by gcc's configure scripts. This should not matter
> though, because of ...
>
>> What if another linker has other properties?
>
> That would be bad.
>
>> Are gold and bfd linkers similar in above aspects?
>
> ... Yes. In fact this is one of the main design goals of gold - to be
> able to act as a drop in replacement for ld with all the same features
> and capabilities.
>
> One of the reasons that I created this patch in the first place was that
> I wanted toolchain builders to be able to experiment with the new linker
> (gold) whilst retaining the ability to use the known-good linker (ld.bfd).
>
>
> Cheers
> Nick
>
>
Hi Nick,
Thank you for your response.
Best regards
Vladimir
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-17 8:55 ` Nick Clifton
@ 2010-03-17 13:54 ` H.J. Lu
0 siblings, 0 replies; 44+ messages in thread
From: H.J. Lu @ 2010-03-17 13:54 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Wed, Mar 17, 2010 at 12:00 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H.J.
>
>>> exec-tool will still need to be updated. It is still invoked (as
>>> "collect-ld") and it still needs to be able to understand the
>>> -use-gold/-use-ld options.
>
>> Aren't they passed to collect2 directly with "${1+"$@"}"?
>
> No it works the other way around:
>
> gcc invokes collect2.
> collect2 invokes collect-ld. (In a built but not installed toolchain)
> collect-ld invokes ld-new.
>
> Thus the decision as to which linker executable to use is made by the
> collect-ld script, not the collect2 binary.
>
> In the case of installed toolchain the sequence is different. Here gcc
> invokes collect2 which then invokes the linker directly. Hence collect2
> must also know about the -use-gold -use-ld switches.
>
I see. Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:34 ` Nick Clifton
2010-03-16 17:49 ` H.J. Lu
@ 2010-03-17 16:27 ` H.J. Lu
2010-03-21 15:09 ` Matthias Klose
` (2 subsequent siblings)
4 siblings, 0 replies; 44+ messages in thread
From: H.J. Lu @ 2010-03-17 16:27 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils
On Tue, Mar 16, 2010 at 10:25 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H.J.
>
>> -fuse-ld is misleading. ld may be gold. How about "-fuse-ld=[gold|bfd]"
>> which
>> is consistent with linker names and configure options.
>
> A good point. I have attached a revised patch with the option named as you
> suggest. I also omitted to include your name and Roland's in the ChangeLog
> entries, so I have updated those as well.
>
> Any other issues with the patch ?
>
> Cheers
> Nick
>
> ./ChangeLog
> 2010-01-05 Roland McGrath <roland@redhat.com>
> H.J. Lu <hongjiu.lu@intel.com>
>
> * configure.ac (--enable-gold): Support both, both/gold and
> both/bfd to add gold to configdirs without removing ld.
> * configure: Regenerated.
>
> gold/ChangeLog
> 2010-01-05 H.J. Lu <hongjiu.lu@intel.com>
> Nick Clifton <nickc@redhat.com>
>
> * configure.ac (install_as_default): Define and set to false
> unless --enable-gold or --enable-gold=both/gold has been
> specified.
> * configure: Regenerate.
> * Makefile.am (install-exec-local): Install the executable as
> "gold". If install_as_default is true then also install it as
> "ld".
> * Makefile.in: Regenerated.
>
> ld/ChangeLog
> 2010-01-05 H.J. Lu <hongjiu.lu@intel.com>
> Nick Clifton <nickc@redhat.com>
>
> * configure.in (install_as_default): Define and set to true
> unless --enable-gold=both/gold has been specified.
> * configure: Regenerate.
> * Makefile.am (transform): Use ld.bfd as the default name of
> the linker.
> (install-exec-local): Also install the executable as a binary
> named 'ld' if install_as_default is true.
> * Makefile.in: Regenerate.
>
> gcc/ChangeLog
> 2010-03-04 Nick Clifton <nickc@redhat.com>
>
> * configure.ac (gcc_cv_gold_srcdir): New cached variable -
> contains the location of the gold sources.
> (ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
> the name of the locally built gold executable.
> * configure: Regenerate.
> * collect2.c (main): Detect the -use-gold and -use-ld switches
> and select the appropriate linker, if found.
> * exec-tool.in: Detect the -use-gold and -use-ld switches and
> select the appropriate linker, if found.
> Add support for -v switch.
> Report problems locating linker executable.
> * gcc.c (LINK_COMMAND_SPEC): Translate -fuse-ld=gold into
> -use-gold and -fuse-ld=bfd into -use-ld.
> * common.opt: Add fuse-ld=gold and fuse-ld=bfd.
> * opts.c (comman_handle_option): Ignore -fuse-ld=gold and
> -fuse-ld=bfd.
> * doc/invoke.texi: Document the new options.
>
Now we install
-rwxr-xr-x 2 hjl hjl 34711895 2010-03-17 08:55 release/usr/local/bin/gold
-rwxr-xr-x 2 hjl hjl 34711895 2010-03-17 08:55 release/usr/local/bin/ld
-rwxr-xr-x 1 hjl hjl 5115418 2010-03-17 08:55 release/usr/local/bin/ld.bfd
But gold was never installed before. I would prefer we install ld.gold
instead of gold. It is also consistent with ld.bfd.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 18:40 ` Vladimir Simonov
2010-03-17 8:37 ` Nick Clifton
@ 2010-03-18 3:13 ` Ian Lance Taylor
1 sibling, 0 replies; 44+ messages in thread
From: Ian Lance Taylor @ 2010-03-18 3:13 UTC (permalink / raw)
To: Vladimir Simonov; +Cc: Nick Clifton, H.J. Lu, gcc-patches, binutils
Vladimir Simonov <sv@sw.ru> writes:
> As I understand gcc checks linker properties in configure scripts
> to adjust code-generation. You are suggesting to build a toolchain
> with 2 linkers(bfd/gold). So question, which linker will be used
> in gcc configure? What if another linker has other properties?
> In the last case generated code will not correspond used linker.
>
> Simple grep of crosstools build log shows the following:
> checking dynamic linker characteristics... GNU/Linux ld.so
> checking if the linker
> (/home/sv/work/build_root/x86_64-gcc-4.4.3-glibc-2.3.2-0.43/build/build-gcc/./gcc/collect-ld
> -m elf_x86_64) is GNU ld... yes
> checking linker --as-needed support... yes
> checking linker -Bstatic/-Bdynamic option... yes
> checking linker EH-compatible garbage collection of sections... yes
> checking linker for .hidden support... yes
> checking linker position independent executable support... yes
> checking linker PT_GNU_EH_FRAME support... yes
> checking linker read-only and read-write section mixing... read-write
> checking linker --sysroot support... yes
>
> Are gold and bfd linkers similar in above aspects?
> It was very simple grep, what if other linker properties
> affects gcc code?
It's not a stupid question. At the moment current versions of both
gold and GNU ld satisfy all the things which the gcc configure script
tests. However, clearly in the future this could change. I guess
that full correctness would require testing the features of both gold
and GNU ld if support for both is requested at configure time. The
gcc configure script would then record that a feature was supported
only if both linkers supported it.
Ian
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:34 ` Nick Clifton
2010-03-16 17:49 ` H.J. Lu
2010-03-17 16:27 ` H.J. Lu
@ 2010-03-21 15:09 ` Matthias Klose
2010-03-22 1:14 ` Matthias Klose
2010-03-31 15:31 ` Daniel Jacobowitz
4 siblings, 0 replies; 44+ messages in thread
From: Matthias Klose @ 2010-03-21 15:09 UTC (permalink / raw)
To: Nick Clifton; +Cc: H.J. Lu, gcc-patches, binutils
On 16.03.2010 18:25, Nick Clifton wrote:
> Hi H.J.
>
>> -fuse-ld is misleading. ld may be gold. How about
>> "-fuse-ld=[gold|bfd]" which
>> is consistent with linker names and configure options.
>
> A good point. I have attached a revised patch with the option named as
> you suggest. I also omitted to include your name and Roland's in the
> ChangeLog entries, so I have updated those as well.
>
> Any other issues with the patch ?
trying to use -fuse-ld=gold without having gold installed, prints:
$ gcc -fuse-ld=gold main.c
collect2: cannot find 'ld'
which may be misleading, only with -Wl,-debug collect2 is able to print the
better diagnostic message. Maybe not worth for delaying the patch.
Matthias
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:34 ` Nick Clifton
` (2 preceding siblings ...)
2010-03-21 15:09 ` Matthias Klose
@ 2010-03-22 1:14 ` Matthias Klose
2010-03-31 15:31 ` Daniel Jacobowitz
4 siblings, 0 replies; 44+ messages in thread
From: Matthias Klose @ 2010-03-22 1:14 UTC (permalink / raw)
To: Nick Clifton; +Cc: H.J. Lu, gcc-patches, binutils
[-- Attachment #1: Type: text/plain, Size: 548 bytes --]
On 16.03.2010 18:25, Nick Clifton wrote:
> Hi H.J.
>
>> -fuse-ld is misleading. ld may be gold. How about
>> "-fuse-ld=[gold|bfd]" which
>> is consistent with linker names and configure options.
>
> A good point. I have attached a revised patch with the option named as
> you suggest. I also omitted to include your name and Roland's in the
> ChangeLog entries, so I have updated those as well.
>
> Any other issues with the patch ?
collect2 will fail to build, when the build is configured --with-ld= and
DEFAULT_LINKER is defined.
Matthias
[-- Attachment #2: collect2.diff --]
[-- Type: text/plain, Size: 8351 bytes --]
Index: gcc/collect2.c
===================================================================
--- gcc/collect2.c (revision 157602)
+++ gcc/collect2.c (working copy)
@@ -1110,17 +1110,19 @@
int
main (int argc, char **argv)
{
- static const char *const ld_suffix = "ld";
- static const char *const plugin_ld_suffix = PLUGIN_LD;
- static const char *const real_ld_suffix = "real-ld";
+ static const char *const ld_suffix = "ld";
+ static const char *const gold_suffix = "gold";
+ static const char *const bfd_ld_suffix = "ld.bfd";
+ static const char *const plugin_ld_suffix = PLUGIN_LD;
+ static const char *const real_ld_suffix = "real-ld";
static const char *const collect_ld_suffix = "collect-ld";
- static const char *const nm_suffix = "nm";
- static const char *const gnm_suffix = "gnm";
+ static const char *const nm_suffix = "nm";
+ static const char *const gnm_suffix = "gnm";
#ifdef LDD_SUFFIX
- static const char *const ldd_suffix = LDD_SUFFIX;
+ static const char *const ldd_suffix = LDD_SUFFIX;
#endif
- static const char *const strip_suffix = "strip";
- static const char *const gstrip_suffix = "gstrip";
+ static const char *const strip_suffix = "strip";
+ static const char *const gstrip_suffix = "gstrip";
#ifdef CROSS_DIRECTORY_STRUCTURE
/* If we look for a program in the compiler directories, we just use
@@ -1130,6 +1132,10 @@
const char *const full_ld_suffix =
concat(target_machine, "-", ld_suffix, NULL);
+ const char *const full_gold_suffix =
+ concat (target_machine, "-", gold_suffix, NULL);
+ const char *const full_bfd_ld_suffix =
+ concat (target_machine, "-", bfd_ld_suffix, NULL);
const char *const full_plugin_ld_suffix =
concat(target_machine, "-", plugin_ld_suffix, NULL);
const char *const full_nm_suffix =
@@ -1145,15 +1151,17 @@
const char *const full_gstrip_suffix =
concat (target_machine, "-", gstrip_suffix, NULL);
#else
- const char *const full_ld_suffix = ld_suffix;
+ const char *const full_ld_suffix = ld_suffix;
+ const char *const full_gold_suffix = gold_suffix;
+ const char *const full_bfd_ld_suffix = bfd_ld_suffix;
const char *const full_plugin_ld_suffix = plugin_ld_suffix;
- const char *const full_nm_suffix = nm_suffix;
- const char *const full_gnm_suffix = gnm_suffix;
+ const char *const full_nm_suffix = nm_suffix;
+ const char *const full_gnm_suffix = gnm_suffix;
#ifdef LDD_SUFFIX
- const char *const full_ldd_suffix = ldd_suffix;
+ const char *const full_ldd_suffix = ldd_suffix;
#endif
- const char *const full_strip_suffix = strip_suffix;
- const char *const full_gstrip_suffix = gstrip_suffix;
+ const char *const full_strip_suffix = strip_suffix;
+ const char *const full_gstrip_suffix = gstrip_suffix;
#endif /* CROSS_DIRECTORY_STRUCTURE */
const char *arg;
@@ -1167,7 +1175,13 @@
const char **c_ptr;
char **ld1_argv;
const char **ld1;
- bool use_plugin = false;
+ enum linker_select
+ {
+ DFLT_LINKER,
+ PLUGIN_LINKER,
+ GOLD_LINKER,
+ BFD_LINKER
+ } selected_linker = DFLT_LINKER;
/* The kinds of symbols we will have to consider when scanning the
outcome of a first pass link. This is ALL to start with, then might
@@ -1184,7 +1198,6 @@
int first_file;
int num_c_args;
char **old_argv;
-
bool use_verbose = false;
old_argv = argv;
@@ -1240,22 +1253,29 @@
{
if (! strcmp (argv[i], "-debug"))
debug = 1;
- else if (! strcmp (argv[i], "-flto") && ! use_plugin)
+ else if (! strcmp (argv[i], "-flto")
+ && selected_linker != PLUGIN_LINKER)
{
use_verbose = true;
lto_mode = LTO_MODE_LTO;
}
- else if (! strcmp (argv[i], "-fwhopr") && ! use_plugin)
+ else if (! strcmp (argv[i], "-fwhopr")
+ && selected_linker != PLUGIN_LINKER)
{
use_verbose = true;
lto_mode = LTO_MODE_WHOPR;
}
else if (! strcmp (argv[i], "-plugin"))
{
- use_plugin = true;
+ selected_linker = PLUGIN_LINKER;
use_verbose = true;
lto_mode = LTO_MODE_NONE;
}
+ else if (! strcmp (argv[i], "-use-gold"))
+ selected_linker = GOLD_LINKER;
+ else if (! strcmp (argv[i], "-use-ld"))
+ selected_linker = BFD_LINKER;
+
#ifdef COLLECT_EXPORT_LIST
/* since -brtl, -bexport, -b64 are not position dependent
also check for them here */
@@ -1335,36 +1355,109 @@
/* Try to discover a valid linker/nm/strip to use. */
/* Maybe we know the right file to use (if not cross). */
- ld_file_name = 0;
+ ld_file_name = NULL;
#ifdef DEFAULT_LINKER
if (access (DEFAULT_LINKER, X_OK) == 0)
ld_file_name = DEFAULT_LINKER;
- if (ld_file_name == 0)
+ if (ld_file_name == NULL)
#endif
#ifdef REAL_LD_FILE_NAME
ld_file_name = find_a_file (&path, REAL_LD_FILE_NAME);
- if (ld_file_name == 0)
+ if (ld_file_name == NULL)
#endif
/* Search the (target-specific) compiler dirs for ld'. */
ld_file_name = find_a_file (&cpath, real_ld_suffix);
/* Likewise for `collect-ld'. */
- if (ld_file_name == 0)
+ if (ld_file_name == NULL)
ld_file_name = find_a_file (&cpath, collect_ld_suffix);
/* Search the compiler directories for `ld'. We have protection against
recursive calls in find_a_file. */
- if (ld_file_name == 0)
- ld_file_name = find_a_file (&cpath,
- use_plugin
- ? plugin_ld_suffix
- : ld_suffix);
+ if (ld_file_name == NULL)
+ switch (selected_linker)
+ {
+ default:
+ case DFLT_LINKER:
+ ld_file_name = find_a_file (&cpath, ld_suffix);
+ break;
+ case PLUGIN_LINKER:
+ ld_file_name = find_a_file (&cpath, plugin_ld_suffix);
+ break;
+ case GOLD_LINKER:
+ ld_file_name = find_a_file (&cpath, gold_suffix);
+ break;
+ case BFD_LINKER:
+ ld_file_name = find_a_file (&cpath, bfd_ld_suffix);
+ break;
+ }
/* Search the ordinary system bin directories
for `ld' (if native linking) or `TARGET-ld' (if cross). */
- if (ld_file_name == 0)
- ld_file_name = find_a_file (&path,
- use_plugin
- ? full_plugin_ld_suffix
- : full_ld_suffix);
+ if (ld_file_name == NULL)
+ switch (selected_linker)
+ {
+ default:
+ case DFLT_LINKER:
+ ld_file_name = find_a_file (&path, full_ld_suffix);
+ break;
+ case PLUGIN_LINKER:
+ ld_file_name = find_a_file (&path, full_plugin_ld_suffix);
+ break;
+ case GOLD_LINKER:
+ ld_file_name = find_a_file (&path, full_gold_suffix);
+ break;
+ case BFD_LINKER:
+ ld_file_name = find_a_file (&path, full_bfd_ld_suffix);
+ break;
+ }
+ /* If we failed to find a plugin-capable linker, try the ordinary one. */
+ if (ld_file_name == NULL && selected_linker == PLUGIN_LINKER)
+ ld_file_name = find_a_file (&cpath, ld_suffix);
+ if ((vflag || debug) && ld_file_name == NULL)
+ {
+ struct prefix_list * p;
+ const char * s;
+
+ notice ("collect2: warning: unable to find linker.\n");
+
+#ifdef DEFAULT_LINKER
+ notice (" Searched for this absolute executable:\n");
+ notice (" %s\n", DEFAULT_LINKER);
+#endif
+
+ notice (" Searched in these paths:\n");
+ for (p = cpath.plist; p != NULL; p = p->next)
+ notice (" %s\n", p->prefix);
+ notice (" For these executables:\n");
+ notice (" %s\n", real_ld_suffix);
+ notice (" %s\n", collect_ld_suffix);
+ switch (selected_linker)
+ {
+ default:
+ case DFLT_LINKER: s = ld_suffix; break;
+ case PLUGIN_LINKER: s = plugin_ld_suffix; break;
+ case GOLD_LINKER: s = gold_suffix; break;
+ case BFD_LINKER: s = bfd_ld_suffix; break;
+ }
+ notice (" %s\n", s);
+
+ notice (" And searched in these paths:\n");
+ for (p = path.plist; p != NULL; p = p->next)
+ notice (" %s\n", p->prefix);
+ notice (" For these executables:\n");
+#ifdef REAL_LD_FILE_NAME
+ notice (" %s\n", REAL_LD_FILE_NAME);
+#endif
+ switch (selected_linker)
+ {
+ default:
+ case DFLT_LINKER: s = full_ld_suffix; break;
+ case PLUGIN_LINKER: s = full_plugin_ld_suffix; break;
+ case GOLD_LINKER: s = full_gold_suffix; break;
+ case BFD_LINKER: s = full_bfd_ld_suffix; break;
+ }
+ notice (" %s\n", s);
+ }
+
#ifdef REAL_NM_FILE_NAME
nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME);
if (nm_file_name == 0)
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-16 17:34 ` Nick Clifton
` (3 preceding siblings ...)
2010-03-22 1:14 ` Matthias Klose
@ 2010-03-31 15:31 ` Daniel Jacobowitz
2010-03-31 15:51 ` H.J. Lu
4 siblings, 1 reply; 44+ messages in thread
From: Daniel Jacobowitz @ 2010-03-31 15:31 UTC (permalink / raw)
To: Nick Clifton; +Cc: H.J. Lu, gcc-patches, binutils, ian
On Tue, Mar 16, 2010 at 05:25:21PM +0000, Nick Clifton wrote:
> Hi H.J.
>
> >-fuse-ld is misleading. ld may be gold. How about "-fuse-ld=[gold|bfd]" which
> >is consistent with linker names and configure options.
>
> A good point. I have attached a revised patch with the option named
> as you suggest. I also omitted to include your name and Roland's in
> the ChangeLog entries, so I have updated those as well.
>
> Any other issues with the patch ?
Matthias had a followup patch for a build failure:
http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00954.html
Other than that, I haven't seen anyone object. Nick can approve the
binutils parts himself. Who can approve the GCC parts - Ian,
how about you? :-)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-31 15:31 ` Daniel Jacobowitz
@ 2010-03-31 15:51 ` H.J. Lu
2010-04-09 8:46 ` Nick Clifton
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-03-31 15:51 UTC (permalink / raw)
To: Nick Clifton, H.J. Lu, gcc-patches, binutils, ian
On Wed, Mar 31, 2010 at 8:31 AM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> On Tue, Mar 16, 2010 at 05:25:21PM +0000, Nick Clifton wrote:
>> Hi H.J.
>>
>> >-fuse-ld is misleading. ld may be gold. How about "-fuse-ld=[gold|bfd]" which
>> >is consistent with linker names and configure options.
>>
>> A good point. I have attached a revised patch with the option named
>> as you suggest. I also omitted to include your name and Roland's in
>> the ChangeLog entries, so I have updated those as well.
>>
>> Any other issues with the patch ?
>
> Matthias had a followup patch for a build failure:
>
> http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00954.html
>
> Other than that, I haven't seen anyone object. Nick can approve the
> binutils parts himself. Who can approve the GCC parts - Ian,
> how about you? :-)
>
I think we need to address:
http://sourceware.org/ml/binutils/2010-03/msg00232.html
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-03-31 15:51 ` H.J. Lu
@ 2010-04-09 8:46 ` Nick Clifton
2010-04-09 16:31 ` Matthias Klose
2010-04-09 16:37 ` H.J. Lu
0 siblings, 2 replies; 44+ messages in thread
From: Nick Clifton @ 2010-04-09 8:46 UTC (permalink / raw)
To: H.J. Lu; +Cc: gcc-patches, binutils, ian
[-- Attachment #1: Type: text/plain, Size: 2728 bytes --]
Hi Guys,
Now that the GCC mainline sources are back in stage 1, and I am back
from vacation, here is another revised version of the gold-and-ld patch
for consideration, and I hope, approval.
This version fixes collect2.c so that it will build even if the
DEFAULT_LINKER environment variable is defined. It also changes the
name of the installed version of the gold linker to be ld.gold in order
to use a consistent naming scheme.
OK to apply ?
Cheers
Nick
./ChangeLog
2010-04-09 Roland McGrath <roland@redhat.com>
H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (--enable-gold): Support both, both/gold and
both/bfd to add gold to configdirs without removing ld.
* configure: Regenerated.
gold/ChangeLog
2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
unless --enable-gold or --enable-gold=both/gold has been
specified.
* configure: Regenerate.
* Makefile.am (install-exec-local): Install the executable as
'ld.gold'. If install_as_default is true then also install it as
'ld'.
* Makefile.in: Regenerated.
ld/ChangeLog
2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
unless --enable-gold=both/gold has been specified.
* configure: Regenerate.
* Makefile.am (transform): Use ld.bfd as the default name of
the linker.
(install-exec-local): Also install the executable as a binary
named 'ld' if install_as_default is true.
* Makefile.in: Regenerate.
gcc/ChangeLog
2010-04-09 Nick Clifton <nickc@redhat.com>
* configure.ac (gcc_cv_gold_srcdir): New cached variable -
contains the location of the gold sources.
(ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
the name of the locally built gold executable.
* configure: Regenerate.
* collect2.c (main): Detect the -use-gold and -use-ld switches
and select the appropriate linker, if found.
If a linker cannot be found and collect2 is executing in
verbose mode then report the search paths examined.
* exec-tool.in: Detect the -use-gold and -use-ld switches and
select the appropriate linker, if found.
Add support for -v switch.
Report problems locating linker executable.
* gcc.c (LINK_COMMAND_SPEC): Translate -fuse-ld=gold into
-use-gold and -fuse-ld=bfd into -use-ld.
* common.opt: Add fuse-ld=gold and fuse-ld=bfd.
* opts.c (comman_handle_option): Ignore -fuse-ld=gold and
-fuse-ld=bfd.
* doc/invoke.texi: Document the new options.
[-- Attachment #2: gold-and-ld.patch.5 --]
[-- Type: application/x-troff-man, Size: 28998 bytes --]
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 8:46 ` Nick Clifton
@ 2010-04-09 16:31 ` Matthias Klose
2010-04-09 16:37 ` H.J. Lu
1 sibling, 0 replies; 44+ messages in thread
From: Matthias Klose @ 2010-04-09 16:31 UTC (permalink / raw)
To: Nick Clifton; +Cc: H.J. Lu, gcc-patches, binutils, ian
On 09.04.2010 10:46, Nick Clifton wrote:
> Hi Guys,
>
> Now that the GCC mainline sources are back in stage 1, and I am back
> from vacation, here is another revised version of the gold-and-ld patch
> for consideration, and I hope, approval.
>
> This version fixes collect2.c so that it will build even if the
> DEFAULT_LINKER environment variable is defined. It also changes the name
> of the installed version of the gold linker to be ld.gold in order to
> use a consistent naming scheme.
looks fine to me. checked with a gcc build on the 4.5 branch.
If this is checked in on the trunk, I would like to ask to apply it to the
branch as well. Selection of the linker currenly is only possible with the
-B<path> option and some locally created symlinks in directories not on PATH.
The -B<path> is installation dependent, your patch does remove this dependency.
Even one of our release managers mentioed that he would use a specfile
patch/hack to be able to select another linker ;)
Matthias
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 8:46 ` Nick Clifton
2010-04-09 16:31 ` Matthias Klose
@ 2010-04-09 16:37 ` H.J. Lu
2010-04-09 16:48 ` H.J. Lu
1 sibling, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-04-09 16:37 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils, ian
On Fri, Apr 9, 2010 at 1:46 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi Guys,
>
> Now that the GCC mainline sources are back in stage 1, and I am back from
> vacation, here is another revised version of the gold-and-ld patch for
> consideration, and I hope, approval.
>
> This version fixes collect2.c so that it will build even if the
> DEFAULT_LINKER environment variable is defined. It also changes the name of
> the installed version of the gold linker to be ld.gold in order to use a
> consistent naming scheme.
>
> OK to apply ?
>
> Cheers
> Nick
>
> ./ChangeLog
> 2010-04-09 Roland McGrath <roland@redhat.com>
> H.J. Lu <hongjiu.lu@intel.com>
>
> * configure.ac (--enable-gold): Support both, both/gold and
> both/bfd to add gold to configdirs without removing ld.
> * configure: Regenerated.
You didn't mention toplevel Makefile.in change. You
should change Makefile.def and regenerate Makefile.in
instead.
H.J.
---
> gold/ChangeLog
> 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
> Nick Clifton <nickc@redhat.com>
>
> * configure.ac (install_as_default): Define and set to false
> unless --enable-gold or --enable-gold=both/gold has been
> specified.
> * configure: Regenerate.
> * Makefile.am (install-exec-local): Install the executable as
> 'ld.gold'. If install_as_default is true then also install it as
> 'ld'.
> * Makefile.in: Regenerated.
>
> ld/ChangeLog
> 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
> Nick Clifton <nickc@redhat.com>
>
> * configure.in (install_as_default): Define and set to true
> unless --enable-gold=both/gold has been specified.
> * configure: Regenerate.
> * Makefile.am (transform): Use ld.bfd as the default name of
> the linker.
> (install-exec-local): Also install the executable as a binary
> named 'ld' if install_as_default is true.
> * Makefile.in: Regenerate.
>
> gcc/ChangeLog
> 2010-04-09 Nick Clifton <nickc@redhat.com>
>
> * configure.ac (gcc_cv_gold_srcdir): New cached variable -
> contains the location of the gold sources.
> (ORIGINAL_GOLD_FOR_TARGET): New substituted variable - contains
> the name of the locally built gold executable.
> * configure: Regenerate.
> * collect2.c (main): Detect the -use-gold and -use-ld switches
> and select the appropriate linker, if found.
> If a linker cannot be found and collect2 is executing in
> verbose mode then report the search paths examined.
> * exec-tool.in: Detect the -use-gold and -use-ld switches and
> select the appropriate linker, if found.
> Add support for -v switch.
> Report problems locating linker executable.
> * gcc.c (LINK_COMMAND_SPEC): Translate -fuse-ld=gold into
> -use-gold and -fuse-ld=bfd into -use-ld.
> * common.opt: Add fuse-ld=gold and fuse-ld=bfd.
> * opts.c (comman_handle_option): Ignore -fuse-ld=gold and
> -fuse-ld=bfd.
> * doc/invoke.texi: Document the new options.
>
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 16:37 ` H.J. Lu
@ 2010-04-09 16:48 ` H.J. Lu
2010-04-09 17:45 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-04-09 16:48 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils, ian
On Fri, Apr 9, 2010 at 9:37 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Apr 9, 2010 at 1:46 AM, Nick Clifton <nickc@redhat.com> wrote:
>> Hi Guys,
>>
>> Now that the GCC mainline sources are back in stage 1, and I am back from
>> vacation, here is another revised version of the gold-and-ld patch for
>> consideration, and I hope, approval.
>>
>> This version fixes collect2.c so that it will build even if the
>> DEFAULT_LINKER environment variable is defined. It also changes the name of
>> the installed version of the gold linker to be ld.gold in order to use a
>> consistent naming scheme.
>>
>> OK to apply ?
>>
>> Cheers
>> Nick
>>
>> ./ChangeLog
>> 2010-04-09 Roland McGrath <roland@redhat.com>
>> H.J. Lu <hongjiu.lu@intel.com>
>>
>> * configure.ac (--enable-gold): Support both, both/gold and
>> both/bfd to add gold to configdirs without removing ld.
>> * configure: Regenerated.
>
> You didn't mention toplevel Makefile.in change. You
> should change Makefile.def and regenerate Makefile.in
> instead.
Something like
diff --git a/Makefile.def b/Makefile.def
index 7dce699..325d845 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -425,6 +425,7 @@ dependencies = { module=all-ld; on=all-build-bison; };
dependencies = { module=all-ld; on=all-build-byacc; };
dependencies = { module=all-ld; on=all-build-flex; };
dependencies = { module=all-ld; on=all-intl; };
+dependencies = { module=install-ld; on=install-gold; };
dependencies = { module=configure-gold; on=configure-intl; };
dependencies = { module=all-gold; on=all-libiberty; };
dependencies = { module=all-gold; on=all-intl; };
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 16:48 ` H.J. Lu
@ 2010-04-09 17:45 ` H.J. Lu
2010-04-09 18:52 ` Ralf Wildenhues
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-04-09 17:45 UTC (permalink / raw)
To: Nick Clifton; +Cc: gcc-patches, binutils, ian
[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]
On Fri, Apr 9, 2010 at 9:47 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Apr 9, 2010 at 9:37 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, Apr 9, 2010 at 1:46 AM, Nick Clifton <nickc@redhat.com> wrote:
>>> Hi Guys,
>>>
>>> Now that the GCC mainline sources are back in stage 1, and I am back from
>>> vacation, here is another revised version of the gold-and-ld patch for
>>> consideration, and I hope, approval.
>>>
>>> This version fixes collect2.c so that it will build even if the
>>> DEFAULT_LINKER environment variable is defined. It also changes the name of
>>> the installed version of the gold linker to be ld.gold in order to use a
>>> consistent naming scheme.
>>>
>>> OK to apply ?
>>>
>>> Cheers
>>> Nick
>>>
>>> ./ChangeLog
>>> 2010-04-09 Roland McGrath <roland@redhat.com>
>>> H.J. Lu <hongjiu.lu@intel.com>
>>>
>>> * configure.ac (--enable-gold): Support both, both/gold and
>>> both/bfd to add gold to configdirs without removing ld.
>>> * configure: Regenerated.
>>
>> You didn't mention toplevel Makefile.in change. You
>> should change Makefile.def and regenerate Makefile.in
>> instead.
>
> Something like
>
> diff --git a/Makefile.def b/Makefile.def
> index 7dce699..325d845 100644
> --- a/Makefile.def
> +++ b/Makefile.def
> @@ -425,6 +425,7 @@ dependencies = { module=all-ld; on=all-build-bison; };
> dependencies = { module=all-ld; on=all-build-byacc; };
> dependencies = { module=all-ld; on=all-build-flex; };
> dependencies = { module=all-ld; on=all-intl; };
> +dependencies = { module=install-ld; on=install-gold; };
> dependencies = { module=configure-gold; on=configure-intl; };
> dependencies = { module=all-gold; on=all-libiberty; };
> dependencies = { module=all-gold; on=all-intl; };
>
>
Here is the updated patch for ld and gold, excluding gcc.
--
H.J.
[-- Attachment #2: binutils-gold-8.patch --]
[-- Type: text/plain, Size: 21708 bytes --]
2010-04-09 Roland McGrath <roland@redhat.com>
H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (--enable-gold): Support both, both/gold and
both/bfd to add gold to configdirs without removing ld.
* configure: Regenerated.
* Makefile.def: Add install-gold dependency to install-ld.
* Makefile.in: Regenerated.
gold/
2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
unless --enable-gold or --enable-gold=both/gold has been
specified.
* configure: Regenerate.
* Makefile.am (install-exec-local): Install the executable as
'ld.gold'. If install_as_default is true then also install it as
'ld'.
* Makefile.in: Regenerated.
ld/
2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
unless --enable-gold=both/gold has been specified.
* configure: Regenerate.
* Makefile.am (transform): Use ld.bfd as the default name of
the linker.
(install-exec-local): Also install the executable as a binary
named 'ld' if install_as_default is true.
* Makefile.in: Regenerate.
diff --git a/Makefile.def b/Makefile.def
index 7dce699..325d845 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -425,6 +425,7 @@ dependencies = { module=all-ld; on=all-build-bison; };
dependencies = { module=all-ld; on=all-build-byacc; };
dependencies = { module=all-ld; on=all-build-flex; };
dependencies = { module=all-ld; on=all-intl; };
+dependencies = { module=install-ld; on=install-gold; };
dependencies = { module=configure-gold; on=configure-intl; };
dependencies = { module=all-gold; on=all-libiberty; };
dependencies = { module=all-gold; on=all-intl; };
diff --git a/Makefile.in b/Makefile.in
index 93f66b6..d1d8b32 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -58231,6 +58231,7 @@ all-stage3-ld: maybe-all-stage3-intl
all-stage4-ld: maybe-all-stage4-intl
all-stageprofile-ld: maybe-all-stageprofile-intl
all-stagefeedback-ld: maybe-all-stagefeedback-intl
+install-ld: maybe-install-gold
configure-gold: maybe-configure-intl
configure-stage1-gold: maybe-configure-stage1-intl
diff --git a/configure b/configure
index c2c406e..df1a005 100755
--- a/configure
+++ b/configure
@@ -1483,7 +1483,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-gold use gold instead of ld
+ --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
--enable-libada build libada directory
--enable-libssp build libssp directory
--enable-build-with-cxx build with C++ compiler instead of C compiler
@@ -2901,7 +2901,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib l
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
-# If --enable-gold is used, "gold" will replace "ld".
+# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
# libgcj represents the runtime libraries only used by gcj.
@@ -3069,6 +3069,11 @@ case ${with_newlib} in
esac
# Handle --enable-gold.
+# --enable-gold Build only gold
+# --disable-gold [default] Build only ld
+# --enable-gold=both Build both gold and ld, ld is default
+# --enable-gold=both/ld Same
+# --enable-gold=both/gold Build both gold and ld, gold is default, ld is renamed ld.bfd
# Check whether --enable-gold was given.
if test "${enable_gold+set}" = set; then :
@@ -3077,32 +3082,47 @@ else
ENABLE_GOLD=no
fi
-if test "${ENABLE_GOLD}" = "yes"; then
- # Check for ELF target.
- is_elf=no
- case "${target}" in
- *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
- | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${ENABLE_GOLD}" in
+ yes|both|both/gold|both/ld)
+ # Check for ELF target.
+ is_elf=no
+ case "${target}" in
+ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+ | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${target}" in
+ *-*-linux*aout* | *-*-linux*oldld*)
+ ;;
+ *)
+ is_elf=yes
+ ;;
+ esac
+ esac
+
+ if test "$is_elf" = "yes"; then
+ # Check for target supported by gold.
case "${target}" in
- *-*-linux*aout* | *-*-linux*oldld*)
- ;;
- *)
- is_elf=yes
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
+ case "${ENABLE_GOLD}" in
+ both*)
+ configdirs="$configdirs gold"
+ ;;
+ *)
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ ;;
+ esac
+ ENABLE_GOLD=yes
;;
esac
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
esac
- if test "$is_elf" = "yes"; then
- # Check for target supported by gold.
- case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
- ;;
- esac
- fi
-fi
-
# Configure extra directories which are host specific
case "${host}" in
diff --git a/configure.ac b/configure.ac
index 72407f8..e113e5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,7 +174,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib l
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
-# If --enable-gold is used, "gold" will replace "ld".
+# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
# libgcj represents the runtime libraries only used by gcj.
@@ -315,37 +315,57 @@ case ${with_newlib} in
esac
# Handle --enable-gold.
+# --enable-gold Build only gold
+# --disable-gold [default] Build only ld
+# --enable-gold=both Build both gold and ld, ld is default
+# --enable-gold=both/ld Same
+# --enable-gold=both/gold Build both gold and ld, gold is default, ld is renamed ld.bfd
AC_ARG_ENABLE(gold,
-[ --enable-gold use gold instead of ld],
+[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
ENABLE_GOLD=$enableval,
ENABLE_GOLD=no)
-if test "${ENABLE_GOLD}" = "yes"; then
- # Check for ELF target.
- is_elf=no
- case "${target}" in
- *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
- | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${ENABLE_GOLD}" in
+ yes|both|both/gold|both/ld)
+ # Check for ELF target.
+ is_elf=no
+ case "${target}" in
+ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+ | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${target}" in
+ *-*-linux*aout* | *-*-linux*oldld*)
+ ;;
+ *)
+ is_elf=yes
+ ;;
+ esac
+ esac
+
+ if test "$is_elf" = "yes"; then
+ # Check for target supported by gold.
case "${target}" in
- *-*-linux*aout* | *-*-linux*oldld*)
- ;;
- *)
- is_elf=yes
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
+ case "${ENABLE_GOLD}" in
+ both*)
+ configdirs="$configdirs gold"
+ ;;
+ *)
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ ;;
+ esac
+ ENABLE_GOLD=yes
;;
esac
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
esac
- if test "$is_elf" = "yes"; then
- # Check for target supported by gold.
- case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
- ;;
- esac
- fi
-fi
-
# Configure extra directories which are host specific
case "${host}" in
diff --git a/gold/Makefile.am b/gold/Makefile.am
index e0665e0..068a091 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -178,12 +178,21 @@ check: libgold.a
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo ld.gold | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld.gold$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.gold$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.gold$(EXEEXT); \
+ fi
+ if test "x$(install_as_default)" = "xyes"; then \
+ n=`echo ld | sed '$(transform)'`; \
+ $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi; \
fi
# We want install to imply install-info as per GNU standards, despite
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 6e736f1..600cf05 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -258,6 +258,7 @@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
+install_as_default = @install_as_default@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
@@ -1002,12 +1003,21 @@ check: libgold.a
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo ld.gold | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld.gold$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.gold$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.gold$(EXEEXT); \
+ fi
+ if test "x$(install_as_default)" = "xyes"; then \
+ n=`echo ld | sed '$(transform)'`; \
+ $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi; \
fi
# We want install to imply install-info as per GNU standards, despite
diff --git a/gold/configure b/gold/configure
index 20df0df..3cc2fa7 100755
--- a/gold/configure
+++ b/gold/configure
@@ -682,6 +682,7 @@ PLUGINS_FALSE
PLUGINS_TRUE
THREADS_FALSE
THREADS_TRUE
+install_as_default
am__untar
am__tar
AMTAR
@@ -759,6 +760,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_sysroot
+enable_gold
enable_threads
enable_plugins
enable_targets
@@ -1403,6 +1405,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
--enable-threads multi-threaded linking
--enable-plugins linker plugins
--enable-targets alternative target configurations
@@ -3227,6 +3230,25 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Check whether --enable-gold was given.
+if test "${enable_gold+set}" = set; then :
+ enableval=$enable_gold; case "${enableval}" in
+ yes|both/gold)
+ install_as_default=yes
+ ;;
+ both|both/ld)
+ install_as_default=no
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
+ esac
+else
+ install_as_default=no
+fi
+
+
+
# Check whether --enable-threads was given.
if test "${enable_threads+set}" = set; then :
enableval=$enable_threads; case "${enableval}" in
diff --git a/gold/configure.ac b/gold/configure.ac
index 72db25d..d3f4689 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -38,6 +38,24 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable,
[Whether the system root can be relocated])
+dnl "install_as_default" is true if the linker to be installed as the
+dnl default linker, ld.
+AC_ARG_ENABLE(gold,
+[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
+[case "${enableval}" in
+ yes|both/gold)
+ install_as_default=yes
+ ;;
+ both|both/ld)
+ install_as_default=no
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_as_default=no])
+AC_SUBST(install_as_default)
+
dnl For now threads are a configure time option.
AC_ARG_ENABLE([threads],
[ --enable-threads multi-threaded linking],
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 010fb55..a6eacf0 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -95,7 +95,7 @@ CXX_FOR_TARGET = ` \
fi; \
fi`
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/ld.bfd/;@program_transform_name@
bin_PROGRAMS = ld-new
info_TEXINFOS = ld.texinfo
ld_TEXINFOS = configdoc.texi
@@ -1992,11 +1992,21 @@ CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 spu_ovl.s spu_ovl.o spu_icache.s spu_ica
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
- if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ n=`echo ld.bfd | sed '$(transform)'`; \
+ if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld.bfd$(EXEEXT)" ]; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld.bfd$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.bfd$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.bfd$(EXEEXT); \
+ fi
+ if [ "x$(install_as_default)" != "xno" ]; then \
+ n=`echo ld | sed '$(transform)'`; \
+ if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \
+ ln $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi ; \
fi
install-data-local:
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 5bbb899..61f20a1 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -155,7 +155,7 @@ CTAGS = ctags
DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
DIST_SUBDIRS = $(SUBDIRS)
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/ld.bfd/;@program_transform_name@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -295,6 +295,7 @@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
+install_as_default = @install_as_default@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
@@ -3316,11 +3317,21 @@ mostlyclean-local:
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
- if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ n=`echo ld.bfd | sed '$(transform)'`; \
+ if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld.bfd$(EXEEXT)" ]; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld.bfd$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.bfd$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld.bfd$(EXEEXT); \
+ fi
+ if [ "x$(install_as_default)" != "xno" ]; then \
+ n=`echo ld | sed '$(transform)'`; \
+ if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \
+ ln $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi ; \
fi
install-data-local:
diff --git a/ld/configure b/ld/configure
index 1fa0395..b41c8fe 100755
--- a/ld/configure
+++ b/ld/configure
@@ -657,6 +657,7 @@ WARN_CFLAGS
EGREP
GREP
CPP
+install_as_default
TARGET_SYSTEM_ROOT_DEFINE
TARGET_SYSTEM_ROOT
use_sysroot
@@ -761,6 +762,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_gold
enable_got
enable_werror
enable_build_warnings
@@ -1409,6 +1411,7 @@ Optional Features:
(and sometimes confusing) to the casual installer
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
--enable-werror treat compile warnings as errors
@@ -4164,6 +4167,25 @@ fi
+# Check whether --enable-gold was given.
+if test "${enable_gold+set}" = set; then :
+ enableval=$enable_gold; case "${enableval}" in
+ yes|both/gold)
+ install_as_default=no
+ ;;
+ both|both/ld)
+ install_as_default=yes
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
+ esac
+else
+ install_as_default=yes
+fi
+
+
+
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
enableval=$enable_got; case "${enableval}" in
@@ -11587,7 +11609,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11590 "configure"
+#line 11612 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11693,7 +11715,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11696 "configure"
+#line 11718 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/ld/configure.in b/ld/configure.in
index 2abfba4..2a6504d 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -69,6 +69,24 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+dnl Use --enable-gold to decide if this linker should be the default.
+dnl "install_as_default" is set to false if gold is the default linker.
+AC_ARG_ENABLE(gold,
+[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
+[case "${enableval}" in
+ yes|both/gold)
+ install_as_default=no
+ ;;
+ both|both/ld)
+ install_as_default=yes
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_as_default=yes])
+AC_SUBST(install_as_default)
+
AC_ARG_ENABLE([got],
AS_HELP_STRING([--enable-got=<type>],
[GOT handling scheme (target, single, negative, multigot)]),
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 17:45 ` H.J. Lu
@ 2010-04-09 18:52 ` Ralf Wildenhues
2010-04-09 21:10 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: Ralf Wildenhues @ 2010-04-09 18:52 UTC (permalink / raw)
To: H.J. Lu; +Cc: Nick Clifton, gcc-patches, binutils, ian
Hello H.J.,
a very minor nit:
* H.J. Lu wrote on Fri, Apr 09, 2010 at 07:45:11PM CEST:
> --- a/configure
> +++ b/configure
> @@ -1483,7 +1483,7 @@ Optional Features:
> - --enable-gold use gold instead of ld
> + --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
> --- a/configure.ac
> +++ b/configure.ac
> AC_ARG_ENABLE(gold,
> -[ --enable-gold use gold instead of ld],
> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
For a consistent quoting style that expands to the desired number of
brackets, use either outer double quoting
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
(note: within double-quoted text no macros will be expanded),
or use quadrigraphs @<:@ and @:>@ which will always expand to one
literal bracket.
> --- a/gold/configure.ac
> +++ b/gold/configure.ac
> @@ -38,6 +38,24 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
> +AC_ARG_ENABLE(gold,
> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
Likewise here.
Cheers,
Ralf
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 18:52 ` Ralf Wildenhues
@ 2010-04-09 21:10 ` H.J. Lu
2010-04-10 4:07 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-04-09 21:10 UTC (permalink / raw)
To: Ralf Wildenhues, H.J. Lu, Nick Clifton, gcc-patches, binutils, ian
On Fri, Apr 9, 2010 at 11:52 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> Hello H.J.,
>
> a very minor nit:
>
> * H.J. Lu wrote on Fri, Apr 09, 2010 at 07:45:11PM CEST:
>> --- a/configure
>> +++ b/configure
>> @@ -1483,7 +1483,7 @@ Optional Features:
>
>> - --enable-gold use gold instead of ld
>> + --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
>
>> --- a/configure.ac
>> +++ b/configure.ac
>
>> AC_ARG_ENABLE(gold,
>> -[ --enable-gold use gold instead of ld],
>> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
>
> For a consistent quoting style that expands to the desired number of
> brackets, use either outer double quoting
>
> +[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
>
> (note: within double-quoted text no macros will be expanded),
> or use quadrigraphs @<:@ and @:>@ which will always expand to one
> literal bracket.
>
>> --- a/gold/configure.ac
>> +++ b/gold/configure.ac
>> @@ -38,6 +38,24 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
>
>> +AC_ARG_ENABLE(gold,
>> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
>
> Likewise here.
>
I will fix it.
There are more problems:
1. ld.bfd is installed even when gold is disabled.
2. The old ld isn't removed before installing the new one.
--
H.J.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-09 21:10 ` H.J. Lu
@ 2010-04-10 4:07 ` H.J. Lu
2010-04-19 18:17 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-04-10 4:07 UTC (permalink / raw)
To: Ralf Wildenhues, Nick Clifton, gcc-patches, binutils, ian
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
On Fri, Apr 9, 2010 at 2:10 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Apr 9, 2010 at 11:52 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
>> Hello H.J.,
>>
>> a very minor nit:
>>
>> * H.J. Lu wrote on Fri, Apr 09, 2010 at 07:45:11PM CEST:
>>> --- a/configure
>>> +++ b/configure
>>> @@ -1483,7 +1483,7 @@ Optional Features:
>>
>>> - --enable-gold use gold instead of ld
>>> + --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
>>
>>> --- a/configure.ac
>>> +++ b/configure.ac
>>
>>> AC_ARG_ENABLE(gold,
>>> -[ --enable-gold use gold instead of ld],
>>> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
>>
>> For a consistent quoting style that expands to the desired number of
>> brackets, use either outer double quoting
>>
>> +[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
>>
>> (note: within double-quoted text no macros will be expanded),
>> or use quadrigraphs @<:@ and @:>@ which will always expand to one
>> literal bracket.
>>
>>> --- a/gold/configure.ac
>>> +++ b/gold/configure.ac
>>> @@ -38,6 +38,24 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
>>
>>> +AC_ARG_ENABLE(gold,
>>> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
>>
>> Likewise here.
>>
>
> I will fix it.
>
> There are more problems:
>
> 1. ld.bfd is installed even when gold is disabled.
> 2. The old ld isn't removed before installing the new one.
>
Here is the updated patch. I fixed the above issues. Also
it uses link whenever possible with proper install
dependency. I tested it with
1. --enable-gold=yes
2. --enable-gold=both
3. --enable-gold=both/gold
4. Nothing
"make install" works correctly.
--
H.J.
[-- Attachment #2: binutils-gold-8.patch --]
[-- Type: text/plain, Size: 23173 bytes --]
2010-04-09 Roland McGrath <roland@redhat.com>
H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (--enable-gold): Support both, both/gold and
both/bfd to add gold to configdirs without removing ld.
* configure: Regenerated.
* Makefile.def: Add install-gold dependency to install-ld.
* Makefile.in: Regenerated.
gold/
2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
unless --enable-gold or --enable-gold=both/gold has been
specified.
* configure: Regenerate.
* Makefile.am (install-exec-local): Install the executable as
'ld.gold'. If install_as_default is true then also install it as
'ld'.
* Makefile.in: Regenerated.
ld/
2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
unless --enable-gold=both/gold has been specified.
* configure: Regenerate.
* Makefile.am (transform): Use ld.bfd as the default name of
the linker.
(install-exec-local): Also install the executable as a binary
named 'ld' if install_as_default is true.
* Makefile.in: Regenerate.
diff --git a/Makefile.def b/Makefile.def
index 7dce699..325d845 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -425,6 +425,7 @@ dependencies = { module=all-ld; on=all-build-bison; };
dependencies = { module=all-ld; on=all-build-byacc; };
dependencies = { module=all-ld; on=all-build-flex; };
dependencies = { module=all-ld; on=all-intl; };
+dependencies = { module=install-ld; on=install-gold; };
dependencies = { module=configure-gold; on=configure-intl; };
dependencies = { module=all-gold; on=all-libiberty; };
dependencies = { module=all-gold; on=all-intl; };
diff --git a/Makefile.in b/Makefile.in
index 93f66b6..d1d8b32 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -58231,6 +58231,7 @@ all-stage3-ld: maybe-all-stage3-intl
all-stage4-ld: maybe-all-stage4-intl
all-stageprofile-ld: maybe-all-stageprofile-intl
all-stagefeedback-ld: maybe-all-stagefeedback-intl
+install-ld: maybe-install-gold
configure-gold: maybe-configure-intl
configure-stage1-gold: maybe-configure-stage1-intl
diff --git a/configure b/configure
index c2c406e..a63d75c 100755
--- a/configure
+++ b/configure
@@ -1483,7 +1483,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-gold use gold instead of ld
+ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]
--enable-libada build libada directory
--enable-libssp build libssp directory
--enable-build-with-cxx build with C++ compiler instead of C compiler
@@ -2901,7 +2901,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib l
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
-# If --enable-gold is used, "gold" will replace "ld".
+# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
# libgcj represents the runtime libraries only used by gcj.
@@ -3069,6 +3069,11 @@ case ${with_newlib} in
esac
# Handle --enable-gold.
+# --enable-gold Build only gold
+# --disable-gold [default] Build only ld
+# --enable-gold=both Build both gold and ld, ld is default
+# --enable-gold=both/ld Same
+# --enable-gold=both/gold Build both gold and ld, gold is default, ld is renamed ld.bfd
# Check whether --enable-gold was given.
if test "${enable_gold+set}" = set; then :
@@ -3077,32 +3082,47 @@ else
ENABLE_GOLD=no
fi
-if test "${ENABLE_GOLD}" = "yes"; then
- # Check for ELF target.
- is_elf=no
- case "${target}" in
- *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
- | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${ENABLE_GOLD}" in
+ yes|both|both/gold|both/ld)
+ # Check for ELF target.
+ is_elf=no
+ case "${target}" in
+ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+ | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${target}" in
+ *-*-linux*aout* | *-*-linux*oldld*)
+ ;;
+ *)
+ is_elf=yes
+ ;;
+ esac
+ esac
+
+ if test "$is_elf" = "yes"; then
+ # Check for target supported by gold.
case "${target}" in
- *-*-linux*aout* | *-*-linux*oldld*)
- ;;
- *)
- is_elf=yes
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
+ case "${ENABLE_GOLD}" in
+ both*)
+ configdirs="$configdirs gold"
+ ;;
+ *)
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ ;;
+ esac
+ ENABLE_GOLD=yes
;;
esac
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
esac
- if test "$is_elf" = "yes"; then
- # Check for target supported by gold.
- case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
- ;;
- esac
- fi
-fi
-
# Configure extra directories which are host specific
case "${host}" in
diff --git a/configure.ac b/configure.ac
index 72407f8..d737183 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,7 +174,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib l
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
-# If --enable-gold is used, "gold" will replace "ld".
+# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
# libgcj represents the runtime libraries only used by gcj.
@@ -315,37 +315,57 @@ case ${with_newlib} in
esac
# Handle --enable-gold.
+# --enable-gold Build only gold
+# --disable-gold [default] Build only ld
+# --enable-gold=both Build both gold and ld, ld is default
+# --enable-gold=both/ld Same
+# --enable-gold=both/gold Build both gold and ld, gold is default, ld is renamed ld.bfd
AC_ARG_ENABLE(gold,
-[ --enable-gold use gold instead of ld],
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
ENABLE_GOLD=$enableval,
ENABLE_GOLD=no)
-if test "${ENABLE_GOLD}" = "yes"; then
- # Check for ELF target.
- is_elf=no
- case "${target}" in
- *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
- | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${ENABLE_GOLD}" in
+ yes|both|both/gold|both/ld)
+ # Check for ELF target.
+ is_elf=no
+ case "${target}" in
+ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+ | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${target}" in
+ *-*-linux*aout* | *-*-linux*oldld*)
+ ;;
+ *)
+ is_elf=yes
+ ;;
+ esac
+ esac
+
+ if test "$is_elf" = "yes"; then
+ # Check for target supported by gold.
case "${target}" in
- *-*-linux*aout* | *-*-linux*oldld*)
- ;;
- *)
- is_elf=yes
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
+ case "${ENABLE_GOLD}" in
+ both*)
+ configdirs="$configdirs gold"
+ ;;
+ *)
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ ;;
+ esac
+ ENABLE_GOLD=yes
;;
esac
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
esac
- if test "$is_elf" = "yes"; then
- # Check for target supported by gold.
- case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
- ;;
- esac
- fi
-fi
-
# Configure extra directories which are host specific
case "${host}" in
diff --git a/gold/Makefile.am b/gold/Makefile.am
index e0665e0..1f2618d 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -178,12 +178,23 @@ check: libgold.a
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ rm -f $(DESTDIR)$(tooldir)/bin/$${n}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${n}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${n}$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$${ld}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${ld}$(EXEEXT); \
+ fi; \
fi
# We want install to imply install-info as per GNU standards, despite
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 6e736f1..4f58e62 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -258,7 +258,9 @@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
+install_as_default = @install_as_default@
install_sh = @install_sh@
+installed_linker = @installed_linker@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -1002,12 +1004,23 @@ check: libgold.a
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ rm -f $(DESTDIR)$(tooldir)/bin/$${n}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${n}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${n}$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$${ld}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$${ld}$(EXEEXT); \
+ fi; \
fi
# We want install to imply install-info as per GNU standards, despite
diff --git a/gold/configure b/gold/configure
index 20df0df..eb8f01e 100755
--- a/gold/configure
+++ b/gold/configure
@@ -682,6 +682,8 @@ PLUGINS_FALSE
PLUGINS_TRUE
THREADS_FALSE
THREADS_TRUE
+installed_linker
+install_as_default
am__untar
am__tar
AMTAR
@@ -759,6 +761,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_sysroot
+enable_gold
enable_threads
enable_plugins
enable_targets
@@ -1403,6 +1406,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]
--enable-threads multi-threaded linking
--enable-plugins linker plugins
--enable-targets alternative target configurations
@@ -3227,6 +3231,33 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Check whether --enable-gold was given.
+if test "${enable_gold+set}" = set; then :
+ enableval=$enable_gold; case "${enableval}" in
+ yes)
+ install_as_default=gold
+ installed_linker=ld
+ ;;
+ both/gold)
+ install_as_default=yes
+ installed_linker=ld.gold
+ ;;
+ both|both/ld)
+ install_as_default=no
+ installed_linker=ld.gold
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
+ esac
+else
+ install_as_default=gold
+ installed_linker=ld
+fi
+
+
+
+
# Check whether --enable-threads was given.
if test "${enable_threads+set}" = set; then :
enableval=$enable_threads; case "${enableval}" in
diff --git a/gold/configure.ac b/gold/configure.ac
index 72db25d..67d1796 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -38,6 +38,33 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable,
[Whether the system root can be relocated])
+dnl "install_as_default" is true if the linker to be installed as the
+dnl default linker, ld.
+dnl "installed_linker" is the installed gold linker name.
+AC_ARG_ENABLE(gold,
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
+[case "${enableval}" in
+ yes)
+ install_as_default=gold
+ installed_linker=ld
+ ;;
+ both/gold)
+ install_as_default=yes
+ installed_linker=ld.gold
+ ;;
+ both|both/ld)
+ install_as_default=no
+ installed_linker=ld.gold
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_as_default=gold
+ installed_linker=ld])
+AC_SUBST(install_as_default)
+AC_SUBST(installed_linker)
+
dnl For now threads are a configure time option.
AC_ARG_ENABLE([threads],
[ --enable-threads multi-threaded linking],
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 010fb55..e9a34af 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -95,7 +95,7 @@ CXX_FOR_TARGET = ` \
fi; \
fi`
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
bin_PROGRAMS = ld-new
info_TEXINFOS = ld.texinfo
ld_TEXINFOS = configdoc.texi
@@ -1990,13 +1990,24 @@ CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 spu_ovl.s spu_ovl.o spu_icache.s spu_ica
.PHONY: install-exec-local install-data-local
-install-exec-local: ld-new$(EXEEXT)
+install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
- if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
+ if test "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/$$n$(EXEEXT)"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$$n$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$n$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$n$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
+ if test "$(bindir)/$$ld$(EXEEXT)" != "$(tooldir)/bin/$$ld$(EXEEXT)"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$$ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$ld$(EXEEXT); \
+ fi; \
fi
install-data-local:
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 5bbb899..9e3fc27 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -155,7 +155,7 @@ CTAGS = ctags
DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
DIST_SUBDIRS = $(SUBDIRS)
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -295,7 +295,9 @@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
+install_as_default = @install_as_default@
install_sh = @install_sh@
+installed_linker = @installed_linker@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -3314,13 +3316,24 @@ mostlyclean-local:
.PHONY: install-exec-local install-data-local
-install-exec-local: ld-new$(EXEEXT)
+install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
- if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
+ if test "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/$$n$(EXEEXT)"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$$n$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$n$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$n$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
+ if test "$(bindir)/$$ld$(EXEEXT)" != "$(tooldir)/bin/$$ld$(EXEEXT)"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$$ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$$ld$(EXEEXT); \
+ fi; \
fi
install-data-local:
diff --git a/ld/configure b/ld/configure
index 1fa0395..ed3da98 100755
--- a/ld/configure
+++ b/ld/configure
@@ -657,6 +657,8 @@ WARN_CFLAGS
EGREP
GREP
CPP
+installed_linker
+install_as_default
TARGET_SYSTEM_ROOT_DEFINE
TARGET_SYSTEM_ROOT
use_sysroot
@@ -761,6 +763,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_gold
enable_got
enable_werror
enable_build_warnings
@@ -1409,6 +1412,7 @@ Optional Features:
(and sometimes confusing) to the casual installer
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
--enable-werror treat compile warnings as errors
@@ -4164,6 +4168,29 @@ fi
+# Check whether --enable-gold was given.
+if test "${enable_gold+set}" = set; then :
+ enableval=$enable_gold; case "${enableval}" in
+ yes|both/gold)
+ install_as_default=no
+ installed_linker=ld.bfd
+ ;;
+ both|both/ld)
+ install_as_default=yes
+ installed_linker=ld.bfd
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
+ esac
+else
+ install_as_default=ld
+ installed_linker=ld
+fi
+
+
+
+
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
enableval=$enable_got; case "${enableval}" in
@@ -11587,7 +11614,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11590 "configure"
+#line 11617 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11693,7 +11720,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11696 "configure"
+#line 11723 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/ld/configure.in b/ld/configure.in
index 2abfba4..90baeca 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -69,6 +69,29 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+dnl Use --enable-gold to decide if this linker should be the default.
+dnl "install_as_default" is set to false if gold is the default linker.
+dnl "installed_linker" is the installed BFD linker name.
+AC_ARG_ENABLE(gold,
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
+[case "${enableval}" in
+ yes|both/gold)
+ install_as_default=no
+ installed_linker=ld.bfd
+ ;;
+ both|both/ld)
+ install_as_default=yes
+ installed_linker=ld.bfd
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_as_default=ld
+ installed_linker=ld])
+AC_SUBST(install_as_default)
+AC_SUBST(installed_linker)
+
AC_ARG_ENABLE([got],
AS_HELP_STRING([--enable-got=<type>],
[GOT handling scheme (target, single, negative, multigot)]),
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-10 4:07 ` H.J. Lu
@ 2010-04-19 18:17 ` H.J. Lu
2010-04-27 14:36 ` Nick Clifton
0 siblings, 1 reply; 44+ messages in thread
From: H.J. Lu @ 2010-04-19 18:17 UTC (permalink / raw)
To: Ralf Wildenhues, Nick Clifton, gcc-patches, binutils, ian
[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]
On Fri, Apr 9, 2010 at 9:07 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Apr 9, 2010 at 2:10 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, Apr 9, 2010 at 11:52 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
>>> Hello H.J.,
>>>
>>> a very minor nit:
>>>
>>> * H.J. Lu wrote on Fri, Apr 09, 2010 at 07:45:11PM CEST:
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -1483,7 +1483,7 @@ Optional Features:
>>>
>>>> - --enable-gold use gold instead of ld
>>>> + --enable-gold[=ARG] build gold [ARG={both}[[/{gold,ld}]]]
>>>
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>
>>>> AC_ARG_ENABLE(gold,
>>>> -[ --enable-gold use gold instead of ld],
>>>> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
>>>
>>> For a consistent quoting style that expands to the desired number of
>>> brackets, use either outer double quoting
>>>
>>> +[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
>>>
>>> (note: within double-quoted text no macros will be expanded),
>>> or use quadrigraphs @<:@ and @:>@ which will always expand to one
>>> literal bracket.
>>>
>>>> --- a/gold/configure.ac
>>>> +++ b/gold/configure.ac
>>>> @@ -38,6 +38,24 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
>>>
>>>> +AC_ARG_ENABLE(gold,
>>>> +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,ld}]]]]],
>>>
>>> Likewise here.
>>>
>>
>> I will fix it.
>>
>> There are more problems:
>>
>> 1. ld.bfd is installed even when gold is disabled.
>> 2. The old ld isn't removed before installing the new one.
>>
>
> Here is the updated patch. I fixed the above issues. Also
> it uses link whenever possible with proper install
> dependency. I tested it with
>
> 1. --enable-gold=yes
> 2. --enable-gold=both
> 3. --enable-gold=both/gold
> 4. Nothing
>
> "make install" works correctly.
>
Another update to fix:
http://www.sourceware.org/bugzilla/show_bug.cgi?id=11510
--
H.J.
[-- Attachment #2: binutils-gold-9.patch --]
[-- Type: text/plain, Size: 22841 bytes --]
2010-04-19 Roland McGrath <roland@redhat.com>
H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (--enable-gold): Support both, both/gold and
both/bfd to add gold to configdirs without removing ld.
* configure: Regenerated.
* Makefile.def: Add install-gold dependency to install-ld.
* Makefile.in: Regenerated.
gold/
2010-04-19 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
unless --enable-gold or --enable-gold=both/gold has been
specified.
* configure: Regenerate.
* Makefile.am (install-exec-local): Install the executable as
'ld.gold'. If install_as_default is true then also install it as
'ld'.
* Makefile.in: Regenerated.
ld/
2010-04-19 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
unless --enable-gold=both/gold has been specified.
* configure: Regenerate.
* Makefile.am (transform): Use ld.bfd as the default name of
the linker.
(install-exec-local): Also install the executable as a binary
named 'ld' if install_as_default is true.
* Makefile.in: Regenerate.
diff --git a/Makefile.def b/Makefile.def
index 7dce699..325d845 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -425,6 +425,7 @@ dependencies = { module=all-ld; on=all-build-bison; };
dependencies = { module=all-ld; on=all-build-byacc; };
dependencies = { module=all-ld; on=all-build-flex; };
dependencies = { module=all-ld; on=all-intl; };
+dependencies = { module=install-ld; on=install-gold; };
dependencies = { module=configure-gold; on=configure-intl; };
dependencies = { module=all-gold; on=all-libiberty; };
dependencies = { module=all-gold; on=all-intl; };
diff --git a/Makefile.in b/Makefile.in
index 93f66b6..d1d8b32 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -58231,6 +58231,7 @@ all-stage3-ld: maybe-all-stage3-intl
all-stage4-ld: maybe-all-stage4-intl
all-stageprofile-ld: maybe-all-stageprofile-intl
all-stagefeedback-ld: maybe-all-stagefeedback-intl
+install-ld: maybe-install-gold
configure-gold: maybe-configure-intl
configure-stage1-gold: maybe-configure-stage1-intl
diff --git a/configure b/configure
index 4676d37..5491bbb 100755
--- a/configure
+++ b/configure
@@ -1483,7 +1483,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-gold use gold instead of ld
+ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]
--enable-libada build libada directory
--enable-libssp build libssp directory
--enable-build-with-cxx build with C++ compiler instead of C compiler
@@ -2901,7 +2901,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib l
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
-# If --enable-gold is used, "gold" will replace "ld".
+# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
# libgcj represents the runtime libraries only used by gcj.
@@ -3069,6 +3069,11 @@ case ${with_newlib} in
esac
# Handle --enable-gold.
+# --enable-gold Build only gold
+# --disable-gold [default] Build only ld
+# --enable-gold=both Build both gold and ld, ld is default
+# --enable-gold=both/ld Same
+# --enable-gold=both/gold Build both gold and ld, gold is default, ld is renamed ld.bfd
# Check whether --enable-gold was given.
if test "${enable_gold+set}" = set; then :
@@ -3077,32 +3082,47 @@ else
ENABLE_GOLD=no
fi
-if test "${ENABLE_GOLD}" = "yes"; then
- # Check for ELF target.
- is_elf=no
- case "${target}" in
- *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
- | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${ENABLE_GOLD}" in
+ yes|both|both/gold|both/ld)
+ # Check for ELF target.
+ is_elf=no
+ case "${target}" in
+ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+ | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${target}" in
+ *-*-linux*aout* | *-*-linux*oldld*)
+ ;;
+ *)
+ is_elf=yes
+ ;;
+ esac
+ esac
+
+ if test "$is_elf" = "yes"; then
+ # Check for target supported by gold.
case "${target}" in
- *-*-linux*aout* | *-*-linux*oldld*)
- ;;
- *)
- is_elf=yes
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
+ case "${ENABLE_GOLD}" in
+ both*)
+ configdirs="$configdirs gold"
+ ;;
+ *)
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ ;;
+ esac
+ ENABLE_GOLD=yes
;;
esac
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
esac
- if test "$is_elf" = "yes"; then
- # Check for target supported by gold.
- case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
- ;;
- esac
- fi
-fi
-
# Configure extra directories which are host specific
case "${host}" in
diff --git a/configure.ac b/configure.ac
index fcf07c7..6d3390a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,7 +174,7 @@ host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib l
# know that we are building the simulator.
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
-# If --enable-gold is used, "gold" will replace "ld".
+# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"
# libgcj represents the runtime libraries only used by gcj.
@@ -315,37 +315,57 @@ case ${with_newlib} in
esac
# Handle --enable-gold.
+# --enable-gold Build only gold
+# --disable-gold [default] Build only ld
+# --enable-gold=both Build both gold and ld, ld is default
+# --enable-gold=both/ld Same
+# --enable-gold=both/gold Build both gold and ld, gold is default, ld is renamed ld.bfd
AC_ARG_ENABLE(gold,
-[ --enable-gold use gold instead of ld],
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
ENABLE_GOLD=$enableval,
ENABLE_GOLD=no)
-if test "${ENABLE_GOLD}" = "yes"; then
- # Check for ELF target.
- is_elf=no
- case "${target}" in
- *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
- | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
- | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${ENABLE_GOLD}" in
+ yes|both|both/gold|both/ld)
+ # Check for ELF target.
+ is_elf=no
+ case "${target}" in
+ *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+ | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+ | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2* | *-*-nto*)
+ case "${target}" in
+ *-*-linux*aout* | *-*-linux*oldld*)
+ ;;
+ *)
+ is_elf=yes
+ ;;
+ esac
+ esac
+
+ if test "$is_elf" = "yes"; then
+ # Check for target supported by gold.
case "${target}" in
- *-*-linux*aout* | *-*-linux*oldld*)
- ;;
- *)
- is_elf=yes
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
+ case "${ENABLE_GOLD}" in
+ both*)
+ configdirs="$configdirs gold"
+ ;;
+ *)
+ configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
+ ;;
+ esac
+ ENABLE_GOLD=yes
;;
esac
+ fi
+ ;;
+ no)
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
esac
- if test "$is_elf" = "yes"; then
- # Check for target supported by gold.
- case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-*)
- configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
- ;;
- esac
- fi
-fi
-
# Configure extra directories which are host specific
case "${host}" in
diff --git a/gold/Makefile.am b/gold/Makefile.am
index e0665e0..a24e185 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -178,12 +178,22 @@ check: libgold.a
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
|| $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi; \
fi
# We want install to imply install-info as per GNU standards, despite
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 6e736f1..13c71ca 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -258,7 +258,9 @@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
+install_as_default = @install_as_default@
install_sh = @install_sh@
+installed_linker = @installed_linker@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -1002,12 +1004,22 @@ check: libgold.a
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
|| $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi; \
fi
# We want install to imply install-info as per GNU standards, despite
diff --git a/gold/configure b/gold/configure
index 20df0df..eb8f01e 100755
--- a/gold/configure
+++ b/gold/configure
@@ -682,6 +682,8 @@ PLUGINS_FALSE
PLUGINS_TRUE
THREADS_FALSE
THREADS_TRUE
+installed_linker
+install_as_default
am__untar
am__tar
AMTAR
@@ -759,6 +761,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_sysroot
+enable_gold
enable_threads
enable_plugins
enable_targets
@@ -1403,6 +1406,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]
--enable-threads multi-threaded linking
--enable-plugins linker plugins
--enable-targets alternative target configurations
@@ -3227,6 +3231,33 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Check whether --enable-gold was given.
+if test "${enable_gold+set}" = set; then :
+ enableval=$enable_gold; case "${enableval}" in
+ yes)
+ install_as_default=gold
+ installed_linker=ld
+ ;;
+ both/gold)
+ install_as_default=yes
+ installed_linker=ld.gold
+ ;;
+ both|both/ld)
+ install_as_default=no
+ installed_linker=ld.gold
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
+ esac
+else
+ install_as_default=gold
+ installed_linker=ld
+fi
+
+
+
+
# Check whether --enable-threads was given.
if test "${enable_threads+set}" = set; then :
enableval=$enable_threads; case "${enableval}" in
diff --git a/gold/configure.ac b/gold/configure.ac
index 72db25d..67d1796 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -38,6 +38,33 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable,
[Whether the system root can be relocated])
+dnl "install_as_default" is true if the linker to be installed as the
+dnl default linker, ld.
+dnl "installed_linker" is the installed gold linker name.
+AC_ARG_ENABLE(gold,
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
+[case "${enableval}" in
+ yes)
+ install_as_default=gold
+ installed_linker=ld
+ ;;
+ both/gold)
+ install_as_default=yes
+ installed_linker=ld.gold
+ ;;
+ both|both/ld)
+ install_as_default=no
+ installed_linker=ld.gold
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_as_default=gold
+ installed_linker=ld])
+AC_SUBST(install_as_default)
+AC_SUBST(installed_linker)
+
dnl For now threads are a configure time option.
AC_ARG_ENABLE([threads],
[ --enable-threads multi-threaded linking],
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 54e9309..9134971 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -95,7 +95,7 @@ CXX_FOR_TARGET = ` \
fi; \
fi`
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
bin_PROGRAMS = ld-new
info_TEXINFOS = ld.texinfo
ld_TEXINFOS = configdoc.texi
@@ -1995,13 +1995,23 @@ CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 spu_ovl.s spu_ovl.o spu_icache.s spu_ica
.PHONY: install-exec-local install-data-local
-install-exec-local: ld-new$(EXEEXT)
+install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
- if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi; \
fi
install-data-local:
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 12c465a..3b53c90 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -155,7 +155,7 @@ CTAGS = ctags
DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
DIST_SUBDIRS = $(SUBDIRS)
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -295,7 +295,9 @@ host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
+install_as_default = @install_as_default@
install_sh = @install_sh@
+installed_linker = @installed_linker@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -3320,13 +3322,23 @@ mostlyclean-local:
.PHONY: install-exec-local install-data-local
-install-exec-local: ld-new$(EXEEXT)
+install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
- if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
- rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ n=`echo $(installed_linker) | sed '$(transform)'`; \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
+ fi; \
+ if test "x$(install_as_default)" = "xyes"; then \
+ rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ if test "$(bindir)" != "$(tooldir)/bin"; then \
+ rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
+ fi; \
fi
install-data-local:
diff --git a/ld/configure b/ld/configure
index 1fa0395..ed3da98 100755
--- a/ld/configure
+++ b/ld/configure
@@ -657,6 +657,8 @@ WARN_CFLAGS
EGREP
GREP
CPP
+installed_linker
+install_as_default
TARGET_SYSTEM_ROOT_DEFINE
TARGET_SYSTEM_ROOT
use_sysroot
@@ -761,6 +763,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_gold
enable_got
enable_werror
enable_build_warnings
@@ -1409,6 +1412,7 @@ Optional Features:
(and sometimes confusing) to the casual installer
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
--enable-werror treat compile warnings as errors
@@ -4164,6 +4168,29 @@ fi
+# Check whether --enable-gold was given.
+if test "${enable_gold+set}" = set; then :
+ enableval=$enable_gold; case "${enableval}" in
+ yes|both/gold)
+ install_as_default=no
+ installed_linker=ld.bfd
+ ;;
+ both|both/ld)
+ install_as_default=yes
+ installed_linker=ld.bfd
+ ;;
+ *)
+ as_fn_error "invalid --enable-gold argument" "$LINENO" 5
+ ;;
+ esac
+else
+ install_as_default=ld
+ installed_linker=ld
+fi
+
+
+
+
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
enableval=$enable_got; case "${enableval}" in
@@ -11587,7 +11614,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11590 "configure"
+#line 11617 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11693,7 +11720,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11696 "configure"
+#line 11723 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/ld/configure.in b/ld/configure.in
index 2abfba4..90baeca 100644
--- a/ld/configure.in
+++ b/ld/configure.in
@@ -69,6 +69,29 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+dnl Use --enable-gold to decide if this linker should be the default.
+dnl "install_as_default" is set to false if gold is the default linker.
+dnl "installed_linker" is the installed BFD linker name.
+AC_ARG_ENABLE(gold,
+[[ --enable-gold[=ARG] build gold [ARG={both}[/{gold,ld}]]]],
+[case "${enableval}" in
+ yes|both/gold)
+ install_as_default=no
+ installed_linker=ld.bfd
+ ;;
+ both|both/ld)
+ install_as_default=yes
+ installed_linker=ld.bfd
+ ;;
+ *)
+ AC_MSG_ERROR([invalid --enable-gold argument])
+ ;;
+ esac],
+[install_as_default=ld
+ installed_linker=ld])
+AC_SUBST(install_as_default)
+AC_SUBST(installed_linker)
+
AC_ARG_ENABLE([got],
AS_HELP_STRING([--enable-got=<type>],
[GOT handling scheme (target, single, negative, multigot)]),
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-19 18:17 ` H.J. Lu
@ 2010-04-27 14:36 ` Nick Clifton
2010-04-27 17:50 ` H.J. Lu
0 siblings, 1 reply; 44+ messages in thread
From: Nick Clifton @ 2010-04-27 14:36 UTC (permalink / raw)
To: H.J. Lu; +Cc: Ralf Wildenhues, gcc-patches, binutils, ian
Hi H.J.
> Only this part of the patch above:
>
> 2010-04-19 Roland McGrath <roland@redhat.com>
> H.J. Lu <hongjiu.lu@intel.com>
>
> * configure.ac (--enable-gold): Support both, both/gold and
> both/bfd to add gold to configdirs without removing ld.
> * configure: Regenerated.
>
> * Makefile.def: Add install-gold dependency to install-ld.
> * Makefile.in: Regenerated.
>
> changes gcc source tree and it has no impact on gcc configuration. I
> am not sure if any gcc maintainers care about this change. Ian
> has no objection:
Right - I have checked in the binutils part of the patch and I will
check in the top level changes shortly.
Cheers
Nick
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-04-27 14:36 ` Nick Clifton
@ 2010-04-27 17:50 ` H.J. Lu
0 siblings, 0 replies; 44+ messages in thread
From: H.J. Lu @ 2010-04-27 17:50 UTC (permalink / raw)
To: Nick Clifton; +Cc: Ralf Wildenhues, gcc-patches, binutils, ian
[-- Attachment #1: Type: text/plain, Size: 939 bytes --]
On Tue, Apr 27, 2010 at 7:28 AM, Nick Clifton <nickc@redhat.com> wrote:
> Hi H.J.
>
>> Only this part of the patch above:
>>
>> 2010-04-19 Roland McGrath <roland@redhat.com>
>> H.J. Lu <hongjiu.lu@intel.com>
>>
>> * configure.ac (--enable-gold): Support both, both/gold and
>> both/bfd to add gold to configdirs without removing ld.
>> * configure: Regenerated.
>>
>> * Makefile.def: Add install-gold dependency to install-ld.
>> * Makefile.in: Regenerated.
>>
>> changes gcc source tree and it has no impact on gcc configuration. I
>> am not sure if any gcc maintainers care about this change. Ian
>> has no objection:
>
> Right - I have checked in the binutils part of the patch and I will check in
> the top level changes shortly.
>
> Cheers
> Nick
>
Hi Nick,
I am checking in this patch to properly install gold/ld as default
cross linker.
--
H.J.
[-- Attachment #2: binutils-cross-1.patch --]
[-- Type: text/plain, Size: 5233 bytes --]
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 714998b..979901f 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,4 +1,10 @@
2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (install-exec-local): Properly install gold as
+ default cross linker.
+ * Makefile.in: Regenerated.
+
+2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.ac (install_as_default): Define and set to false
diff --git a/gold/Makefile.am b/gold/Makefile.am
index a24e185..df5e66c 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -186,9 +186,10 @@ install-exec-local: ld-new$(EXEEXT)
|| $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
fi; \
if test "x$(install_as_default)" = "xyes"; then \
- rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 13c71ca..2fc2eca 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -1012,9 +1012,10 @@ install-exec-local: ld-new$(EXEEXT)
|| $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
fi; \
if test "x$(install_as_default)" = "xyes"; then \
- rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 36559b2..ad61f05 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,4 +1,10 @@
2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (install-exec-local): Properly install ld as
+ default cross linker.
+ * Makefile.in: Regenerated.
+
+2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
Nick Clifton <nickc@redhat.com>
* configure.in (install_as_default): Define and set to true
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 9134971..3896fda 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -2004,9 +2004,10 @@ install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
|| $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
fi; \
if test "x$(install_as_default)" = "xyes"; then \
- rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 3b53c90..4c2f2bf 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -3331,9 +3331,10 @@ install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
|| $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
fi; \
if test "x$(install_as_default)" = "xyes"; then \
- rm -f $(DESTDIR)$(bindir)/ld$(EXEEXT); \
- ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT) >/dev/null 2>/dev/null \
- || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/ld$(EXEEXT); \
+ ld=`echo ld | sed '$(transform)'`; \
+ rm -f $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
+ ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
+ || $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2011-03-08 19:53 ` Diego Novillo
2011-03-15 11:52 ` Nick Clifton
@ 2011-03-15 18:22 ` Matthias Klose
1 sibling, 0 replies; 44+ messages in thread
From: Matthias Klose @ 2011-03-15 18:22 UTC (permalink / raw)
To: Diego Novillo; +Cc: Nick Clifton, Raymes Khoury, hjl.tools, gcc-patches
On 08.03.2011 20:52, Diego Novillo wrote:
> On Tue, Aug 17, 2010 at 04:58, Nick Clifton <nickc@redhat.com> wrote:
>> Hi Raymes,
>>
>>> What is the status of this patch? I see the binutils part applied but
>>> not the gcc part.
>>>
>>> http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00402.html
>>
>> Mark Mitchell recently posted a review of the patch and it is currently in
>> my queue of things to look at. Unfortunately I have a few other, higher
>> priority tasks on my plate at the moment. But I will get back to the patch
>> as soon as I can.
>>
>> Cheers
>> Nick
>>
>>
> Hey Nick,
>
> Any news on this patch? :) We may be interested in using it.
I had updated it for the trunk, current state is (only) posted at
http://sourceware.org/ml/binutils/2011-01/msg00287.html
There is some interaction with the linker plugin options.
Matthias
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2011-03-08 19:53 ` Diego Novillo
@ 2011-03-15 11:52 ` Nick Clifton
2011-03-15 18:22 ` Matthias Klose
1 sibling, 0 replies; 44+ messages in thread
From: Nick Clifton @ 2011-03-15 11:52 UTC (permalink / raw)
To: Diego Novillo; +Cc: Raymes Khoury, hjl.tools, gcc-patches
Hi Diego,
> Any news on this patch? :) We may be interested in using it.
(Sorry for the delay in replying - I am backed up at the moment).
The patch is stalled at the moment :-( I would love to push it forward,
but I just do not have the time right now. I do intend to come back to
it, but I just cannot say when that will be. Sorry.
Cheers
Nick
PS. If you want to take over the patch and push it forward, please do...
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-08-17 9:27 ` Nick Clifton
@ 2011-03-08 19:53 ` Diego Novillo
2011-03-15 11:52 ` Nick Clifton
2011-03-15 18:22 ` Matthias Klose
0 siblings, 2 replies; 44+ messages in thread
From: Diego Novillo @ 2011-03-08 19:53 UTC (permalink / raw)
To: Nick Clifton; +Cc: Raymes Khoury, hjl.tools, gcc-patches
On Tue, Aug 17, 2010 at 04:58, Nick Clifton <nickc@redhat.com> wrote:
> Hi Raymes,
>
>> What is the status of this patch? I see the binutils part applied but
>> not the gcc part.
>>
>> http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00402.html
>
> Mark Mitchell recently posted a review of the patch and it is currently in
> my queue of things to look at. Unfortunately I have a few other, higher
> priority tasks on my plate at the moment. But I will get back to the patch
> as soon as I can.
>
> Cheers
> Nick
>
>
Hey Nick,
Any news on this patch? :) We may be interested in using it.
Thanks. Diego.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
2010-08-12 18:19 ` Raymes Khoury
@ 2010-08-17 9:27 ` Nick Clifton
2011-03-08 19:53 ` Diego Novillo
0 siblings, 1 reply; 44+ messages in thread
From: Nick Clifton @ 2010-08-17 9:27 UTC (permalink / raw)
To: Raymes Khoury; +Cc: hjl.tools, gcc-patches
Hi Raymes,
> What is the status of this patch? I see the binutils part applied but
> not the gcc part.
>
> http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00402.html
Mark Mitchell recently posted a review of the patch and it is currently
in my queue of things to look at. Unfortunately I have a few other,
higher priority tasks on my plate at the moment. But I will get back to
the patch as soon as I can.
Cheers
Nick
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: RFA/RFC: Enable both gold and ld in a single toolchain
[not found] <AANLkTiktR5Baeiy6hyHKZy0qLiGDyDEd+m2km+5Me1P0@mail.gmail.com>
@ 2010-08-12 18:19 ` Raymes Khoury
2010-08-17 9:27 ` Nick Clifton
0 siblings, 1 reply; 44+ messages in thread
From: Raymes Khoury @ 2010-08-12 18:19 UTC (permalink / raw)
To: nickc, hjl.tools; +Cc: gcc-patches
What is the status of this patch? I see the binutils part applied but
not the gcc part.
http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00402.html
Thanks,
Raymes
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2011-03-15 18:22 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 19:26 RFA/RFC: Enable both gold and ld in a single toolchain Nick Clifton
2010-03-04 20:47 ` H.J. Lu
2010-03-09 10:09 ` Nick Clifton
2010-03-09 13:54 ` Matthias Klose
2010-03-11 7:41 ` Ryan Hill
2010-03-11 14:53 ` Nick Clifton
2010-03-11 15:07 ` H.J. Lu
2010-03-16 17:34 ` Nick Clifton
2010-03-16 17:49 ` H.J. Lu
2010-03-16 17:56 ` Nick Clifton
2010-03-16 17:59 ` H.J. Lu
2010-03-17 8:55 ` Nick Clifton
2010-03-17 13:54 ` H.J. Lu
2010-03-16 18:40 ` Vladimir Simonov
2010-03-17 8:37 ` Nick Clifton
2010-03-17 8:58 ` Steven Bosscher
2010-03-17 13:24 ` Vladimir Simonov
2010-03-18 3:13 ` Ian Lance Taylor
2010-03-17 16:27 ` H.J. Lu
2010-03-21 15:09 ` Matthias Klose
2010-03-22 1:14 ` Matthias Klose
2010-03-31 15:31 ` Daniel Jacobowitz
2010-03-31 15:51 ` H.J. Lu
2010-04-09 8:46 ` Nick Clifton
2010-04-09 16:31 ` Matthias Klose
2010-04-09 16:37 ` H.J. Lu
2010-04-09 16:48 ` H.J. Lu
2010-04-09 17:45 ` H.J. Lu
2010-04-09 18:52 ` Ralf Wildenhues
2010-04-09 21:10 ` H.J. Lu
2010-04-10 4:07 ` H.J. Lu
2010-04-19 18:17 ` H.J. Lu
2010-04-27 14:36 ` Nick Clifton
2010-04-27 17:50 ` H.J. Lu
2010-03-09 14:10 ` H.J. Lu
2010-03-09 15:08 ` Richard Guenther
2010-03-05 1:05 ` Ralf Wildenhues
[not found] ` <20100304205859.GE22496__42407.8206219294$1267753343$gmane$org@gmx.de>
2010-03-05 10:06 ` Andreas Schwab
2010-03-09 17:13 ` Paolo Bonzini
[not found] <AANLkTiktR5Baeiy6hyHKZy0qLiGDyDEd+m2km+5Me1P0@mail.gmail.com>
2010-08-12 18:19 ` Raymes Khoury
2010-08-17 9:27 ` Nick Clifton
2011-03-08 19:53 ` Diego Novillo
2011-03-15 11:52 ` Nick Clifton
2011-03-15 18:22 ` Matthias Klose
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).