Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 12:26:16 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        Julian Elischer <julian@whistle.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: Elf linker question.
Message-ID:  <XFMail.981124122616.jdp@polstra.com>
In-Reply-To: <Pine.BSF.3.95.981124112056.8419D-100000@current1.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24-Nov-98 Julian Elischer wrote:
> I'm not sure that it isn't following  too many links..
> I had to add 100 libraries to our makefiles
> (usually the same ones)
> 
> Even if we were only using 1 function in a library, it required all the
> rest of the libraries in that set, even if they were called from functions
> other than  the one we were calling.

A shared library is fundamentally different from an archive library,
in that a shared library is a monolithic object rather than a
collection of separate object files.  You either load the entire
shared library or you don't load any of it.  With archive libraries,
only the component object files that actually satisfy external
references are loaded.

Also, the linker really doesn't understand the concept of "functions".
It only knows about labels.  It doesn't have any idea which function a
call to another function appears in.

> > I find it hard to believe that all out programs would have worked
> > correctly if they were SO wrong!

It worked just because none of the functions in the missing libraries
were actually called.  Maybe they can't possibly be called in your
program.  But the linker doesn't know that (because there are
references to some of them even if those references aren't used).  So
it has to be safe and force you to satisfy all external references.
The a.out linker didn't, and I think it was a bug.

John
---
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Nobody ever went broke underestimating the taste of the American public."
                                                            -- H. L. Mencken

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?XFMail.981124122616.jdp>