Skip ld/lto tests if plugins is disabled for binutils?

Message ID 20140819122857.GG7047@bubble.grove.modra.org
State New, archived
Headers

Commit Message

Alan Modra Aug. 19, 2014, 12:28 p.m. UTC
  On Tue, Aug 19, 2014 at 05:43:26AM +0200, Hans-Peter Nilsson wrote:
> > From: Bin.Cheng <amker.cheng@gmail.com>
> > Date: Tue, 19 Aug 2014 04:28:32 +0200
> 
> > On Fri, Aug 15, 2014 at 11:41 PM, Hans-Peter Nilsson
> > <hans-peter.nilsson@axis.com> wrote:
> > >> From: Hans-Peter Nilsson <hp@axis.com>
> > >> Date: Fri, 15 Aug 2014 17:17:13 +0200
> > >
> > >> I'd rather fix up the broken pieces of "plugin support"
> > >> (just there to pacify bfd's need) that actually *are* in sim
> > >> already and look like they *should* pull in -ldl.  See
> > >> sim/common/{configure.ac,Make-common.in}; I'm looking into it.
> > >
> > > Looks like all that's actually needed is to regenerate
> > > sim/*/configure, for example by means of "make autoconf-common"
> > > in sim. Will do later; no keys here.
> > 
> > Hi Hans-Peter,
> > Any updates about this?  In the meantime, what else can I do except
> > disable plugins/lto through out all toolchain components?  Since we
> > use combined source tree and can't configure binutils and gdb
> > differently.  Thanks very much.
> 
> Roland McGrath committed a re-build of sim/*/config{.in,ure}
> later that day.  I'm guessing you haven't tried since then?
> arm-eabi is fine in my autotester builds (using only --target
> and --prefix options).
> 
> There are a couple of simulators suffering from fallout from the
> regenerated config.in due to older configury bugs
> (e.g. iq2000-elf, frv-elf, m32r-elf and powerpc-eabisim needs
> special treatment), but you didn't mention any others.

I'm about to commit the following to clean up my mess.  Adding -ldl in
AC_PLUGINS fixes the current --disable-shared breakage.  It's not
strictly necessary to add -ldl in directories that use libtool to link
libbfd, eg. binutils, since libtool magically picks up libbfd
dependencies (libbfd.la dependency_libs shell variable).  However,
invoking AC_SEARCH_LIBS in AC_PLUGINS has the benefit that it only
needs doing in one place.

bfd/
	* configure: Regenerate.
binutils/
	* configure: Regenerate.
config/
	* plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
	LIBS via AC_SEARCH_LIBS.
gas/
	* configure: Regenerate.
gdb/
	* acinclude.m4 (GDB_AC_CHECK_BFD): Don't add -ldl.
	* config.in: Regenerate.
	* configure: Regenerate.
gprof/
	* configure: Regenerate.
ld/
	* configure: Regenerate.
sim/arm/
	* configure: Regenerate.
sim/avr/
	* configure: Regenerate.
sim/bfin/
	* configure: Regenerate.
sim/common/
	* configure: Regenerate.
sim/cr16/
	* configure: Regenerate.
sim/cris/
	* configure: Regenerate.
sim/d10v/
	* configure: Regenerate.
sim/erc32/
	* configure: Regenerate.
sim/frv/
	* configure: Regenerate.
sim/h8300/
	* configure: Regenerate.
sim/iq2000/
	* configure: Regenerate.
sim/lm32/
	* configure: Regenerate.
sim/m32c/
	* configure: Regenerate.
sim/m32r/
	* configure: Regenerate.
sim/m68hc11/
	* configure: Regenerate.
sim/mcore/
	* configure: Regenerate.
sim/microblaze/
	* configure: Regenerate.
sim/mips/
	* configure: Regenerate.
sim/mn10300/
	* configure: Regenerate.
sim/moxie/
	* configure: Regenerate.
sim/msp430/
	* configure: Regenerate.
sim/ppc/
	* configure.ac: Invoke AC_PLUGINS.
	* configure: Regenerate.
	* config.in: Regenerate.
sim/rl78/
	* configure: Regenerate.
sim/rx/
	* configure: Regenerate.
sim/sh/
	* configure: Regenerate.
sim/sh64/
	* configure: Regenerate.
sim/v850/
	* configure: Regenerate.
  

Patch

diff --git a/config/plugins.m4 b/config/plugins.m4
index f65fdcb..513c690 100644
--- a/config/plugins.m4
+++ b/config/plugins.m4
@@ -15,4 +15,7 @@  AC_DEFUN([AC_PLUGINS],
      esac],
     [plugins=$maybe_plugins]
   )
+  if test "$plugins" = "yes"; then
+    AC_SEARCH_LIBS([dlopen], [dl])
+  fi
 ])
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index a3fb9e2..2b46f73 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -458,10 +458,6 @@  AC_DEFUN([GDB_AC_CHECK_BFD], [
   CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
   LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
   intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
-  # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
-  if test "$plugins" = "yes"; then
-    AC_SEARCH_LIBS(dlopen, dl)
-  fi
   LIBS="-lbfd -liberty $intl $LIBS"
   AC_CACHE_CHECK([$1], [$2],
   [AC_TRY_LINK(
diff --git a/gdb/config.in b/gdb/config.in
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 9c3fa54..f1a7e06 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -670,6 +670,9 @@  AC_ARG_PROGRAM
 # using the same condition.
 AM_ZLIB
 
+# BFD uses libdl when when plugins enabled.
+AC_PLUGINS
+
 . ${srcdir}/../../bfd/configure.host
 
 case ${host} in