On Tue, Jan 5, 2010 at 8:23 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Tue, Jan 5, 2010 at 11:08 AM, Ian Lance Taylor <i...@google.com> wrote: >> "H.J. Lu" <hjl.to...@gmail.com> writes: > >> >>> diff --git a/configure.ac b/configure.ac >>> index 407ab59..b349633 100644 >>> --- a/configure.ac >>> +++ b/configure.ac >>> @@ -311,10 +311,11 @@ esac >>> # Handle --enable-gold. >>> >>> AC_ARG_ENABLE(gold, >>> -[ --enable-gold use gold instead of ld], >>> +[ --enable-gold[[=ARG]] build gold [[ARG={yes,both}]]], >>> 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 @@ if test "${ENABLE_GOLD}" = "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 /'`" >>> + 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 >> >> You should have an error case here to ensure that --enable-gold only >> has the values "yes", "both", or "no". --enable-gold=foo should give >> an error. >> >> This patch uses two configure options: one to build both gold and ld, >> and one to select which linker is the default. Why not use just one >> configure option? Perhaps something like: >> --enable-gold Build only gold, gold is default >> --disable-gold [default] Build only GNU ld, GNU ld is default >> --enable-gold=no Same >> --enable-gold=both Build both gold and GNU ld, gold is default >> --enable-gold=both/gold Same >> --enable-gold=both/bfd Build both gold and GNU ld, GNU ld is default > > Done. > >> But of course this approach is conditional on whether there should be >> some way to select the linker to use at runtime. >> >> >> >>> diff --git a/gold/Makefile.am b/gold/Makefile.am >>> index 8d8b617..85b103b 100644 >>> --- a/gold/Makefile.am >>> +++ b/gold/Makefile.am >>> @@ -163,12 +163,20 @@ 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 \ >>> + if test "@linker@" = "ld.gold"; then \ >>> + if test "@installed_linker@" != "ld"; 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); \ >>> + fi; \ >>> + 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 >> >> In Makefile.am you don't need to use @@ quoting in rules. You can >> just use $(installed_linker) and $(linker). >> > > Done. > >> >>> diff --git a/gold/configure.ac b/gold/configure.ac >>> index 85e23f9..10389a9 100644 >>> --- a/gold/configure.ac >>> +++ b/gold/configure.ac >>> @@ -38,6 +38,29 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot", >>> AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable, >>> [Whether the system root can be relocated]) >>> >>> +AC_ARG_ENABLE(gold, >>> +[ --enable-gold[[=ARG]] build gold [[ARG={yes,both}]]], >>> +[if test "${enableval}" = "both"; then >>> + bfd_linker=ld.bfd >>> + installed_linker=ld.gold >>> + else >>> + bfd_linker=ld.gold >>> + installed_linker=ld >>> + fi], >>> +[bfd_linker=ld.bfd >>> + installed_linker=ld]) >>> +AC_SUBST(installed_linker) >> >> It seems rather weird to set a variable named bfd_linker to be >> ld.gold. What does that mean? > > Rewritten. > >> >>> +AC_ARG_ENABLE(linker, >>> +[ --enable-linker=[[ARG]] specify the default linker >>> [[ARG={bfd,gold}]]], >>> +[if test "${enableval}" = "gold"; then >>> + linker=ld.gold >>> + else >>> + linker=$bfd_linker >>> + fi], >>> +[linker=$bfd_linker]) >>> +AC_SUBST(linker) >> >> You should give an error if --enable-linker is used with an >> unrecognized value. > > Done. > >> >>> --- 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 >> >> $(installed_linker). Although actually as far as I can tell this line >> is completely unnecessary. Only constant strings are passed to >> $(transform), and those constant strings never include ld-new. >> > > I'd like to keep it in this patch. We can have a separate patch to remove it. > >>> -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 "@linker@" = "ld.bfd"; then \ >>> + if test "@installed_linker@" != "ld"; 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); \ >>> + fi; \ >>> + if test "$(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); \ >>> + fi; \ >>> fi >> >> Here also use $(VAR) rather than @v...@. > > Done. > >> >>> diff --git a/ld/configure.in b/ld/configure.in >>> index c4655f5..9786953 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) >>> >>> +AC_ARG_ENABLE(gold, >>> +[ --enable-gold[[=ARG]] build gold [[ARG={yes,both}]]], >>> +[if test "${enableval}" = "both"; then >>> + gold_linker=ld.gold >>> + installed_linker=ld.bfd >>> +else >>> + gold_linker=ld.bfd >>> + installed_linker=ld >>> +fi], >>> +[gold_linker=ld.bfd >>> + installed_linker=ld]) >>> +AC_SUBST(installed_linker) >> >> How can gold_linker be set to ld.bfd? >> > > Rewritten. > > Thanks. > > > -- > H.J. > --- > 2010-01-05 Roland McGrath <rol...@redhat.com> > H.J. Lu <hongjiu...@intel.com> > > * configure.ac (--enable-gold): Support both, both/gold and > both/bfd to add gold to configdirs without removing ld. > * configure: Regenerated. > > gold/ > > 2010-01-05 H.J. Lu <hongjiu...@intel.com> > > * Makefile.am (install-exec-local): Install as $(installed_linker). > Install as ld if $(linker) == "ld.gold" and $(installed_linker) > != "ld". > * Makefile.in: Regenerated. > > * configure.ac (--enable-gold): Support both, both/gold and > both/bfd. > * configure: Regenerated. > > ld/ > > 2010-01-05 H.J. Lu <hongjiu...@intel.com> > > * Makefile.am (transform): Install as $(installed_linker). > (install-exec-local): Depend on install-binPROGRAMS. Install > as $(installed_linker). Install as ld if $(linker) == "ld.bfd" > and $(installed_linker) != "ld". > * Makefile.in: Regenerated. > > * configure.in (--enable-gold): Support both, both/gold and > both/bfd. > * configure: Regenerated. >
Here is the updated patch to set ENABLE_GOLD to yes only if target is supported. Any comments? Thanks. -- H.J.
2010-01-05 Roland McGrath <rol...@redhat.com> H.J. Lu <hongjiu...@intel.com> * configure.ac (--enable-gold): Support both, both/gold and both/bfd to add gold to configdirs without removing ld. * configure: Regenerated. gold/ 2010-01-05 H.J. Lu <hongjiu...@intel.com> * Makefile.am (install-exec-local): Install as $(installed_linker). Install as ld if $(linker) == "ld.gold" and $(installed_linker) != "ld". * Makefile.in: Regenerated. * configure.ac (--enable-gold): Support both, both/gold and both/bfd. * configure: Regenerated. ld/ 2010-01-05 H.J. Lu <hongjiu...@intel.com> * Makefile.am (transform): Install as $(installed_linker). (install-exec-local): Depend on install-binPROGRAMS. Install as $(installed_linker). Install as ld if $(linker) == "ld.bfd" and $(installed_linker) != "ld". * Makefile.in: Regenerated. * configure.in (--enable-gold): Support both, both/gold and both/bfd. * configure: Regenerated. diff --git a/configure b/configure index 9aa4685..1946a2c 100755 --- a/configure +++ b/configure @@ -1482,7 +1482,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,bfd}]]] --enable-libada build libada directory --enable-libssp build libssp directory --enable-build-with-cxx build with C++ compiler instead of C compiler @@ -3068,6 +3068,12 @@ case ${with_newlib} in esac # Handle --enable-gold. +# --enable-gold Build only gold, gold is default +# --disable-gold [default] Build only GNU ld, GNU ld is default +# --enable-gold=both Build both gold and GNU ld, gold is default +# --enable-gold=both/gold Same +# --enable-gold=both/bfd Build both gold and GNU ld, GNU ld is +# default # Check whether --enable-gold was given. if test "${enable_gold+set}" = set; then : @@ -3076,7 +3082,8 @@ else ENABLE_GOLD=no fi -if test "${ENABLE_GOLD}" = "yes"; then +case "${ENABLE_GOLD}" in +yes|both|both/gold|both/bfd) # Check for ELF target. is_elf=no case "${target}" in @@ -3096,11 +3103,25 @@ if test "${ENABLE_GOLD}" = "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 /'`" + case "${ENABLE_GOLD}" in + both*) + configdirs="$configdirs gold" + ;; + *) + configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`" + ;; + esac + ENABLE_GOLD=yes ;; esac fi -fi + ;; +no) + ;; +*) + as_fn_error "invalid --enable-gold argument" "$LINENO" 5 + ;; +esac # Configure extra directories which are host specific diff --git a/configure.ac b/configure.ac index 596b527..562756f 100644 --- a/configure.ac +++ b/configure.ac @@ -314,12 +314,19 @@ case ${with_newlib} in esac # Handle --enable-gold. +# --enable-gold Build only gold, gold is default +# --disable-gold [default] Build only GNU ld, GNU ld is default +# --enable-gold=both Build both gold and GNU ld, gold is default +# --enable-gold=both/gold Same +# --enable-gold=both/bfd Build both gold and GNU ld, GNU ld is +# default AC_ARG_ENABLE(gold, -[ --enable-gold use gold instead of ld], +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,bfd}]]]]], ENABLE_GOLD=$enableval, ENABLE_GOLD=no) -if test "${ENABLE_GOLD}" = "yes"; then +case "${ENABLE_GOLD}" in +yes|both|both/gold|both/bfd) # Check for ELF target. is_elf=no case "${target}" in @@ -339,11 +346,25 @@ if test "${ENABLE_GOLD}" = "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 /'`" + case "${ENABLE_GOLD}" in + both*) + configdirs="$configdirs gold" + ;; + *) + configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`" + ;; + esac + ENABLE_GOLD=yes ;; esac fi -fi + ;; +no) + ;; +*) + AC_MSG_ERROR([invalid --enable-gold argument]) + ;; +esac # Configure extra directories which are host specific diff --git a/gold/Makefile.am b/gold/Makefile.am index 784f821..552c2b1 100644 --- a/gold/Makefile.am +++ b/gold/Makefile.am @@ -175,12 +175,20 @@ 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 \ + if test "$(linker)" = "ld.gold"; then \ + if test "$(installed_linker)" != "ld"; 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); \ + fi; \ + 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 e118a51..68be5b9 100644 --- a/gold/Makefile.in +++ b/gold/Makefile.in @@ -306,8 +306,10 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +installed_linker = @installed_linker@ libdir = @libdir@ libexecdir = @libexecdir@ +linker = @linker@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -1223,12 +1225,20 @@ 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 \ + if test "$(linker)" = "ld.gold"; then \ + if test "@installed_linke@" != "ld"; 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); \ + fi; \ + 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 4817e44..34d3794 100755 --- a/gold/configure +++ b/gold/configure @@ -682,6 +682,8 @@ PLUGINS_FALSE PLUGINS_TRUE THREADS_FALSE THREADS_TRUE +linker +installed_linker 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,bfd}]]] --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) + installed_linker=ld + linker=ld.gold + ;; + both|both/gold) + installed_linker=ld.gold + linker=ld.gold + ;; + both/bfd) + installed_linker=ld.gold + linker=ld.bfd + ;; + *) + as_fn_error "invalid --enable-gold argument" "$LINENO" 5 + ;; + esac +else + installed_linker=ld + linker=ld.gold +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 7102670..d6b855b 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -38,6 +38,32 @@ AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot", AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable, [Whether the system root can be relocated]) +dnl "installed_linker" is the installed gold linker name. +dnl "linker" is the linker to be installed as the default linker, ld. +AC_ARG_ENABLE(gold, +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,bfd}]]]]], +[case "${enableval}" in + yes) + installed_linker=ld + linker=ld.gold + ;; + both|both/gold) + installed_linker=ld.gold + linker=ld.gold + ;; + both/bfd) + installed_linker=ld.gold + linker=ld.bfd + ;; + *) + AC_MSG_ERROR([invalid --enable-gold argument]) + ;; + esac], +[installed_linker=ld + linker=ld.gold]) +AC_SUBST(installed_linker) +AC_SUBST(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 c1d3dbf..b54d27f 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 @@ -1959,13 +1959,21 @@ 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 "$(linker)" = "ld.bfd"; then \ + if test "$(installed_linker)" != "ld"; 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); \ + fi; \ + if test "$(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); \ + fi; \ fi install-data-local: diff --git a/ld/Makefile.in b/ld/Makefile.in index e7f23d8..af8923a 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@ @@ -296,8 +296,10 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +installed_linker = @installed_linker@ libdir = @libdir@ libexecdir = @libexecdir@ +linker = @linker@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -3276,13 +3278,21 @@ 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 "$(linker)" = "ld.bfd"; then \ + if test "$(installed_linker)" != "ld"; 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); \ + fi; \ + if test "$(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); \ + fi; \ fi install-data-local: diff --git a/ld/configure b/ld/configure index cb89d84..dfaa60c 100755 --- a/ld/configure +++ b/ld/configure @@ -657,6 +657,8 @@ GREP CPP NO_WERROR WARN_CFLAGS +linker +installed_linker 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,bfd}]]] --enable-got=<type> GOT handling scheme (target, single, negative, multigot) --enable-werror treat compile warnings as errors @@ -4164,6 +4168,33 @@ fi +# Check whether --enable-gold was given. +if test "${enable_gold+set}" = set; then : + enableval=$enable_gold; case "${enableval}" in + both|both/gold) + installed_linker=ld.bfd + linker=ld.gold + ;; + both/bfd) + installed_linker=ld.bfd + linker=ld.bfd + ;; + no) + installed_linker=ld + linker=ld.bfd + ;; + *) + as_fn_error "invalid --enable-gold argument" "$LINENO" 5 + ;; + esac +else + installed_linker=ld + linker=ld.bfd +fi + + + + # Check whether --enable-got was given. if test "${enable_got+set}" = set; then : enableval=$enable_got; case "${enableval}" in @@ -11575,7 +11606,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11578 "configure" +#line 11609 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11681,7 +11712,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11684 "configure" +#line 11715 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/ld/configure.in b/ld/configure.in index 4bbc8f8..450fe5d 100644 --- a/ld/configure.in +++ b/ld/configure.in @@ -69,6 +69,32 @@ AC_SUBST(use_sysroot) AC_SUBST(TARGET_SYSTEM_ROOT) AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) +dnl "installed_linker" is the installed BFD linker name. +dnl "linker" is the linker to be installed as the default linker, ld. +AC_ARG_ENABLE(gold, +[ --enable-gold[[=ARG]] build gold [[ARG={both}[[/{gold,bfd}]]]]], +[case "${enableval}" in + both|both/gold) + installed_linker=ld.bfd + linker=ld.gold + ;; + both/bfd) + installed_linker=ld.bfd + linker=ld.bfd + ;; + no) + installed_linker=ld + linker=ld.bfd + ;; + *) + AC_MSG_ERROR([invalid --enable-gold argument]) + ;; + esac], +[installed_linker=ld + linker=ld.bfd]) +AC_SUBST(installed_linker) +AC_SUBST(linker) + AC_ARG_ENABLE([got], AS_HELP_STRING([--enable-got=<type>], [GOT handling scheme (target, single, negative, multigot)]),