*BSD News Article 51125


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.uwa.edu.au!classic.iinet.com.au!news.uoregon.edu!news.dacom.co.kr!newsfeed.internetmci.com!news.mathworks.com!tank.news.pipex.net!pipex!in2.uu.net!polstra!not-for-mail
From: jdp@polstra.com (John Polstra)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: ld.so failed
Date: 11 Sep 1995 12:23:34 -0700
Organization: Polstra & Co., Seattle, WA
Lines: 55
Message-ID: <4322bm$9pe@seattle.polstra.com>
References: <42dk7r$r6n@shore.shore.net> <42n7f7$s6g@helena.MT.net> <42pf84$11o@shore.shore.net> <42tsc2$m5a@helena.MT.net>
NNTP-Posting-Host: seattle.polstra.com

In article <42tsc2$m5a@helena.MT.net>,
Nate Williams <nate@sneezy.sri.com> wrote:
>
> Again, the offer still stands.  If you want to write the code to make
> the activator return better error codes I'll do my best to get it into
> the tree.  Let's see a commercial OS do that for you. *grin*

OK, I've written the code, and I will send it in this week, along with
the changes I've already made to fix the cascade-loading of any needed
shared libraries when something is loaded at runtime via dlopen().  (That
works great, by the way.)

Here is the kind of message you will now get when the dynamic linker
finds an undefined symbol (the usual cause of the "ld.so failed"
messages):

    ld.so failed: Undefined symbol "_XrmStringToQuark" in run2:/usr/X11R6/lib/libXt.so.6.0

(In this example, "run2" is the name of the program being executed.)

Implementing this turned out to be very easy.  The code was already
present in "ld.so" (the dynamic linker) to generate the message.  I just
had to rearrange a couple of lines there to make the message available
to the activator in "crt0.o".  And in "crt0.o" I had to add a little
code to get to the message and print it.

The net cost in size of all this was as follows:

    crt0.o:  +96 bytes
    ld.so:   no change in size

Now, crt0.o is the thing that is statically linked into every executable
on the system, so it's the one we care about.  Any increase in size of
"crt0.o" will add the corresponding number of bytes to the file size of
every single executable on disk.

On my system, I typed

    ls /usr/bin /bin /sbin /usr/sbin /usr/X11R6/bin /usr/local/bin \
	/usr/libexec | wc

to get an estimate of the number of executables.  The number printed out
was 720.  This means that the total cost of my changes in terms of disk
space would be

    720 * 96 = 69,120 bytes = 0.066 MBytes.

I think I could live with that.

I'll do a little more testing, then send in the changes this week.

-- 
   John Polstra                                       jdp@polstra.com
   Polstra & Co., Inc.                        Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth