1prelink(8)                  System Manager's Manual                 prelink(8)
2
3
4

NAME

6       prelink - prelink ELF shared libraries and binaries to speed up startup
7       time
8

SYNOPSIS

10       prelink [OPTION...] [FILES]
11

DESCRIPTION

13       prelink is a program that modifies ELF shared libraries and ELF dynami‐
14       cally  linked  binaries  in  such  a  way  that the time needed for the
15       dynamic  linker  to  perform  relocations  at   startup   significantly
16       decreases.   Due  to fewer relocations, the run-time memory consumption
17       decreases as well (especially the number of  unshareable  pages).   The
18       prelinking  information  is  only  used  at startup time if none of the
19       dependent libraries have changed since prelinking;  otherwise  programs
20       are relocated normally.
21
22       prelink  first  collects  ELF  binaries to be prelinked and all the ELF
23       shared libraries they depend on.  Then  it  assigns  a  unique  virtual
24       address  space  slot  to each library and relinks the shared library to
25       that base address.  When the dynamic linker attempts  to  load  such  a
26       library, unless that virtual address space slot is already occupied, it
27       maps the library into the given slot.  After  this  is  done,  prelink,
28       with the help of dynamic linker, resolves all relocations in the binary
29       or library against its dependent libraries and stores  the  relocations
30       into  the ELF object.  It also stores a list of all dependent libraries
31       together with their checksums into the binary or  library.   For  bina‐
32       ries,  it  also  computes a list of conflicts (relocations that resolve
33       differently in the binary's symbol search scope  than  in  the  smaller
34       search scope in which the dependent library was resolved) and stores it
35       into a special ELF section.
36
37       At runtime, the dynamic  linker  first  checks  whether  all  dependent
38       libraries  were successfully mapped into their designated address space
39       slots, and whether they have not changed since the prelinking was done.
40       If  all checks are successful, the dynamic linker just replays the list
41       of conflicts (which is usually significantly shorter than total  number
42       of relocations) instead of relocating each library.
43

OPTIONS

45       -v --verbose
46              Verbose  mode.   Print  the  virtual  address  slots assigned to
47              libraries and what binary or library  is  currently  being  pre‐
48              linked.
49
50       -n --dry-run
51              Don't   actually   prelink  anything;  just  collect  the  bina‐
52              ries/libraries, assign them addresses, and with  -v  print  what
53              would be prelinked.
54
55       -a --all
56              Prelink  all binaries and dependent libraries found in directory
57              hierarchies  specified  in  /etc/prelink.conf.   Normally,  only
58              binaries  specified  on  the  command  line  and their dependent
59              libraries are prelinked.
60
61       -m --conserve-memory
62              When assigning addresses to libraries, allow overlap of  address
63              space  slots  provided  that  the  two libraries are not present
64              together in any of the binaries or libraries. This results in  a
65              smaller  virtual address space range used for libraries.  On the
66              other hand, if prelink sees a binary during incremental prelink‐
67              ing  which  puts  together  two libraries which were not present
68              together in any other binary and were  given  the  same  virtual
69              address space slots, then the binary cannot be prelinked.  With‐
70              out this option, each  library  is  assigned  a  unique  virtual
71              address space slot.
72
73       -R --random
74              When  assigning  addresses  to  libraries,  start  with a random
75              address within the architecture-dependent virtual address  space
76              range.   This  can  make  some  buffer overflow attacks slightly
77              harder to exploit, because libraries are not present on the same
78              addresses  across  different machines.  Normally, assigning vir‐
79              tual addresses starts at the bottom of  the  architecture-depen‐
80              dent range.
81
82       -r --reloc-only=ADDRESS
83              Instead of prelinking, just relink given shared libraries to the
84              specified base address.
85
86       -N --no-update-cache
87              Don't save the cache file after prelinking.  Normally, the  list
88              of  libraries  (and  with  -m  binaries also) is stored into the
89              /etc/prelink.cache file together with their given address  space
90              slots  and  dependencies, so the cache can be used during incre‐
91              mental prelinking (prelinking without -a option).
92
93       -c --config-file=CONFIG
94              Specify an alternate config file instead  of  default  /etc/pre‐
95              link.conf.
96
97       -C --cache-file=CACHE
98              Specify  an  alternate  cache  file instead of default /etc/pre‐
99              link.cache.
100
101       -f --force
102              Force re-prelinking even for  already  prelinked  objects  whose
103              dependencies  are  unchanged.   This  option  causes new virtual
104              address space slots to be assigned to all libraries.   Normally,
105              only  binaries  or libraries which are either not prelinked yet,
106              or whose dependencies have changed, are prelinked.
107
108       -q --quick
109              Run prelink in quick mode.  This  mode  checks  just  mtime  and
110              ctime  timestamps  of libraries and binaries stored in the cache
111              file.  If they are unchanged from the last prelink  run,  it  is
112              assumed  that  the  library  in question did not change, without
113              parsing or verifying its ELF headers.
114
115       -p --print-cache
116              Print  the  contents  of  the  cache  file  (normally  /etc/pre‐
117              link.cache) and exit.
118
119       --dynamic-linker=LDSO
120              Specify an alternate dynamic linker instead of the default.
121
122       --ld-library-path=PATH
123              Specify  a  special  LD_LIBRARY_PATH  to  be  used  when prelink
124              queries the dynamic linker about symbol resolution details.
125
126       --libs-only
127              Only prelink ELF shared libraries, don't prelink any binaries.
128
129       -h --dereference
130              When processing command line directory  arguments,  follow  sym‐
131              bolic links when walking directory hierarchies.
132
133       -l --one-file-system
134              When  processing  command line directory arguments, limit direc‐
135              tory tree walk to a single file system.
136
137       -u --undo
138              Revert binaries and libraries to their original  content  before
139              they  were  prelinked.   Without the -a option, this causes only
140              the binaries and libraries specified on the command line  to  be
141              reverted  to  their original state (and e.g. not their dependen‐
142              cies). If used together with the -a  option,  all  binaries  and
143              libraries  from  command line, all their dependencies, all bina‐
144              ries found in directories specified on command line and  in  the
145              config file, and all their dependencies are undone.
146
147       -y --verify
148              Verifies a prelinked binary or library.  This option can be used
149              only on a single binary or library. It first applies  an  --undo
150              operation  on  the  file, then prelinks just that file again and
151              compares this with the original file. If both are identical,  it
152              prints  the  file  after --undo operation on standard output and
153              exits with zero status. Otherwise it exits  with  error  status.
154              Thus  if  --verify  operation  returns  zero exit status and its
155              standard output is equal to the content of the binary or library
156              before  prelinking,  you  can  be  sure that nobody modified the
157              binaries or libraries after prelinking.  Similarly with  message
158              digests and checksums (unless you trigger the improbable case of
159              modified file and original file having the same digest or check‐
160              sum).
161
162       --md5  This is similar to --verify option, except instead of outputting
163              the content of the binary or library before prelinking to  stan‐
164              dard output, MD5 digest is printed.  See md5sum(1).
165
166       --sha  This is similar to --verify option, except instead of outputting
167              the content of the binary or library before prelinking to  stan‐
168              dard output, SHA1 digest is printed.  See sha1sum(1).
169
170       --exec-shield --no-exec-shield
171              On  IA-32,  if the kernel supports Exec-Shield, prelink attempts
172              to lay libraries out similarly to how  the  kernel  places  them
173              (i.e.  if  possible  below the binary, most widely used into the
174              ASCII armor zone).   These  switches  allow  overriding  prelink
175              detection of whether Exec-Shield is supported or not.
176
177       -b --black-list=PATH
178              This  option  allows  blacklisting  certain  paths, libraries or
179              binaries.  Prelink will not touch them during prelinking.
180
181       -o --undo-output=FILE
182              When performing an --undo operation, don't  overwrite  the  pre‐
183              linked  binary  or  library with its original content (before it
184              was prelinked), but save that into the specified file.
185
186       -V --version
187              Print version and exit.
188
189       -? --help
190              Print short help and exit.
191

ARGUMENTS

193       Command-line arguments should be either directory hierarchies (in which
194       case  -l  and  -h  options apply), or particular ELF binaries or shared
195       libraries.  Specifying a shared library explicitly on the command  line
196       causes it to be prelinked even if no binary is linked against it.  Oth‐
197       erwise, binaries are collected together and  only  the  libraries  they
198       depend on are prelinked with them.
199

EXAMPLES

201              # /usr/sbin/prelink -avmR
202       prelinks  all  binaries  found  in  directories  specified in /etc/pre‐
203       link.conf and all their dependent libraries, assigning libraries unique
204       virtual  address  space  slots  only  if they ever appear together, and
205       starts assigning libraries at a random address.
206              # /usr/sbin/prelink -vm ~/bin/progx
207       prelinks ~/bin/progx program and all its  dependent  libraries  (unless
208       they were prelinked already e.g. during prelink -a invocation).
209              # /usr/sbin/prelink -au
210       reverts all binaries and libraries to their original content.
211              # /usr/sbin/prelink -y /bin/prelinked_prog > /tmp/original_prog;
212              echo $?  verifies whether /bin/prelinked_prog is unchanged.
213

FILES

215       /etc/prelink.cache  Binary  file  containing  a   list   of   prelinked
216                           libraries   and/or  binaries  together  with  their
217                           assigned virtual address space slots and  dependen‐
218                           cies.  You can run /usr/sbin/prelink -p to see what
219                           is stored in there.
220       /etc/prelink.conf   Configuration file containing a list  of  directory
221                           hierarchies  that  contain  ELF shared libraries or
222                           binaries which should be prelinked.  This  configu‐
223                           ration  file  is  used  in -a mode to find binaries
224                           which should  be  prelinked  and  also,  no  matter
225                           whether  -a  is given or not, to limit which depen‐
226                           dent shared libraries should be prelinked. If  pre‐
227                           link  finds  a  dependent library of some binary or
228                           other library which is not present in  any  of  the
229                           directories  specified  either in /etc/prelink.conf
230                           or on the command line,  then  it  cannot  be  pre‐
231                           linked.   Each  line  of  the config file should be
232                           either a comment starting with #,  or  a  directory
233                           name,  or  a  blacklist  specification.   Directory
234                           names can be prefixed by the -l switch, meaning the
235                           tree walk of the given directory is only limited to
236                           one file system; or the -h switch, meaning the tree
237                           walk of the given directory follows symbolic links.
238                           A blacklist specification should be prefixed by  -b
239                           and  optionally  also -l or -h if needed.  A black‐
240                           list entry can be either an absolute directory name
241                           (in that case all files in that directory hierarchy
242                           are ignored by the prelinker); an absolute filename
243                           (then   that   particular   library  or  binary  is
244                           skipped); or a glob pattern without a  /  character
245                           in  it  (then  all  files matching that glob in any
246                           directory are ignored).

SEE ALSO

248       ldd(1), ld.so(8).

BUGS

250       prelink Some architectures, including IA-64 and HPPA, are not yet  sup‐
251       ported.

AUTHORS

253       Jakub Jelinek <jakub@redhat.com>.
254
255
256
257                                 01 March 2007                      prelink(8)
Impressum