Date: Sun, 3 May 1998 10:29:46 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: jb@cimlogic.com.au (John Birrell) Cc: bde@zeta.org.au, jb@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: errno change breaks old shared library linkage Message-ID: <199805031029.DAA26301@usr08.primenet.com> In-Reply-To: <199805030606.QAA11651@cimlogic.com.au> from "John Birrell" at May 3, 98 04:06:26 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> The problem here is that shared libraries don't link against other > shared libraries - only the program knows what shared libraries it > is looking for. This is broken. I believe it's an "ld" bug. An example would be a shared library "A" that exports the function "foo". The function "foo" depends on the function "fee". The function "fee" is implemented in library "B". A program that imports function "foo" by linking against shared library "A" will *NOT* get an unresolved symbol error at link time, despite not having been linked against library "B" as well. In other words, the current ld does not correctly handle second order dependencies. I have run into this bug while doing production code. The only workaround has been to do one of: 1) First link the program statically. If this succeeds, then relink it dynamically. 2) Modify the dlopen call in crt0's mapping of shared libraries to ensure a preload, so as to cause a runtime error. Currently, the only method of detection is a runtime error if the code *happens* to hit a codepath in the program that results in "foo" calling "fee". That is, it's currently possible for a vendor to deploy defective dynamically linked programs, and not be aware of the problem. This should be a high priority item, I'd think. Currently, I plan to implement workaround #1. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805031029.DAA26301>