Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Feb 1999 11:12:05 -0800 (PST)
From:      Archie Cobbs <archie@whistle.com>
To:        terry@whistle.com (Terry Lambert)
Cc:        jdp@polstra.com, hackers@FreeBSD.ORG
Subject:   Re: Interesting ld.so bug
Message-ID:  <199902221912.LAA76945@bubba.whistle.com>
In-Reply-To: <199902202154.OAA18160@usr08.primenet.com> from Terry Lambert at "Feb 20, 99 09:54:19 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902221912.LAA76945>