This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Remove dependency on libiberty from libbfd.so.


On Fri, Oct 19, 2001 at 01:55:31PM -0400, DJ Delorie wrote:
> 
> > I have applications which want to dlopen libbfd.so.
> 
> Could libbfd.so be built with a static libiberty.a, so it
> automatically has the right stuff in it?
> 
> I'm just thinking that the list of needed objects varies depending on
> platform, so hardcoding *any* list is going to be wrong for someone.

How about this patch?


H.J.
-----
2001-10-19  H.J. Lu <hjl@gnu.org>

	* Makefile.am (libbfd_la_LIBADD): Add -L../libiberty/pic -liberty
	if ../libiberty/pic/libiberty.a exists.
	* Makefile.in: Rebuild.

	* Makefile.in ($(TARGETLIB)): Also generate pic/$(TARGETLIB) if
	necessary.

--- binutils-2.11.92.0.7/bfd/Makefile.am.liberty	Thu Oct 18 19:44:50 2001
+++ binutils-2.11.92.0.7/bfd/Makefile.am	Fri Oct 19 11:34:58 2001
@@ -558,7 +558,17 @@ ofiles: stamp-ofiles ; @true
 
 libbfd_la_SOURCES = $(BFD_LIBS_CFILES)
 libbfd_la_DEPENDENCIES = $(OFILES) ofiles
-libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
+# We cannot use
+#
+#	if [ -f ../libiberty/pic/libiberty.a ]; then
+#
+# since automake will say
+#
+# Makefile.am:x: you cannot use linker flags such as `-f' in `libbfd_la_LIBADD'
+#
+libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@ \
+  `if cat ../libiberty/pic/libiberty.a > /dev/null 2>&1; then \
+     echo "-L../libiberty/pic -liberty"; else true; fi`
 libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
 
 # libtool will build .libs/libbfd.a.  We create libbfd.a in the build
--- binutils-2.11.92.0.7/libiberty/Makefile.in.liberty	Fri Oct 19 11:00:27 2001
+++ binutils-2.11.92.0.7/libiberty/Makefile.in	Fri Oct 19 11:06:35 2001
@@ -155,10 +155,17 @@ CONFIGURED_OFILES = asprintf.o atexit.o 
 	vsprintf.o waitpid.o
 
 $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
-	-rm -f $(TARGETLIB)
+	-rm -f $(TARGETLIB) pic/$(TARGETLIB)
 	$(AR) $(AR_FLAGS) $(TARGETLIB) \
 	  $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
 	$(RANLIB) $(TARGETLIB)
+	if [ x"$(PICFLAG)" != x ]; then \
+	  cd pic; \
+	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
+	   $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+	   $(RANLIB) $(TARGETLIB); \
+	   cd ..; \
+	else true; fi
 
 info: libiberty.info info-subdir
 install-info: install-info-subdir


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]