RFA/RFC: Enable both gold and ld in a single toolchain
H.J. Lu
hjl.tools@gmail.com
Fri Apr 9 17:45:00 GMT 2010
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.
-------------- next part --------------
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)]),
More information about the Binutils
mailing list