Date: Mon, 22 Feb 1999 20:10:54 -0800 (PST) From: Archie Cobbs <archie@whistle.com> To: jdp@polstra.com (John Polstra) Cc: hackers@FreeBSD.ORG, terry@whistle.com Subject: Re: Interesting ld.so bug Message-ID: <199902230410.UAA72778@bubba.whistle.com> In-Reply-To: <XFMail.990222194002.jdp@polstra.com> from John Polstra at "Feb 22, 99 07:40:02 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
John Polstra writes: > > Now when we run a java class that uses the java_jni.c native method, > > the call to Java_bar1() succeeds, and the call from there to bar1() > > succeeds, but when bar1() tries to call bar2(), it jumps to a very > > low address and segfaults. It seems that the bar2() trampoline is > > using an uninitialized base address or whatever. > > > > NOW, if we remove "db.c" from the compilation of "libfoo.so", > > then everything works! > > Was the code in the static libgdbm.a library compiled with -fpic? > I bet it wasn't, and that's probably the problem. All code that's > included in a shared library should be PIC code. Actually, now something else is going on.. here's some more info: With db.c Without db.c --------- ------------ RTLD_LAZY fails works! RTLD_NOW fails fails Terry thinks there is a screwup in RTLD_NOW in that it's failing to recurse. Example of failure without db.c: Program received signal SIGSEGV, Segmentation fault. 0x337a in ?? () (gdb) bt #0 0x337a in ?? () #1 0x286a3879 in Java_Locat_IjGetLanguage (env=0x280db038, clazz=0x818ef30) at java_locat.c:82 #2 0x816acf0 in ?? () #3 0x81cc49d in ?? () Example of failure with db.c: Program received signal SIGSEGV, Segmentation fault. 0x3192 in ?? () (gdb) bt #0 0x3192 in ?? () #1 0x816acf0 in ?? () #2 0x81cc49d in ?? () Java_Locat_IjGetLanguage is the native routine, and it's trying to call another routine in the same shared library and dieing. It looks like the fixup for the second routine (which is also exported) is not being done for some reason. However, this can be worked around by adding this to the build of the library (discoverd by Amancio): -export-dynamic -lgdbm -lc Any ideas on what's going on? -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902230410.UAA72778>