1 .\" This is in the public domain
2 .TH LD.SO 8 2012-03-06 "GNU" "Linux Programmer's Manual"
4 ld.so, ld-linux.so* \- dynamic linker/loader
6 The dynamic linker can be run either indirectly by running some
7 dynamically linked program or library (in which case no command-line options
8 to the dynamic linker can be passed and, in the ELF case, the dynamic linker
11 section of the program is executed) or directly by running:
14 [OPTIONS] [PROGRAM [ARGUMENTS]]
20 find and load the shared libraries needed by a program, prepare
21 the program to run, and then run it.
23 Linux binaries require dynamic linking (linking at run time)
32 handles a.out binaries, a format used long ago;
34 handles ELF (\fI/lib/ld-linux.so.1\fP for libc5, \fI/lib/ld-linux.so.2\fP
35 for glibc2), which everybody has been using for years now.
36 Otherwise both have the same behavior, and use the same
37 support files and programs
43 The shared libraries needed by the program are searched for
44 in the following order:
46 (ELF only) Using the directories specified in the
47 DT_RPATH dynamic section attribute
48 of the binary if present and DT_RUNPATH attribute does not exist.
49 Use of DT_RPATH is deprecated.
51 Using the environment variable
53 Except if the executable is a set-user-ID/set-group-ID binary,
54 in which case it is ignored.
56 (ELF only) Using the directories specified in the
57 DT_RUNPATH dynamic section attribute
58 of the binary if present.
62 which contains a compiled list of candidate libraries previously found
63 in the augmented library path.
64 If, however, the binary was linked with the
66 linker option, libraries in the default library paths are skipped.
72 If the binary was linked with the
74 linker option, this step is skipped.
78 understands the string
82 in an rpath specification (DT_RPATH or DT_RUNPATH) to mean
83 the directory containing the application executable.
84 Thus, an application located in
86 could be compiled with
87 .I gcc -Wl,-rpath,\(aq$ORIGIN/../lib\(aq
88 so that it finds an associated shared library in
92 is located in the directory hierarchy.
93 This facilitates the creation of "turn-key" applications that
94 do not need to be installed into special directories,
95 but can instead be unpacked into any directory
96 and still find their own shared libraries.
97 .\" ld.so also understands $LIB, with the same meaning as $ORIGIN/lib,
100 .\" There is also $PLATFORM. This is a kind of wildcard
101 .\" of directories related at AT_HWCAP. To get an idea of the
102 .\" places that $PLATFORM would match, look at the output of the
106 .\" LD_LIBRARY_PATH=/tmp/d strace -e open /bin/date 2>&1 | grep /tmp/d
108 .\" ld.so lets names be abbreviated, so $O will work for $ORIGIN;
113 List all dependencies and how they are resolved.
116 Verify that program is dynamically linked and this dynamic linker can handle
119 .B \-\-library\-path PATH
122 environment variable setting (see below).
124 .B \-\-inhibit\-rpath LIST
125 Ignore RPATH and RUNPATH information in object names in LIST.
126 This option is ignored if
128 is set-user-ID or set-group-ID.
130 Use objects named in LIST as auditors.
132 There are four important environment variables.
135 (libc5; glibc since 2.1.1)
136 If set to a nonempty string,
137 causes the dynamic linker to resolve all symbols
138 at program startup instead of deferring function call resolution to the point
139 when they are first referenced.
140 This is useful when using a debugger.
143 A colon-separated list of directories in which to search for
144 ELF libraries at execution-time.
147 environment variable.
150 A whitespace-separated list of additional, user-specified, ELF shared
151 libraries to be loaded before all others.
152 This can be used to selectively override functions in other shared libraries.
153 For set-user-ID/set-group-ID ELF binaries,
154 only libraries in the standard search
155 directories that are also set-user-ID will be loaded.
157 .B LD_TRACE_LOADED_OBJECTS
159 If set to a nonempty string, causes the program to list its dynamic library
160 dependencies, as if run by
162 instead of running normally.
164 Then there are lots of more or less obscure variables,
165 many obsolete or only for internal use.
167 .B LD_AOUT_LIBRARY_PATH
171 for a.out binaries only.
172 Old versions of ld\-linux.so.1 also supported
173 .BR LD_ELF_LIBRARY_PATH .
179 for a.out binaries only.
180 Old versions of ld\-linux.so.1 also supported
185 A colon-separated list of user-specified, ELF shared objects
186 to be loaded before all others in a separate linker namespace
187 (i.e., one that does not intrude upon the normal symbol bindings that
188 would occur in the process).
189 These libraries can be used to audit the operation of the dynamic linker.
191 is ignored for set-user-ID/set-group-ID binaries.
193 The dynamic linker will notify the audit
194 libraries at so-called auditing checkpoints\(emfor example,
195 loading a new library, resolving a symbol,
196 or calling a symbol from another shared object\(emby
197 calling an appropriate function within the audit library.
200 The auditing interface is largely compatible with that provided on Solaris,
202 .IR "Linker and Libraries Guide" ,
204 .IR "Runtime Linker Auditing Interface" .
208 Do not update the GOT (global offset table) and PLT (procedure linkage table)
209 after resolving a symbol.
213 Output verbose debugging information about the dynamic linker.
216 prints all debugging information it has, if set to
218 prints a help message about which categories can be specified in this
219 environment variable.
222 is ignored for set-user-ID/set-group-ID binaries.
228 output should be fed into, default is standard output.
230 is ignored for set-user-ID/set-group-ID binaries.
234 Allow weak symbols to be overridden (reverting to old glibc behavior).
235 For security reasons, since glibc 2.3.4,
237 is ignored for set-user-ID/set-group-ID binaries.
241 Mask for hardware capabilities.
245 Don't ignore the directory in the names of a.out libraries to be loaded.
246 Use of this option is strongly discouraged.
250 Suppress warnings about a.out libraries with incompatible minor
255 Path where the binary is found (for non-set-user-ID programs).
256 For security reasons, since glibc 2.4,
258 is ignored for set-user-ID/set-group-ID binaries.
259 .\" Only used if $ORIGIN can't be determined by normal means
260 .\" (from the origin path saved at load time, or from /proc/self/exe)?
264 Set to 0 to disable pointer guarding.
265 Any other value enables pointer guarding, which is also the default.
266 Pointer guarding is a security mechanism whereby some pointers to code
267 stored in writable program memory (return addresses saved by
269 or function pointers used by various glibc internals) are mangled
270 semi-randomly to make it more difficult for an attacker to hijack
271 the pointers for use in the event of a buffer overrun or
272 stack-smashing attack.
276 Shared object to be profiled,
277 specified either as a pathname or a soname.
278 Profiling output is written to the file whose name is:
279 "\fI$LD_PROFILE_OUTPUT\fP/\fI$LD_PROFILE\fP.profile".
285 output should be written.
286 If this variable is not defined, or is defined as an empty string,
290 is ignored for set-user-ID and set-group-ID programs,
296 Show auxiliary array passed up from the kernel.
297 For security reasons, since glibc 2.3.5,
299 is ignored for set-user-ID/set-group-ID binaries.
301 .\" Document LD_TRACE_PRELINKING (e.g.: LD_TRACE_PRELINKING=libx1.so ./prog)
303 .\" Also enables DL_DEBUG_PRELINK
306 .\" http://sources.redhat.com/ml/libc-hacker/2003-11/msg00127.html
307 .\" Subject: [PATCH] Support LD_USE_LOAD_BIAS
309 By default (i.e., if this variable is not defined)
310 executables and prelinked
311 shared objects will honor base addresses of their dependent libraries
312 and (nonprelinked) position-independent executables (PIEs)
313 and other shared objects will not honor them.
316 is defined wit the value, both executables and PIEs
317 will honor the base addresses.
320 is defined with the value 0,
321 neither executables nor PIEs will honor the base addresses.
322 This variable is ignored by set-user-ID and set-group-ID programs.
326 If set to a nonempty string,
327 output symbol versioning information about the
328 program if querying information about the program (i.e., either
329 .B LD_TRACE_LOADED_OBJECTS
334 options have been given to the dynamic linker).
337 (ELF only)(glibc since 2.1.3)
338 If set to a nonempty string, warn about unresolved symbols.
345 when none is present.
350 a.out dynamic linker/loader
352 .IR /lib/ld\-linux.so. { 1 , 2 }
353 ELF dynamic linker/loader
356 File containing a compiled list of directories in which to search for
357 libraries and an ordered list of candidate libraries.
359 .I /etc/ld.so.preload
360 File containing a whitespace separated list of ELF shared libraries to
361 be loaded before the program.
369 functionality is available for executables compiled using libc version
371 ELF functionality is available since Linux 1.1.52 and libc5.
377 .\" ld.so: David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus
378 .\" Torvalds, Lars Wirzenius and Mitch D'Souza
379 .\" ld-linux.so: Roland McGrath, Ulrich Drepper and others.
381 .\" In the above, (libc5) stands for David Engel's ld.so/ld-linux.so.