This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: RFC: libgcj_bc addition
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: 22 Aug 2006 17:36:44 -0600
- Subject: Patch: RFC: libgcj_bc addition
- Reply-to: tromey at redhat dot com
Bryce pointed out that code like 'new int[5]' will refer to
_Jv_intClass, pulling in libgcj.so even when linking with
-findirect-dispatch -- i.e., not what we want. This appears to be the
cause of PR 28698 as well.
He had sent a patch privately which changed link.cc to special case
things like 'int' ('I' is not doable for other reasons...) -- but I
think this is incorrect, as I don't think there's a VM prohibition
against naming a class 'int'.
This patch works around the problem by declaring these symbols in
libgcj_bc.c.
I'm a little surprised this works -- I would have expected that
something (ld? ld.so?), would want the objects to have the proper
size. However, this doesn't seem to be the case.
Jakub, can you comment on the advisability of this approach?
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
PR libgcj/28698:
* libgcj_bc.c (DECLARE_PRIM_TYPE): New macro. Declare primitive
classes.
Index: libgcj_bc.c
===================================================================
--- libgcj_bc.c (revision 116312)
+++ libgcj_bc.c (working copy)
@@ -92,3 +92,19 @@
void _Jv_AttachCurrentThread () {}
void _Jv_AttachCurrentThreadAsDaemon () {}
void _Jv_DetachCurrentThread () {}
+
+
+/* Classes for primitive types. */
+
+#define DECLARE_PRIM_TYPE(NAME) \
+ int _Jv_##NAME##Class;
+
+DECLARE_PRIM_TYPE(byte)
+DECLARE_PRIM_TYPE(short)
+DECLARE_PRIM_TYPE(int)
+DECLARE_PRIM_TYPE(long)
+DECLARE_PRIM_TYPE(boolean)
+DECLARE_PRIM_TYPE(char)
+DECLARE_PRIM_TYPE(float)
+DECLARE_PRIM_TYPE(double)
+DECLARE_PRIM_TYPE(void)