Seth Woolley's Man Viewer

prelink(8) - prelink, prelink - prelink ELF shared libraries and binaries to speed up startup time - man 8 prelink

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

prelink(8)                                                          prelink(8)



NAME
       prelink - prelink ELF shared libraries and binaries to speed up startup
       time(1,2,n)

SYNOPSIS
       prelink [OPTION...] [FILES]

DESCRIPTION
       prelink is a program which modifies ELF shared libraries and ELF dynam-
       ically linked binaries, so that the time(1,2,n) 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(3,n)  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(5,8) address space slot for each library and relinks the shared library
       to  that base address.  When the dynamic linker attempts to load(7,n) such a
       library, unless that virtual(5,8) 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(1,8)  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(1,8)  the  binary's  symbol search scope than in(1,8) the smaller
       search scope in(1,8) 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.

OPTIONS
       -v --verbose
              Verbose mode.  Print the  virtual(5,8)  address  slot  assignment  to
              libraries  and  print  what binary or library is currently being
              prelinked.

       -n --dry-run
              Don't  actually  prelink  anything,  just  collect   the   bina-
              ries/libraries,  assign  them  addresses  and with -v print what
              would be prelinked.

       -a --all
              Prelink all binaries and dependant libraries found in(1,8)  directory
              hierarchies specified in(1,8) /etc/prelink.conf.  Normally only bina-
              ries specified from command line and their  dependant  libraries
              are prelinked.

       -m --conserve-memory
              When  assigning addresses to libraries, allow overlap of address
              space slots provided that the  two  libraries  are  not  present
              together  in(1,8)  any  of the binaries or libraries. This results in(1,8)
              smaller virtual(5,8) address space range used for libraries,  on  the
              other  side  if(3,n)  during  incremental  prelinking  prelink sees a
              binary which puts(3,n) together two libraries which were not  present
              together  in(1,8)  any  other  binary and were given the same virtual(5,8)
              address space slots, then the binary cannot be prelinked.   Nor-
              mally  each  library  is assigned a unique virtual(5,8) address space
              slot.

       -R --random
              When assigning addresses to libraries, start with random(3,4,6) address
              within architecture dependant virtual(5,8) address space range.  This
              can  make  some  buffer  overflow  attacks  slightly  harder  to
              exploit, because libraries are not present on the same addresses
              accross  different  machines.    Normally,   assigning   virtual(5,8)
              addresses  starts at the bottom of architecture dependant range.

       -r --reloc-only=ADDRESS
              Instead of prelinking, just relink given shared libraries to the
              specified base address.

       -N --no-update-cache
              Don't  save  cache  file(1,n)  after  prelinking.  Normally,  list of
              libraries (and with -m binaries also) is stored  into  /etc/pre-
              link.cache  file(1,n)  together  with their given address space slots
              and dependencies, so it can be used during incremental  prelink-
              ing (prelinking without -a option).

       -c --config-file=CONFIG
              Specify  alternate  config(1,5)  file(1,n)  instead  of  default /etc/pre-
              link.conf.

       -C --cache-file=CACHE
              Specify  alternate  cache  file(1,n)  instead  of  default  /etc/pre-
              link.cache.

       -f --force
              Force re-prelinking even for already prelinked objects for which
              no dependencies changed. This option causes new virtual(5,8)  address
              space  slots  to  be  assigned to all libraries.  Normally, only
              binaries or libraries which are either  not  prelinked  yet,  or
              some of their dependencies changed, are prelinked.

       -q --quick
              Run  prelink  in(1,8)  quick  mode.   This mode checks just mtime and
              ctime timestamps of libraries and binaries stored in(1,8)  the  cache
              file.   If  they  are unchanged from the last prelink run, it is
              assumed that the library in(1,8) question did not change and no pars-
              ing of its ELF headers and verifying it is done.

       -p --print-cache
              Print   the  content  of  the  cache  file(1,n)  (normally  /etc/pre-
              link.cache) and exit.

       --dynamic-linker=LDSO
              Specify alternate dynamic linker instead of the default.

       --ld-library-path=PATH
              Specify special LD_LIBRARY_PATH to be used when prelink  queries
              dynamic linker about symbol resolution details.

       --libs-only
              Only prelink ELF shared libraries, don't prelink any binaries.

       -h --dereference
              When  processing  command  line directory arguments, follow sym-
              bolic links when walking directory hierarchies.

       -l --one-file-system
              When processing command line directory arguments,  limit  direc-
              tory tree walk to a single filesystem.

       -u --undo
              Revert  binaries  and libraries to their original content before
              they were prelinked.  Without -a option  this  causes  only  the
              binaries  and  libraries  specified  on  the  command line to be
              reverted to their original state (and e.g. not  their  dependen-
              cies).  If  used  together  with  -a  option  all  binaries  and
              libraries from command line, all their dependencies,  all  bina-
              ries  found in(1,8) directories specified on command line and in(1,8) con-
              fig(1,5) file(1,n) and all their dependencies will be undone.

       -y --verify
              Verifies a prelinked binary or library.  This option can be used
              only  on  a single binary or library. It first applies an --undo
              operation on the file(1,n), then prelinks just that  file(1,n)  again  and
              compares  this with the original file. If both are identical, it
              prints the file(1,n) after --undo operation on  standard  output  and
              exit(3,n,1 builtins)  with  zero  status.  Otherwise it exits with error(8,n) status.
              Thus if(3,n) --verify operation returns  zero  exit(3,n,1 builtins)  status  and  its
              standard output is equal to the content of the binary or library
              before prelinking, you can be  sure  that  nobody  modified  the
              binaries  or libraries after prelinking.  Similarly with message
              digests and checksums (unless you trigger the unprobable case of
              modified file(1,n) and original file(1,n) having the same digest or check-
              sum).

       --md5  This is similar to --verify option, except instead of  outputing
              the  content of the binary or library before prelinking to stan-
              dard output MD5 digest is printed.  See md5sum(1).

       --sha  This is similar to --verify option, except instead of  outputing
              the  content of the binary or library before prelinking to stan-
              dard output SHA1 digest is printed.  See sha1sum(1).

       -V --version
              Print version(1,3,5) and exit.

       -? --help
              Print short help and exit.

ARGUMENTS
       Command line arguments should be either directory hierarchies (in(1,8) which
       case  -l  and  -h  options apply), or particular ELF binaries or shared
       libraries.  Unlike when walking  directory  hierarchies,  specifying  a
       shared  library  explicitely  on  the command line causes it to be pre-
       linked even if(3,n) no binary is linked against it. Normally, only  binaries
       are collected together with all libraries they depend on.

EXAMPLES
              # /usr/sbin/prelink -avmR
       will  prelink  all binaries found in(1,8) directories specified in(1,8) /etc/pre-
       link.conf and all their dependant libraries, assigning libraries unique
       virtual(5,8)  address space slots only if(3,n) they ever appear together and will
       start assigning at random(3,4,6) address.
              # /usr/sbin/prelink -vm ~/bin/progx
       will prelink  ~/bin/progx  program  and  all  its  dependant  libraries
       (unless they were prelinked already e.g. during prelink -a invocation).
              # /usr/sbin/prelink -au
       will revert all binaries and libraries to their original content.
              # /usr/sbin/prelink -y /bin/prelinked_prog > /tmp/original_prog;
              echo(1,3x,1 builtins)  $?   will  verify(1,8)  whether /bin/prelinked_prog hasn't been
              changed.

FILES
       /etc/prelink.cache  Binary file(1,n) containing list of prelinked  libraries
                           and/or  binaries  together with their assigned vir-
                           tual(5,8) address space slots and dependencies.  You can
                           run  /usr/sbin/prelink  -p to see what is stored in(1,8)
                           there.
       /etc/prelink.conf   Configuration file(1,n) containing a list  of  directory
                           hierarchies  which can contain ELF shared libraries
                           or binaries which should be prelinked.   This  con-
                           figuration file(1,n) is used in(1,8) -a mode to find binaries
                           which  should  be  prelinked  and  also  no  matter
                           whether -a is given or not to limit which dependant
                           shared libraries should be  prelinked.  If  prelink
                           finds  a  dependant library of some binary or other
                           library which is not present in(1,8) any of the directo-
                           ries  specified in(1,8) /etc/prelink.conf and neither in(1,8)
                           any of the directories  specified  on  the  command
                           line,  then  it  cannot be prelinked.  Each line of
                           the config(1,5) file(1,n) should be either  comment  starting
                           with #, or directory name. It can be prefixed by -l
                           switch(1,n), meaning tree walk of  the  given  directory
                           will  be  only  limited  to  one  filesystem, or -h
                           switch(1,n), meaning tree walk of  the  given  directory
                           will follow symbolic links.
SEE ALSO
       ldd(1), ld.so(8).
BUGS
       prelink  Some architectures, including IA-64, HPPA and MIPS are not yet
       supported.
AUTHORS
       Jakub Jelinek <jakub@redhat.com>.



                                 5 August 2003                      prelink(8)

References for this manual (incoming links)