Re: Memory statistics



On Sat, 2006-04-22 at 00:16 +0200, David Turner wrote:
> Alas, non-const arrays are not the only problem. With
> position-independent code, any constant
> _pointer_ will be stored in writable pages, to be relocated by the
> dynamic loader before being usable.

Yeah :(  Andrea's patch kills most of .data from libpng, but the final
VMA is only slightly smaller.

> This has a huge impact on C++ libraries, since all their VTables contain
> constant pointers (try running
> your script on a KDE system !).

... or on OpenOffice.  Michael "I want to be like him when I grow up -
oh, wait, he's younger than me" Meeks has been kicking some ass in that
front.

> It'd be nice if the dynamic linker was able to automatically share the
> updated pointers between
> processes which map the same libraries to the same virtual addresses,
> but I don't think this has been
> implemented yet, since it would require a new ELF section, as well as
> modifications to the
> compilers.

Wouldn't something like this need to happen:

	1. program gets run; linker does the fixups

	2. linker writes "libfoo.so got put at 0x12345678, here is a 
           list of resolved relocations: <...>"

	3. another program gets run.

	4. linker looks in its archive from (2) to see if it had
	   already resolved libfoo.so at some address.

Sounds like pain.

> Another option is to get rid of PIC code completely, using an alternate
> dynamic linking scheme,
> similar to the one in Windows, without the crap. If rebasing is used,
> relocation can be reduced to
> nearly nothing for the most common libraries. This would also create
> smaller and faster code.

How do they handle the problem of agreeing on the base addresses for
various libraries?  We have a million libraries in Linux :)

  Federico




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]