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

RE: question regarding prelinking (was: (inc. note from dpkg developers) (was:Bug#XXXXXX: (far too many packages) needs rebuilt for prelinking))

    Packaging prelinked binaries would be considered broken behavior
since the virtual address space assignments that prelink makes will
change for different combinations of binaries. In fact if you prelink
and then install a new build of a shared library, all programs and
shared libraries that are linked against that library are effectively
unprelinked and you must run prelink on them again. The top of the 
prelink man page covering this is attached below.

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 runtime 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/libraries,  assign  them  addresses  and with v print what
would be prelinked.

Reply to: