This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: JNI on ARM/XScale
On Mon, 27 Sep 2004, Bryce McKinlay wrote:
> Jari Korva wrote:
> >Is anyone using JNI on ARM/XScale successfully? I've tried a simple JNI
> >HelloWorld both on armv5l (dynamically linked, gcj 3.4.0) and armv5b
> >(statically linked, gcc 3.4.1 & 3.4.2), but got the following error:
> >
> ># ./hello
> >Exception in thread "main" java.lang.UnsatisfiedLinkError: ??E@:?.so:
> >cannot open shared object file: No such file or directory
>
> You'll have to investigate with gdb to diagnose this problem further. Is
> the filename for the shared library being passed to dlopen() correct?
> Looks like an invalid string pointer has got in there somehow.
Thanks! The filename seems to get corrupted already before dlopen:
-----
void
java::lang::Runtime::_load (jstring path, jboolean do_search)
...
lt_dlhandle h;
// FIXME: make sure path is absolute.
{
// Synchronize on java.lang.Class. This is to protect the class chain
from
// concurrent modification by class registration calls which may be
run
// during the dlopen().
JvSynchronize sync (&java::lang::Class::class$);
h = do_search ? lt_dlopenext (lib_name) : lt_dlopen (lib_name);
}
...
-----
The value of lib_name is "libhello" before call to JvSynchronize and
corrupted afterwards. Here is the backtrace to location where the
problem occured:
#0 _Jv_MonitorEnter (obj=0xbffff8e4) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/java/lang/natObject.cc:249
#1 0x0001f170 in java::lang::Runtime::_load (this=0x2afc00,
path=0x304a50, do_search=1 '\001') at cni.h:104
#2 0x0002c770 in java.lang.Runtime.loadLibrary(java.lang.String)
(this=0x2afc00, libname=0x304a50) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/java/lang/Runtime.java:651
#3 0x00031304 in java.lang.System.loadLibrary(java.lang.String)
(libname=0x304a50) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/java/lang/System.java:556
#4 0x00008348 in HelloWorld.<clinit>() ()
#5 0x0001d0b8 in java::lang::Class::initializeClass (this=0x1ce0a8) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/java/lang/natClass.cc:808
#6 0x0001d780 in _Jv_InitClass (klass=0x1cea84) at Class.h:279
#7 0x000082c8 in HelloWorld.main(java.lang.String[]) ()
#8 0x0007b204 in gnu::gcj::runtime::FirstThread::call_main
(this=0x2b3150) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/gnu/gcj/runtime/natFirstThread.cc:47
#9 0x0004f684 in gnu.gcj.runtime.FirstThread.run() (this=0x2b3150) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/gnu/gcj/runtime/FirstThread.java:54
#10 0x00023020 in _Jv_ThreadRun (thread=0x2b3150) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/java/lang/natThread.cc:293
#11 0x00009ac8 in _Jv_RunMain (klass=0x1ce0a8, name=0x0, argc=1,
argv=0xbffffd84, is_jar=false) at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/prims.cc:1016
#12 0x00009b94 in JvRunMain (klass=0x1cea84, argc=-1073743000, argv=0x3)
at
/wrk/arm-linux/crosstool-0.28-rc32/build/armv5b-softfloat-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/libjava/prims.cc:1026
#13 0x000081f4 in main ()