From owner-freebsd-hackers Mon Feb 22 11:14:28 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from bubba.whistle.com (s205m7.whistle.com [207.76.205.7]) by hub.freebsd.org (Postfix) with ESMTP id B3D3811607 for ; Mon, 22 Feb 1999 11:14:17 -0800 (PST) (envelope-from archie@whistle.com) Received: (from archie@localhost) by bubba.whistle.com (8.9.2/8.9.2) id LAA76945; Mon, 22 Feb 1999 11:12:05 -0800 (PST) From: Archie Cobbs Message-Id: <199902221912.LAA76945@bubba.whistle.com> Subject: Re: Interesting ld.so bug In-Reply-To: <199902202154.OAA18160@usr08.primenet.com> from Terry Lambert at "Feb 20, 99 09:54:19 pm" To: terry@whistle.com (Terry Lambert) Date: Mon, 22 Feb 1999 11:12:05 -0800 (PST) Cc: jdp@polstra.com, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Terry Lambert writes: > There appears to be a bug with ld.so. The following steps illustrate > the bug: After some further playing around, it seems like it may be a linker problem, or a least a problem in the way we're using it. Here's my test case that reproduces the problem: We compile a shared library "libfoo" containing these source files: bar.c - Containing functions bar1() and bar2(), which are both exported. Function bar1() calls function bar2(). java_jni.c - Java JNI method to interface to function bar1(), call it Java_bar1(). db.c - Other exported routines. The C code in this file uses GDBM routines. NOTE: GDBM routines live in a static library, /usr/local/lib/libgdbm.a. 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! Any ideas about what is going on here? Thanks, -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