This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: work around libtool to fix alpha libgcj build
On Fri, Feb 11, 2005 at 03:31:16PM -0200, Alexandre Oliva wrote:
> We probably can. I just have no idea of how to accomplish this with
> automake. Basically, you want to add --tag=disable-static before (or
> right after) --tag={CC,CXX,GCJ} --mode=compile.
Which, for some reason, causes -DPIC to suddenly appear on the java
compile line. Which is wrong, of course. Did I do something silly?
r~
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 12 Feb 2005 19:50:17 -0000
@@ -144,6 +144,18 @@ GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8
GCJLINK = $(LIBTOOL) --tag=GCJ --mode=link $(GCJ) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
LIBLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXX) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
+# Add --tag=disable-static to each of the libtool compile patterns.
+# This avoids building both pic and non-pic objects when, because of
+# the convenience libraries, we'll only be using the pic objects anyway.
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=disable-static \
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=disable-static \
+ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTGCJCOMPILE = $(LIBTOOL) --mode=compile --tag=disable-static \
+ $(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)
+
JAVAC = $(GCJ_WITH_FLAGS) -C
GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@
@@ -211,7 +223,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 +236,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 +256,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)