This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] --enable-gold=both
- From: Roland McGrath <roland at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 15 Oct 2009 17:35:14 -0700 (PDT)
- Subject: [PATCH] --enable-gold=both
This lets you configure with --enable-gold=both to build both ld and gold.
It installs them as "ld.bfd" and "ld.gold" respectively, making "ld" a
symlink to ld.bfd. This is a good fit for e.g. packaging for systems using
the "alternatives" mechanism to switch /usr/bin/ld between the two at will.
(Changes to generated files omitted.)
Thanks,
Roland
2009-10-15 Roland McGrath <roland@redhat.com>
* configure.ac (--enable-gold): Accept --enable-gold=both to
add gold to configdirs without removing ld.
* configure: Regenerated.
gold/
2009-10-15 Roland McGrath <roland@redhat.com>
* configure.ac (ld_name): New substituted variable.
Under --enable-gold=both, set it to ld.gold, else to ld.
* configure: Regenerated.
* Makefile.am (install-exec-local): Use @ld_name@.
* Makefile.in: Regenerated.
ld/
2009-10-15 Roland McGrath <roland@redhat.com>
* configure.ac (ld_name): New substituted variable.
Under --enable-gold, set it to ld.bfd, else to ld.
* configure: Regenerated.
* Makefile.am (transform): Use @ld_name@.
(install-exec-local): Likewise.
If it's not ld, install an ld symlink to it.
* Makefile.in: Regenerated.
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/configure.ac,v
retrieving revision 1.85
diff -u -r1.85 configure.ac
--- configure.ac 13 Oct 2009 03:32:18 -0000 1.85
+++ configure.ac 16 Oct 2009 00:29:10 -0000
@@ -314,7 +314,8 @@
[ --enable-gold use gold instead of ld],
ENABLE_GOLD=$enableval,
ENABLE_GOLD=no)
-if test "${ENABLE_GOLD}" = "yes"; then
+case "${ENABLE_GOLD}" in
+yes|both)
# Check for ELF target.
is_elf=no
case "${target}" in
@@ -334,11 +335,17 @@
# 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
-fi
+ ENABLE_GOLD=yes
+ ;;
+esac
# Configure extra directories which are host specific
Index: gold/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/Makefile.am,v
retrieving revision 1.53
diff -u -r1.53 Makefile.am
--- gold/Makefile.am 24 Aug 2009 05:55:55 -0000 1.53
+++ gold/Makefile.am 16 Oct 2009 00:29:10 -0000
@@ -163,7 +163,7 @@
install-exec-local: ld-new$(EXEEXT)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo @ld_name@ | sed '$(transform)'`; \
$(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
if test "$(bindir)" != "$(tooldir)/bin"; then \
rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
Index: gold/configure.ac
===================================================================
RCS file: /cvs/src/src/gold/configure.ac,v
retrieving revision 1.48
diff -u -r1.48 configure.ac
--- gold/configure.ac 9 Oct 2009 23:20:44 -0000 1.48
+++ gold/configure.ac 16 Oct 2009 00:29:10 -0000
@@ -38,6 +38,13 @@
AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable,
[Whether the system root can be relocated])
+ld_name=ld
+AC_ARG_ENABLE(gold,
+[ --enable-gold building BFD ld too, install as ld.gold],
+[test "x${enableval}" != xboth || ld_name=ld.gold])
+AC_SUBST(ld_name)
+
+
dnl For now threads are a configure time option.
AC_ARG_ENABLE([threads],
[ --enable-threads multi-threaded linking],
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.275
diff -u -r1.275 Makefile.am
--- ld/Makefile.am 29 Sep 2009 14:17:16 -0000 1.275
+++ ld/Makefile.am 16 Oct 2009 00:29:10 -0000
@@ -95,7 +95,7 @@
fi; \
fi`
-transform = s/^ld-new$$/ld/;@program_transform_name@
+transform = s/^ld-new$$/@ld_name@/;$(program_transform_name)
bin_PROGRAMS = ld-new
info_TEXINFOS = ld.texinfo
ld_TEXINFOS = configdoc.texi
@@ -1961,8 +1961,11 @@
.PHONY: install-exec-local install-data-local
install-exec-local: ld-new$(EXEEXT)
+ [ @ld_name@ = ld ] || \
+ (cd $(DESTDIR)/$(bindir) && \
+ $(LN_S) -f @ld_name@ `echo ld | sed '$(transform)'`)
$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
- n=`echo ld | sed '$(transform)'`; \
+ n=`echo @ld_name@ | 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 \
Index: ld/configure.in
===================================================================
RCS file: /cvs/src/src/ld/configure.in,v
retrieving revision 1.60
diff -u -r1.60 configure.in
--- ld/configure.in 22 Aug 2009 17:59:33 -0000 1.60
+++ ld/configure.in 16 Oct 2009 00:29:10 -0000
@@ -69,6 +69,14 @@
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+ld_name=ld
+AC_ARG_ENABLE(gold,
+[ --enable-gold building gold too, install as ld.bfd],
+[case "${enableval}" in
+ yes|both) ld_name=ld.bfd
+esac])dnl
+AC_SUBST(ld_name)
+
AC_ARG_ENABLE([got],
AS_HELP_STRING([--enable-got=<type>],
[GOT handling scheme (target, single, negative, multigot)]),