This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
work around libtool to fix alpha libgcj build
- From: Richard Henderson <rth at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Thu, 10 Feb 2005 20:14:10 -0800
- Subject: work around libtool to fix alpha libgcj build
The problem is that we've just added one too many files to libgcj,
which caused us to exceed the command line length limit, which
caused libtool to use ld -r to do piecewise linking.
Which breaks on Alpha and MIPS (first, anyway; I might guess based
on the extant relocations that ppc64 isn't totally immune), because
now we exceed the number of got entries per object file. If all the
objects are fed to the linker separately, then the linker can create
multiple got sections and cope. Presenting the linker one large
object file breaks.
Now, libtool does know about the --whole-archive switch, but it
only knows how to use it for convenience libraries. So that's what
I've done -- moved the entire library to a convenience library.
The drawback is that now libgcj.a, the static library, is built
with -fPIC. I mentioned this to tromey on irc, and he thought that
while it was unfortunate, it'd be ok. That the embedded folk already
hack up their sources, so this is just one more thing they can fix
up locally.
Tested on alpha-linux.
Ok?
r~
* Makefile.am (libgcj_la_SOURCES): Move all contents ...
(libgcj0_convenience_la_SOURCES): ... here.
libgcj_la_SOURCES.
(noinst_LTLIBRARIES): New.
(libgcj_la_LIBADD): Add libgcj0_convenience.la.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.442
diff -u -p -d -r1.442 Makefile.am
--- Makefile.am 7 Feb 2005 20:19:58 -0000 1.442
+++ Makefile.am 11 Feb 2005 04:03:21 -0000
@@ -211,7 +211,11 @@ libgij_la_LIBADD = -L$(here)/.libs libgc
libgij_la_LDFLAGS = -rpath $(toolexeclibdir) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LIBGCJ_LD_SYMBOLIC)
-libgcj_la_SOURCES = prims.cc jni.cc exception.cc \
+# Work around libtool wanting to do piece-wise linking with -r. Using a
+# convenience library suddenly invokes the --whole-archive path instead.
+# This allows the build to succeed for targets that allocate multiple got
+# subsections in the linker, such as Alpha and MIPS.
+libgcj0_convenience_la_SOURCES = prims.cc jni.cc exception.cc \
link.cc defineclass.cc interpret.cc verify.cc \
$(nat_source_files) $(math_c_source_files) $(java_source_files) \
$(gnu_xml_source_files) $(built_java_source_files) \
@@ -220,6 +224,9 @@ libgcj_la_SOURCES = prims.cc jni.cc exce
$(POSIX_PLATFORM_SRC) $(WIN32_PLATFORM_SRC) $(ECOS_PLATFORM_SRC) \
$(DARWIN_CRT_SRC) \
$(POSIX_THREAD_SRC) $(WIN32_THREAD_SRC) $(NO_THREAD_SRC)
+noinst_LTLIBRARIES = libgcj0_convenience.la
+
+libgcj_la_SOURCES =
libgcj_la_DEPENDENCIES = libgcj-@gcc_version@.jar \
java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h \
$(LIBLTDL) $(LIBFFI) $(ZLIBS) $(GCLIBS) $(propertyo_files)
@@ -237,6 +244,7 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclib
libgcj_la_LIBADD = \
external/sax/libsax_convenience.la \
external/w3c_dom/libw3c_convenience.la \
+ libgcj0_convenience.la \
$(LIBFFI) $(ZLIBS) $(GCLIBS) $(propertyo_files)
libgcj_la_LINK = $(LIBLINK)