This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't link ecj1 against libgcj.so.* (PR libgcj/38396, take 2)


On Thu, Dec 18, 2008 at 06:05:40PM +0100, Paolo Bonzini wrote:
> > But when we are already touching this...
> > It is true that for !ENABLE_SHARED USE_LIBGCJ_BC doesn't make any sense.
> > Perhaps we should disable USE_LIBGCJ_BC if !ENABLE_SHARED during configury.
> > 
> > Still, I guess we should avoid -lgcj_bc for -static, so perhaps
> > if "$enable_shared" != yes; then
> >   use_libgcj_bc=no
> > fi
> 
> This could go in configure.host too:
> 
>  case "${host}" in
>    *linux*|*-kfreebsd*-gnu|*-gnu*)
> -    use_libgcj_bc=yes
> +    use_libgcj_bc=$enable_shared
>    ;;
>    *)
>      use_libgcj_bc=no
>    ;;
>  esac

It can't, because configure.host is sourced before enable_shared
is tweaked.

> > if test "$use_libgcj_bc" = yes; then
> >   LIBGCJ_SPEC="%{s-bc-abi:%{static:-lgcj;:-lgcj_bc};:-lgcj}"
> > fi
> 
> And I agree on this too.  If it fixes the bug, it would indeed be a
> better fix.

Without the patch (with DESTDIR=/tmp/libjava_test installed gcj):
$ /tmp/libjava_test/usr/local/bin/gcj -o HelloWorld HelloWorld.java -fmain=HelloWorld -findirect-dispatch -static
$ ./HelloWorld
libgcj error: This is libgcj_bc.so, a fake library used only for linking.
Please create a symlink from libgcj_bc.so.1 to the real libgcj.so.
$ /tmp/libjava_test/usr/local/bin/gcj -o HelloWorld HelloWorld.java -fmain=HelloWorld -findirect-dispatch -static-libgcj
$ ./HelloWorld
libgcj error: This is libgcj_bc.so, a fake library used only for linking.
Please create a symlink from libgcj_bc.so.1 to the real libgcj.so.

Here is an updated patch that handles this as well.

Ok for trunk/4.3?

2008-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR libgcj/38396
	* configure.ac (use_libgcj_bc): Set to no if not enable_shared.
	(LIBGCJ_SPEC): Use -lgcj instead of -lgcj_bc even for -static
	or -static-libgcj.
	* Makefile.am (ecjx_SOURCES): Add ecjx.cc.
	(ecjx_LDADD): Don't add libgcj.la when
	NATIVE && USE_LIBBGCJ_BC.
	* ecjx.cc: New file.
	* Makefile.in: Regenerated.
	* configure: Regenerated.

--- libjava/configure.ac.jj	2008-12-04 23:00:27.000000000 +0100
+++ libjava/configure.ac	2008-12-19 12:31:59.000000000 +0100
@@ -1046,6 +1046,9 @@ AC_SUBST(THREADCXXFLAGS)
 AM_CONDITIONAL(USING_POSIX_THREADS, test "$THREADS" = posix)
 AM_CONDITIONAL(USING_WIN32_THREADS, test "$THREADS" = win32)
 AM_CONDITIONAL(USING_NO_THREADS, test "$THREADS" = none)
+if test "$enable_shared" != yes; then
+  use_libgcj_bc=no
+fi
 AM_CONDITIONAL(USE_LIBGCJ_BC, test "$use_libgcj_bc" = yes)
 
 if test -d sysdep; then true; else mkdir sysdep; fi
@@ -1055,7 +1058,7 @@ AC_CONFIG_LINKS(sysdep/descriptor.h:$des
 
 LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
 if test "$use_libgcj_bc" = yes; then
-  LIBGCJ_SPEC="%{s-bc-abi:-lgcj_bc;:-lgcj}"
+  LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:-lgcj;:-lgcj_bc}"
 fi
 AC_SUBST(LIBGCJ_SPEC)
 
--- libjava/ecjx.cc.jj	2008-12-19 09:34:28.000000000 +0100
+++ libjava/ecjx.cc	2008-12-19 09:34:28.000000000 +0100
@@ -0,0 +1 @@
+// Dummy
--- libjava/Makefile.am.jj	2008-12-18 15:40:32.000000000 +0100
+++ libjava/Makefile.am	2008-12-19 12:33:09.000000000 +0100
@@ -868,7 +868,7 @@ gij_LDADD = -L$(here)/.libs libgij.la
 gij_DEPENDENCIES = libgij.la
 
 ## Build an ecjx from a .jar.
-ecjx_SOURCES =
+ecjx_SOURCES = ecjx.cc
 ## We use the BC ABI here so that we don't need to compile ecj.jar.
 ## Hopefully the user has compiled it into his system .db.
 ## However, even if not it will run reasonably quickly.
@@ -888,10 +888,12 @@ else !ENABLE_SHARED
 ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR) -fbootclasspath=$(BOOTCLASSPATH)
 endif !ENABLE_SHARED
 
-ecjx_LDADD = -L$(here)/.libs libgcj.la
+ecjx_LDADD = -L$(here)/.libs
 ecjx_DEPENDENCIES = libgcj.la libgcj.spec
 if USE_LIBGCJ_BC
 ecjx_DEPENDENCIES += libgcj_bc.la
+else
+ecjx_LDADD += libgcj.la
 endif
 
 else !NATIVE
--- libjava/Makefile.in.jj	2008-12-18 15:40:32.000000000 +0100
+++ libjava/Makefile.in	2008-12-19 12:33:20.000000000 +0100
@@ -76,7 +76,8 @@ DIST_COMMON = README $(am__configure_dep
 	$(top_srcdir)/scripts/jar.in COPYING ChangeLog NEWS THANKS
 @MAINTAINER_MODE_TRUE@@NATIVE_TRUE@am__append_19 = gen-from-JIS
 @NATIVE_TRUE@@USE_LIBGCJ_BC_TRUE@am__append_20 = libgcj_bc.la
-@XLIB_AWT_TRUE@am__append_21 = $(xlib_nat_headers)
+@NATIVE_TRUE@@USE_LIBGCJ_BC_FALSE@am__append_21 = libgcj.la
+@XLIB_AWT_TRUE@am__append_22 = $(xlib_nat_headers)
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/libltdl/acinclude.m4 \
@@ -467,8 +468,9 @@ libexecsubPROGRAMS_INSTALL = $(INSTALL_P
 @MAINTAINER_MODE_TRUE@@NATIVE_TRUE@am__EXEEXT_4 =  \
 @MAINTAINER_MODE_TRUE@@NATIVE_TRUE@	gen-from-JIS$(EXEEXT)
 PROGRAMS = $(bin_PROGRAMS) $(libexecsub_PROGRAMS) $(noinst_PROGRAMS)
-am_ecjx_OBJECTS =
+am_ecjx_OBJECTS = ecjx.$(OBJEXT)
 ecjx_OBJECTS = $(am_ecjx_OBJECTS)
+@NATIVE_TRUE@@USE_LIBGCJ_BC_FALSE@am__DEPENDENCIES_6 = libgcj.la
 am_gappletviewer_OBJECTS =
 gappletviewer_OBJECTS = $(am_gappletviewer_OBJECTS)
 am_gc_analyze_OBJECTS =
@@ -8343,7 +8345,7 @@ gij_LDFLAGS = -rpath $(dbexecdir) -rpath
 gij_LINK = $(GCJLINK)
 gij_LDADD = -L$(here)/.libs libgij.la
 gij_DEPENDENCIES = libgij.la
-ecjx_SOURCES = 
+ecjx_SOURCES = ecjx.cc
 ECJX_BASE_FLAGS = -findirect-dispatch \
 	--main=org.eclipse.jdt.internal.compiler.batch.GCCMain
 
@@ -8353,7 +8355,7 @@ ECJX_BASE_FLAGS = -findirect-dispatch \
 @ENABLE_SHARED_TRUE@@NATIVE_TRUE@ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) -Djava.class.path=$(ECJ_JAR)
 @NATIVE_FALSE@ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR)
 @NATIVE_FALSE@ecjx_LDADD = 
-@NATIVE_TRUE@ecjx_LDADD = -L$(here)/.libs libgcj.la
+@NATIVE_TRUE@ecjx_LDADD = -L$(here)/.libs $(am__append_21)
 @NATIVE_FALSE@ecjx_DEPENDENCIES = 
 @NATIVE_TRUE@ecjx_DEPENDENCIES = libgcj.la libgcj.spec \
 @NATIVE_TRUE@	$(am__append_20)
@@ -8572,7 +8574,7 @@ gnu/gcj/xlib/natXImage.cc \
 gnu/gcj/xlib/natXUnmapEvent.cc
 
 sourcesdir = $(jardir)
-headers_to_make = $(nat_headers) $(am__append_21)
+headers_to_make = $(nat_headers) $(am__append_22)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
@@ -9554,6 +9556,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boehm.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darwin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defineclass.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecjx.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gij.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interpret.Plo@am__quote@
--- libjava/configure.jj	2008-12-18 21:45:36.000000000 +0100
+++ libjava/configure	2008-12-19 12:32:13.000000000 +0100
@@ -20903,6 +20903,9 @@ else
   USING_NO_THREADS_FALSE=
 fi
 
+if test "$enable_shared" != yes; then
+  use_libgcj_bc=no
+fi
 
 
 if test "$use_libgcj_bc" = yes; then
@@ -20924,7 +20927,7 @@ if test -d sysdep; then true; else mkdir
 
 LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
 if test "$use_libgcj_bc" = yes; then
-  LIBGCJ_SPEC="%{s-bc-abi:-lgcj_bc;:-lgcj}"
+  LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:-lgcj;:-lgcj_bc}"
 fi
 
 


	Jakub


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