[Bug libgcj/13708] java program crashes at startup, UTF-8 environment
mec dot gnu at mindspring dot com
gcc-bugzilla@gcc.gnu.org
Sat Jan 17 10:11:00 GMT 2004
------- Additional Comments From mec dot gnu at mindspring dot com 2004-01-17 10:11 -------
Subject: Re: java program crashes at startup, UTF-8 environment
Some more info:
Did I mention that I configure my toolchains with --disable-shared?
I bet that's why I encountered the bug and nobody else has.
Try building gcc HEAD with "--disable-shared". Or just use a normal
toolchain and build the Java executable with "-static". Both ways
produce the segfault for me.
It appears that the initialization procedure is different for
shared libraries versus unshared archive libraries.
Also, I date-searched the regression to this patch:
2004-01-14 Nathan Bryant <nbryant@optonline.net>
Tom Tromey <tromey@redhat.com>
PR libgcj/12001:
* gnu/gcj/runtime/VMClassLoader.java (VMClassLoader): Pass empty
array to superclass.
(init): Changed interface; add URLs here.
(initialize): New static method.
* prims.cc (_Jv_CreateJavaVM): Initialize ClassLoader here...
(_Jv_RunMain): ... not here.
This matches the stack backtraces and the gdb traces that I saw:
VMClassLoader.getSystemClassLoader calls System.getProperty
class initialization for System constructs three standard PrintStream's.
java.io.PrintStream.PrintStream calls Unicode stuff
Unicode stuff wants to use a class loader
Have a look at _Jv_FindClass. _Jv_FindClass calls _Jv_FindClassInCache,
which returns a non-null klass if the class has been "loaded"
or "initiated". With a shared library, I suspect that all the classes
are getting "loaded" or "initiated" at the same time; with a static
library, the class "gnu.gcj.convertOutput_UTF8" is definitely not
"loaded" and not "initiated". I don't know the meanings of "loaded"
and "initiated" so I can't say more than that.
Anyways, link the program with "-static", and be sure to run with
LANG=en_US.UTF-8, and you ought to see the segfault in _Jv_FindClass.
Michael C
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13708
More information about the Gcc-bugs
mailing list