libbfd.so, libopcodes.so and --enable-commonbfdlib

Alan Modra amodra@bigpond.net.au
Fri Jan 16 08:01:00 GMT 2009


--enable-commonbfdlib hasn't done anything for a long time.  This
patch removes the option, but restores some of its functionality in
that pic libiberty functions are included in libbfd.so and
libopcodes.so.  We already did that for Linux libbfd.so, but there's
no real reason to restrict this to Linux.

There is a real saving with including libiberty in libbfd.so and
libopcodes.so.  If you don't do so, every app linking against
libbfd.so needs to statically link in all the libiberty functions
called by libbfd, whether or not the app uses them itself or in fact
calls the libbfd functions that require libiberty.  Ditto for
libopcodes.so.

Referencing the libiberty Makefile from opcodes/configure means we need
to let the top level make know about it, or make -k might break.

	* Makefile.def (configure-opcodes): Depend on configure-libiberty.
	* Makefile.def (all-opcodes): Depend on all-libiberty.
	* Makefile.in: Regenerate.
bfd/
	* Makefile.am (libbfd_la_LIBADD, libbfd_la_LDFLAGS): Substitute
	SHARED_LIBADD and SHARED_LDFLAGS rather than WIN32LIBADD, WIN32LDFLAGS.
	* configure.in (commonbfdlib): Delete.
	(SHARED_LDFLAGS): Rename from WIN32LDFLAGS/
	(SHARED_LIBADD): Rename from WIN32LIBADD.  Add pic libiberty if such
	is available, not just for linux.
	* po/SRC-POTFILES.in: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
opcodes/
	* configure.in (commonbfdlib): Delete.
	(SHARED_LIBADD): Add pic libiberty if such is available.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
binutils/
	* configure.in (commonbfdlib): Delete.
	* configure: Regenerate.
gas/
	* configure.in (commonbfdlib): Delete.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.

Index: Makefile.def
===================================================================
RCS file: /cvs/src/src/Makefile.def,v
retrieving revision 1.96
diff -u -p -r1.96 Makefile.def
--- Makefile.def	2 Dec 2008 16:43:06 -0000	1.96
+++ Makefile.def	16 Jan 2009 03:27:12 -0000
@@ -357,6 +357,8 @@ dependencies = { module=configure-bfd; o
 dependencies = { module=configure-bfd; on=configure-intl; };
 dependencies = { module=all-bfd; on=all-libiberty; };
 dependencies = { module=all-bfd; on=all-intl; };
+dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; };
+dependencies = { module=all-opcodes; on=all-libiberty; };
 
 dependencies = { module=configure-binutils; on=configure-intl; };
 dependencies = { module=all-binutils; on=all-libiberty; };
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.216
diff -u -p -r1.216 Makefile.am
--- bfd/Makefile.am	23 Dec 2008 19:10:18 -0000	1.216
+++ bfd/Makefile.am	15 Jan 2009 23:06:46 -0000
@@ -767,8 +767,8 @@ ofiles: stamp-ofiles ; @true
 # libbfd_la_SOURCES, we put BFD64_LIBS in OFILES instead.
 libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
 libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
-libbfd_la_LDFLAGS = -release `cat libtool-soversion` @WIN32LDFLAGS@
+libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@
+libbfd_la_LDFLAGS = -release `cat libtool-soversion` @SHARED_LDFLAGS@
 
 # libtool will build .libs/libbfd.a.  We create libbfd.a in the build
 # directory so that we don't have to convert all the programs that use
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.251
diff -u -p -r1.251 configure.in
--- bfd/configure.in	23 Dec 2008 19:10:18 -0000	1.251
+++ bfd/configure.in	15 Jan 2009 23:07:08 -0000
@@ -60,14 +60,6 @@ AC_ARG_ENABLE(targets,
   *)        enable_targets=$enableval ;;
 esac])dnl
 
-AC_ARG_ENABLE(commonbfdlib,
-[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
-[case "${enableval}" in
-  yes) commonbfdlib=true ;;
-  no)  commonbfdlib=false ;;
-  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
-esac])dnl
-
 AC_ARG_WITH(mmap,
 [  --with-mmap             try using mmap for BFD input files if available],
 [case "${withval}" in
@@ -502,29 +494,31 @@ if test -n "$TRAD_HEADER"; then
     [Name of host specific header file to include in trad-core.c.])
 fi
 
-# Horrible hacks to build DLLs on Windows.
-WIN32LDFLAGS=
-WIN32LIBADD=
-case "${host}" in
-*-*-cygwin*)
-  if test "$enable_shared" = "yes"; then
-    WIN32LDFLAGS="-no-undefined"
-    WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
-  fi
-  ;;
-*-*-linux*)
-  # We borrow WIN32LIBADD so that the shared libbfd won't depend on
-  # libiberty.a.
+# When building a shared libbfd, link against the pic version of libiberty
+# so that apps that use libbfd won't need libiberty just to satisfy any
+# libbfd references.
+# We can't do that if a pic libiberty is unavailable since including non-pic
+# code would insert text relocations into libbfd.
+SHARED_LIBADD=
+SHARED_LDFLAGS=
+if test "$enable_shared" = "yes"; then
 changequote(,)dnl
   x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
 changequote([,])dnl
   if test -n "$x"; then
-    WIN32LIBADD="-L../libiberty/pic -liberty"
+    SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
   fi
+
+# More hacks to build DLLs on Windows.
+  case "${host}" in
+  *-*-cygwin*)
+    SHARED_LDFLAGS="-no-undefined"
+    SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
   ;;
-esac
-AC_SUBST(WIN32LDFLAGS)
-AC_SUBST(WIN32LIBADD)
+  esac
+fi
+AC_SUBST(SHARED_LDFLAGS)
+AC_SUBST(SHARED_LIBADD)
 
 # target stuff:
 
Index: bfd/po/SRC-POTFILES.in
===================================================================
RCS file: /cvs/src/src/bfd/po/SRC-POTFILES.in,v
retrieving revision 1.47
diff -u -p -r1.47 SRC-POTFILES.in
--- bfd/po/SRC-POTFILES.in	4 Aug 2008 06:55:31 -0000	1.47
+++ bfd/po/SRC-POTFILES.in	15 Jan 2009 23:07:35 -0000
@@ -86,6 +86,7 @@ cpu-i960.c
 cpu-ia64.c
 cpu-ip2k.c
 cpu-iq2000.c
+cpu-lm32.c
 cpu-m10200.c
 cpu-m10300.c
 cpu-m32c.c
@@ -174,6 +175,7 @@ elf32-i860.c
 elf32-i960.c
 elf32-ip2k.c
 elf32-iq2000.c
+elf32-lm32.c
 elf32-m32c.c
 elf32-m32r.c
 elf32-m68hc11.c
Index: binutils/configure.in
===================================================================
RCS file: /cvs/src/src/binutils/configure.in,v
retrieving revision 1.89
diff -u -p -r1.89 configure.in
--- binutils/configure.in	31 Oct 2008 02:52:14 -0000	1.89
+++ binutils/configure.in	15 Jan 2009 23:07:52 -0000
@@ -26,13 +26,6 @@ AC_ARG_ENABLE(targets,
   no)       enable_targets= ;;
   *)        enable_targets=$enableval ;;
 esac])dnl
-AC_ARG_ENABLE(commonbfdlib,
-[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
-[case "${enableval}" in
-  yes) commonbfdlib=true ;;
-  no)  commonbfdlib=false ;;
-  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
-esac])dnl
 
 AM_BINUTILS_WARNINGS
 		   
Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.209
diff -u -p -r1.209 configure.in
--- gas/configure.in	23 Dec 2008 19:10:20 -0000	1.209
+++ gas/configure.in	15 Jan 2009 23:08:10 -0000
@@ -37,14 +37,6 @@ AC_ARG_ENABLE(targets,
   *)	    enable_targets=$enableval ;;
 esac])dnl
 
-AC_ARG_ENABLE(commonbfdlib,
-[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
-[case "${enableval}" in
-  yes) commonbfdlib=true ;;
-  no)  commonbfdlib=false ;;
-  *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
-esac])dnl
-
 ac_checking=yes
 if grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then
   ac_checking=
Index: gas/po/POTFILES.in
===================================================================
RCS file: /cvs/src/src/gas/po/POTFILES.in,v
retrieving revision 1.41
diff -u -p -r1.41 POTFILES.in
--- gas/po/POTFILES.in	4 Aug 2008 06:55:32 -0000	1.41
+++ gas/po/POTFILES.in	15 Jan 2009 23:08:18 -0000
@@ -75,6 +75,8 @@ config/tc-ip2k.c
 config/tc-ip2k.h
 config/tc-iq2000.c
 config/tc-iq2000.h
+config/tc-lm32.c
+config/tc-lm32.h
 config/tc-m32c.c
 config/tc-m32c.h
 config/tc-m32r.c
@@ -172,6 +174,7 @@ config/te-pc532mach.h
 config/te-pe.h
 config/te-psos.h
 config/te-riscix.h
+config/te-solaris.h
 config/te-sparcaout.h
 config/te-sun3.h
 config/te-svr4.h
Index: opcodes/configure.in
===================================================================
RCS file: /cvs/src/src/opcodes/configure.in,v
retrieving revision 1.86
diff -u -p -r1.86 configure.in
--- opcodes/configure.in	23 Dec 2008 19:10:25 -0000	1.86
+++ opcodes/configure.in	15 Jan 2009 23:08:53 -0000
@@ -40,13 +40,6 @@ AC_ARG_ENABLE(targets,
   no)       enable_targets= ;;
   *)        enable_targets=$enableval ;;
 esac])dnl
-AC_ARG_ENABLE(commonbfdlib,
-[  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
-[case "${enableval}" in
-  yes) commonbfdlib=true ;;
-  no)  commonbfdlib=false ;;
-  *)   AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
-esac])dnl
 
 AM_BINUTILS_WARNINGS
 
@@ -103,26 +96,37 @@ SHARED_LDFLAGS=
 SHARED_LIBADD=
 SHARED_DEPENDENCIES=
 if test "$enable_shared" = "yes"; then
+# When building a shared libopcodes, link against the pic version of libiberty
+# so that apps that use libopcodes won't need libiberty just to satisfy any
+# libopcodes references.
+# We can't do that if a pic libiberty is unavailable since including non-pic
+# code would insert text relocations into libopcodes.
+# Note that linking against libbfd as we do here, which is itself linked
+# against libiberty, may not satisfy all the libopcodes libiberty references
+# since libbfd may not pull in the entirety of libiberty.
+changequote(,)dnl
+  x=`sed -n -e 's/^[ 	]*PICFLAG[ 	]*=[ 	]*//p' < ../libiberty/Makefile | sed -n '$p'`
+changequote([,])dnl
+  if test -n "$x"; then
+    SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
+  fi
+
   case "${host}" in
     *-*-cygwin*)
       SHARED_LDFLAGS="-no-undefined"
       SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
       ;;
    *-*-darwin*)
-     SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib"
+     SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"
      SHARED_DEPENDENCIES="../bfd/libbfd.la"
      ;;
     *)
       case "$host_vendor" in
         hp)
-          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl"
+          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
 	  ;;
 	*)
-	  # It is tempting to include libiberty here as well, but
-	  # that library is only built as a static version.
-	  # Including it here would insert text relocations into
-	  # the opcodes library, which is undesirable.
-          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so"
+          SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
 	  ;;
       esac
       SHARED_DEPENDENCIES="../bfd/libbfd.la"
Index: opcodes/po/POTFILES.in
===================================================================
RCS file: /cvs/src/src/opcodes/po/POTFILES.in,v
retrieving revision 1.43
diff -u -p -r1.43 POTFILES.in
--- opcodes/po/POTFILES.in	4 Aug 2008 06:55:31 -0000	1.43
+++ opcodes/po/POTFILES.in	15 Jan 2009 23:09:09 -0000
@@ -80,6 +80,14 @@ iq2000-dis.c
 iq2000-ibld.c
 iq2000-opc.c
 iq2000-opc.h
+lm32-asm.c
+lm32-desc.c
+lm32-desc.h
+lm32-dis.c
+lm32-ibld.c
+lm32-opc.c
+lm32-opc.h
+lm32-opinst.c
 m10200-dis.c
 m10200-opc.c
 m10300-dis.c

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list