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]

[ecj] Patch: FYI: build tweak for libgcj


I'm checking this in on the gcj-eclipse branch.

This patch is a big hack.  It avoids compiling Object and Class with
the rest of java.lang.  Without this, "something" goes wrong and at
runtime some entries in Class' vtable are NULL.  I investigated for a
while; it seems to have something to do with the hidden alias entries.

I didn't want to block on this so I patched around it by compiling
Object and Class separately.  Surprisingly, this seemed to fix things.
I thought I'd check it in so others can benefit from it.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* sources.am, Makefile.in: Rebuilt.
	* Makefile.am (libgcj_la_LIBADD): Add Object.lo and Class.lo.
	(java/lang/Object.lo): New target.
	(java/lang/Class.lo): Likewise.
	* scripts/makemake.tcl (emit_package_rule): Add special case for
	Object and Class.

Index: scripts/makemake.tcl
===================================================================
--- scripts/makemake.tcl	(revision 114379)
+++ scripts/makemake.tcl	(working copy)
@@ -268,10 +268,17 @@
   set lname $base.list
   set dname $base.deps
 
+  # A special case due to an apparent compiler bug.
+  if {$pkgname == "java/lang"} {
+    set omit "| tr ' ' '\\n' | fgrep -v Object.class | fgrep -v Class.class "
+  } else {
+    set omit ""
+  }
+
   # A rule to make the phony file we are going to compile.
   puts "$lname: \$($varname)"
   puts "\t@\$(mkinstalldirs) \$(dir \$@)"
-  puts "\techo classpath/lib/$package/*.class > $lname"
+  puts "\techo classpath/lib/$package/*.class $omit> $lname"
   puts ""
   puts "-include $dname"
   puts ""
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 114450)
+++ Makefile.am	(working copy)
@@ -226,6 +226,8 @@
 	-version-info `grep -v '^\#' $(srcdir)/libtool-version`
 libgcj_la_LIBADD = \
 	classpath/native/fdlibm/libfdlibm.la \
+	java/lang/Object.lo \
+	java/lang/Class.lo \
 	$(all_packages_source_files:.list=.lo) \
 	$(bc_objects) \
 	$(propertyo_files) \
@@ -324,6 +326,12 @@
 %.lo: %.list
 	$(LTGCJCOMPILE) -c -o $@ -MT $@ -MD -MP -MF $(basename $@).deps @$<
 
+java/lang/Object.lo: classpath/lib/java/lang/Object.class
+	$(LTGCJCOMPILE) -c -o $@ $<
+
+java/lang/Class.lo: classpath/lib/java/lang/Class.class
+	$(LTGCJCOMPILE) -c -o $@ $<
+
 ## ################################################################
 
 ## This pulls in a number of variable and target definitions.


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