From: Eric Youngdale (eric@tantalus.nrl.navy.mil)
Date: 02/24/93


From: eric@tantalus.nrl.navy.mil (Eric Youngdale)
Subject: Re: Thought: compressed libc ?
Date: Wed, 24 Feb 1993 23:29:42 GMT

In article <1mgkdlINNhdp@iamk4515.mathematik.uni-karlsruhe.de> bernd@iamk4515.mathematik.uni-karlsruhe.de (Bernd Wiebelt) writes:
>Just a little question:
>
>Why is the shared lib smaller than indicated by ls?
>And why is there need to make holes?

        Basically we need to ensure that all of the global variables and all of
the jump table entry points are always located at the same memory address from
one version to the next. Traditionally, the data segment follows the text
segment, so we essentially tell the linker to pad the text segment a lot so
that we can always guarantee that the data remains at the same address from one
version to the next. It turns out that libc was first built this way, and
we have been keeping this in order to maintain binary compatibility. The only
problem with having the hole is that the file appears to be much larger than it
actually is.

        Strictly speaking the hole is not really required, except for the
binary compatibility. The kernel does not generate a segmentation fault if you
try and write to a text page in a shared library, and when the X libraries were
built, we effectively have moved all of the global data located in the .text
segment. By doing this, we do not need to have a hole in the file, since all
of the things that need to remain at fixed addresses will always be right at
the start of the library.

>If someone is curious why I want to know that:
>I would like to build my own rootdisk, but I don't want to
>follow blindly the instructions from HLU (not that they did
>not work :-). Instead, I would
>like to understand (most of) what I do.
>
>Another thing: the new libc4.3 is really nice and I would like
>to thank everyone who has worked on it. IMHO it was right to
>release this version, cause the new Xfree is really worth a
>little beta-testing (bash dumping core and so on...)
>
>Keep on with that great work! Bernd

        Thanks :-). The 4.3.1 library (when released) will be set up in such a
way that you can build the sharable library directly from the
libc-linux/Makefile. You also need to compile and install some tools which are
used when you generate the sharable library, but these needed to be revised
because of the core dumping problem. Once things have settled down a public
release will be made of the tools.

-Eric

--