[lto-plugin, build] Don't link libiberty.a into liblto-plugin.a

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Tue Dec 14 19:36:00 GMT 2010


When trying a mainline bootstrap on Solaris 11/x86 with a debug version
of the Sun binutils, I ran into an assertion failure building the static
liblto-plugin.a:

$ ar cr .libs/liblto_plugin.a ../libiberty/pic/libiberty.a  lto-plugin.o
Assertion failed: !is_elf || (pad(lseek(fd, 0, SEEK_CUR), PADSZ) == 0), file ../common/file.c, line 726, function write_member_header
Abort

While the assertion failure won't show in a production version and the
condition has since been fixed to avoid it even in a debug version, it
seems clear that embedding an archive inside another archive doesn't
make any sense.

The following patch fixed the issue for me by avoiding to pass .a files
directly to libtool, but instead using the appropriate combination of -L
and -l.  It allowed my bootstraps to finish.

Going forward, this current mixture of libtool and non-libtool libraries
seems like a total mess to me.  Instead, it seems better to change
libiberty to use libtool itself.  This would certainly simplify the
Makefile.in (even if not going to automake at the same time), but this
is clearly not stage3 material and would need careful coordination with
other projects in src.

Any thoughts on the patch below and a possible libiberty conversion?

Thanks.

	Rainer


2010-12-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* Makefile.am (liblto_plugin_la_DEPENDENCIES): Define.
	(liblto_plugin_la_LIBADD): Use -L../libiberty/pic -liberty.
	(liblto_plugin_la_LDFLAGS): Use -L../libiberty -liberty.
	* Makefile.in: Regenerate.

diff -r f6168cd5e1fe lto-plugin/Makefile.am
--- a/lto-plugin/Makefile.am	Fri Dec 10 19:55:31 2010 +0100
+++ b/lto-plugin/Makefile.am	Sat Dec 11 01:31:27 2010 +0100
@@ -13,11 +13,13 @@
 libexecsub_LTLIBRARIES = liblto_plugin.la
 
 liblto_plugin_la_SOURCES = lto-plugin.c
+liblto_plugin_la_DEPENDENCIES = \
+	$(if $(wildcard ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
 liblto_plugin_la_LIBADD = \
-	$(if $(wildcard ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
+	$(if $(wildcard ../libiberty/pic/libiberty.a),-L../libiberty/pic -liberty,)
 # Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
 liblto_plugin_la_LDFLAGS = $(lt_host_flags) -bindir $(libexecsubdir) \
-	$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a)
+	$(if $(wildcard ../libiberty/pic/libiberty.a),,-L../libiberty -liberty)
 
 all: copy_lto_plugin
 

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



More information about the Gcc-patches mailing list