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       --layout-page-size=SIZE
127              Layout start of libraries at given boundary.
128
129       --libs-only
130              Only prelink ELF shared libraries, don't prelink any binaries.
131
132       -h --dereference
133              When processing command line directory  arguments,  follow  sym‐
134              bolic links when walking directory hierarchies.
135
136       -l --one-file-system
137              When  processing  command line directory arguments, limit direc‐
138              tory tree walk to a single file system.
139
140       -u --undo
141              Revert binaries and libraries to their original  content  before
142              they  were  prelinked.   Without the -a option, this causes only
143              the binaries and libraries specified on the command line  to  be
144              reverted  to  their original state (and e.g. not their dependen‐
145              cies). If used together with the -a  option,  all  binaries  and
146              libraries  from  command line, all their dependencies, all bina‐
147              ries found in directories specified on command line and  in  the
148              config file, and all their dependencies are undone.
149
150       -y --verify
151              Verifies a prelinked binary or library.  This option can be used
152              only on a single binary or library. It first applies  an  --undo
153              operation  on  the  file, then prelinks just that file again and
154              compares this with the original file. If both are identical,  it
155              prints  the  file  after --undo operation on standard output and
156              exits with zero status. Otherwise it exits  with  error  status.
157              Thus  if  --verify  operation  returns  zero exit status and its
158              standard output is equal to the content of the binary or library
159              before  prelinking,  you  can  be  sure that nobody modified the
160              binaries or libraries after prelinking.  Similarly with  message
161              digests and checksums (unless you trigger the improbable case of
162              modified file and original file having the same digest or check‐
163              sum).
164
165       --md5  This is similar to --verify option, except instead of outputting
166              the content of the binary or library before prelinking to  stan‐
167              dard output, MD5 digest is printed.  See md5sum(1).
168
169       --sha  This is similar to --verify option, except instead of outputting
170              the content of the binary or library before prelinking to  stan‐
171              dard output, SHA1 digest is printed.  See sha1sum(1).
172
173       --exec-shield --no-exec-shield
174              On  IA-32,  if the kernel supports Exec-Shield, prelink attempts
175              to lay libraries out similarly to how  the  kernel  places  them
176              (i.e.  if  possible  below the binary, most widely used into the
177              ASCII armor zone).   These  switches  allow  overriding  prelink
178              detection of whether Exec-Shield is supported or not.
179
180       -b --black-list=PATH
181              This  option  allows  blacklisting  certain  paths, libraries or
182              binaries.  Prelink will not touch them during prelinking.
183
184       -o --undo-output=FILE
185              When performing an --undo operation, don't  overwrite  the  pre‐
186              linked  binary  or  library with its original content (before it
187              was prelinked), but save that into the specified file.
188
189       -V --version
190              Print version and exit.
191
192       -? --help
193              Print short help and exit.
194
195       --usage
196              Print short usage message.
197

ARGUMENTS

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

EXAMPLES

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

FILES

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

SEE ALSO

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

BUGS

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

AUTHORS

259       Jakub Jelinek <jakub@redhat.com>.
260
261
262
263                                 19 July 2013                       prelink(8)
Impressum