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 which modifies ELF shared libraries and ELF dynam‐
14       ically linked binaries, so that the time which dynamic linker needs for
15       their relocation at startup significantly decreases  and  also  due  to
16       fewer  relocations the run-time memory consumption decreases too (espe‐
17       cially number of unshareable pages).  Such  prelinking  information  is
18       only  used  if  all its dependant libraries have not changed since pre‐
19       linking, otherwise programs are relocated normally.
20
21       prelink first collects ELF binaries which should be prelinked  and  all
22       the  ELF shared libraries they depend on. Then it assigns a unique vir‐
23       tual address space slot for each library and relinks the shared library
24       to  that base address.  When the dynamic linker attempts to load such a
25       library, unless that virtual address space slot is already occupied, it
26       will  map it into the given slot.  After this is done, prelink with the
27       help of dynamic linker  resolves  all  relocations  in  the  binary  or
28       library against its dependant libraries and stores the relocations into
29       the ELF object.  It also stores  a  list  of  all  dependant  libraries
30       together  with  their  checksums into the binary or library.  For bina‐
31       ries, it also computes a list of conflicts (relocations  which  resolve
32       differently  in  the  binary's  symbol search scope than in the smaller
33       search scope in which the dependant library was resolved) and stores it
34       into a special ELF section.
35
36       At  runtime,  the  dynamic  linker  first  checks whether all dependant
37       libraries were successfully mapped into their designated address  space
38       slots  and whether they have not changed since the prelinking was done.
39       If all checks are successful, the dynamic linker just replays the  list
40       of  conflicts (which is usually significantly shorter than total number
41       of relocations) instead of relocating each library.
42

OPTIONS

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

ARGUMENTS

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

EXAMPLES

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

FILES

214       /etc/prelink.cache  Binary  file containing list of prelinked libraries
215                           and/or binaries together with their  assigned  vir‐
216                           tual address space slots and dependencies.  You can
217                           run /usr/sbin/prelink -p to see what is  stored  in
218                           there.
219       /etc/prelink.conf   Configuration  file  containing a list of directory
220                           hierarchies which can contain ELF shared  libraries
221                           or  binaries  which should be prelinked.  This con‐
222                           figuration file is used in -a mode to find binaries
223                           which  should  be  prelinked  and  also  no  matter
224                           whether -a is given or not to limit which dependant
225                           shared  libraries  should  be prelinked. If prelink
226                           finds a dependant library of some binary  or  other
227                           library which is not present in any of the directo‐
228                           ries specified in /etc/prelink.conf and neither  in
229                           any  of  the  directories  specified on the command
230                           line, then it cannot be prelinked.   Each  line  of
231                           the  config  file should be either comment starting
232                           with #, or a directory name, or a blacklist  speci‐
233                           fication.   Directory  names  can be prefixed by -l
234                           switch, meaning tree walk of  the  given  directory
235                           will  be  only  limited  to  one  filesystem, or -h
236                           switch, meaning tree walk of  the  given  directory
237                           will  follow  symbolic links.  Blacklist specifica‐
238                           tion should be prefixed by -b and  optionally  also
239                           -l  or  -h if needed.  It should be either absolute
240                           directory name (in that  case  all  files  in  that
241                           directory  hierarchy will be blacklisted), absolute
242                           filename (in that case that particular  library  or
243                           binary  will  not  be touched by prelink) or a glob
244                           pattern without / character in it (then  all  files
245                           matching  that glob in any directory will be black‐
246                           listed).

SEE ALSO

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

BUGS

250       prelink Some architectures, including IA-64, HPPA and MIPS, are not yet
251       supported.

AUTHORS

253       Jakub Jelinek <jakub@redhat.com>.
254
255
256
257                               23 November 2004                     prelink(8)
Impressum