Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 14:37:46 -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.981124143746.jdp@polstra.com>
In-Reply-To: <Pine.BSF.3.95.981124123339.8419E-100000@current1.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24-Nov-98 Julian Elischer wrote:
> On Tue, 24 Nov 1998, John Polstra wrote:
> 
>> 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.
> 
> The trouble with that is that ALL libraries end up being loaded into
> memeory whenever one program requires any of them. they also all get
> traversed on program startup which keeps them all in memory.. right?

Right.  The whole files don't get "traversed", but their symbol
tables, relocation tables, and data segments do get accessed.  It's
significant.

> not so good for small memory systems.

I understand, but nevertheless I think the new linker is doing the
right thing.  We've gotten plenty of complaints about the behavior
of the old one, too.  People don't like it when the linker fails to
report undefined symbols.

I think for your case, you need to look at some combination of the
following:

    * Split your top-level libraries into smaller pieces along
    functional lines, so that each piece depends on fewer other
    libraries.

    * Make stub libraries to replace the ones you know aren't really
    needed.  The stubs should define all the needed symbols, but they
    should all resolve to a function that generates a fatal error if
    called.

    * Don't use shared libraries in some cases.

The old behavior was a bug.  It's unfortunate that you were
unwittingly depending on the bug.  But that doesn't mean we should
reintroduce the bug again.

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.981124143746.jdp>