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

Re: prelink cron script



Wichert,
    Read the glibc 2.3 release notes...

http://sources.redhat.com/ml/libc-alpha/2002-10/msg00048.html

also from the prelink manpage...

-----------------------------------------------------------------------

prelink is a program which modifies ELF shared libraries and ELF dynam-
ically linked binaries, so that the time which dynamic linker needs for
their relocation at startup significantly decreases  and  also  due  to
fewer  relocations the run-time memory consumption decreases too (espe-
cially number of unshareable pages).  Such  prelinking  information  is
only  used  if  all its dependant libraries have not changed since pre-
linking, otherwise programs are relocated normally.

prelink first collects ELF binaries which should be prelinked  and  all
the  ELF shared libraries they depend on. Then it assigns a unique vir-
tual address space slot for each library and relinks the shared library
to  that base address.  When the dynamic linker attempts to load such a
library, unless that virtual address space slot is already occupied, it
will  map it into the given slot.  After this is done, prelink with the
help of dynamic linker  resolves  all  relocations  in  the  binary  or
library against its dependant libraries and stores the relocations into
the ELF object.  It also stores  a  list  of  all  dependant  libraries
together  with  their  checksums into the binary or library.  For bina-
ries, it also computes a list of conflicts (relocations  which  resolve
differently  in  the  binary's  symbol search scope than in the smaller
search scope in which the dependant library was resolved) and stores it
into a special ELF section.

At  runtime,  the  dynamic  linker  first  checks whether all dependant
libraries were successfully mapped into their designated address  space
slots  and whether they have not changed since the prelinking was done.
If all checks are successful, the dynamic linker just replays the  list
of  conflicts (which is usually significantly shorter than total number
of relocations) instead of relocating each library.

-----------------------------------------------------------------------
One can prelink a set of directories as defined in /etc/prelink.conf
but that process is rather slow. Redhat is considering using a cron
script approach to check for new files however with the amount of
churn in sid we have that isn't probably the best choice for us.
Redhat has also added postinst prelink scripts to some of their rpms.
Hoever as prelink is pretty system level, it seems to me more appropriate
to just let the user toggle autoprelink on for his machine and then
have both apt-get and dkpg prelink all of these binaries and libs
at install time. That eliminates the need to go hunting for them after
the fact which is much more time-consuming and requires maintaining
lots of timestamps.
                                       Jack
ps I helped test prelink for Jakub on ppclinux and debian ppc sid.
It works really well so far with binaries in sid.



Reply to: