1 .\" This is in the public domain
2 .TH LD.SO 8 2009-01-12 "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 There are four important environment variables.
133 (libc5; glibc since 2.1.1)
134 If set to a non-empty string,
135 causes the dynamic linker to resolve all symbols
136 at program startup instead of deferring function call resolution to the point
137 when they are first referenced.
138 This is useful when using a debugger.
141 A colon-separated list of directories in which to search for
142 ELF libraries at execution-time.
145 environment variable.
148 A whitespace-separated list of additional, user-specified, ELF shared
149 libraries to be loaded before all others.
150 This can be used to selectively override functions in other shared libraries.
151 For set-user-ID/set-group-ID ELF binaries,
152 only libraries in the standard search
153 directories that are also set-user-ID will be loaded.
155 .B LD_TRACE_LOADED_OBJECTS
157 If set to a non-empty string, causes the program to list its dynamic library
158 dependencies, as if run by
160 instead of running normally.
162 Then there are lots of more or less obscure variables,
163 many obsolete or only for internal use.
165 .B LD_AOUT_LIBRARY_PATH
169 for a.out binaries only.
170 Old versions of ld\-linux.so.1 also supported
171 .BR LD_ELF_LIBRARY_PATH .
177 for a.out binaries only.
178 Old versions of ld\-linux.so.1 also supported
183 A colon-separated list of user-specified, ELF shared objects
184 to be loaded before all others in a separate linker namespace
185 (i.e., one that does not intrude upon the normal symbol bindings that
186 would occur in the process).
187 These libraries can be used to audit the operation of the dynamic linker.
189 is ignored for set-user-ID/set-group-ID binaries.
191 The dynamic linker will notify the audit
192 libraries at so-called auditing checkpoints\(emfor example,
193 loading a new library, resolving a symbol,
194 or calling a symbol from another shared object\(emby
195 calling an appropriate function within the audit library.
198 The auditing interface is largely compatible with that provided on Solaris,
200 .IR "Linker and Libraries Guide" ,
202 .IR "Runtime Linker Auditing Interface" .
206 Do not update the GOT (global offset table) and PLT (procedure linkage table)
207 after resolving a symbol.
211 Output verbose debugging information about the dynamic linker.
214 prints all debugging information it has, if set to
216 prints a help message about which categories can be specified in this
217 environment variable.
220 is ignored for set-user-ID/set-group-ID binaries.
226 output should be fed into, default is standard output.
228 is ignored for set-user-ID/set-group-ID binaries.
232 Allow weak symbols to be overridden (reverting to old glibc behavior).
233 For security reasons, since glibc 2.3.4,
235 is ignored for set-user-ID/set-group-ID binaries.
239 Mask for hardware capabilities.
243 Don't ignore the directory in the names of a.out libraries to be loaded.
244 Use of this option is strongly discouraged.
248 Suppress warnings about a.out libraries with incompatible minor
253 Path where the binary is found (for non-set-user-ID programs).
254 For security reasons, since glibc 2.4,
256 is ignored for set-user-ID/set-group-ID binaries.
257 .\" Only used if $ORIGIN can't be determined by normal means
258 .\" (from the origin path saved at load time, or from /proc/self/exe)?
262 Set to 0 to disable pointer guarding.
263 Any other value enables pointer guarding, which is also the default.
264 Pointer guarding is a security mechanism whereby some pointers to code
265 stored in writable program memory (return addresses saved by
267 or function pointers used by various glibc internals) are mangled
268 semi-randomly to make it more difficult for an attacker to hijack
269 the pointers for use in the event of a buffer overrun or
270 stack-smashing attack.
274 Shared object to be profiled,
275 specified either as a pathname or a soname.
276 Profiling output is written to the file whose name is:
277 "\fI$LD_PROFILE_OUTPUT\fP/\fI$LD_PROFILE\fP.profile".
283 output should be written.
284 If this variable is not defined, or is defined as an empty string,
288 is ignored for set-user-ID and set-group-ID programs,
294 Show auxiliary array passed up from the kernel.
295 For security reasons, since glibc 2.3.5,
297 is ignored for set-user-ID/set-group-ID binaries.
299 .\" Document LD_TRACE_PRELINKING (e.g.: LD_TRACE_PRELINKING=libx1.so ./prog)
301 .\" Also enables DL_DEBUG_PRELINK
304 .\" http://sources.redhat.com/ml/libc-hacker/2003-11/msg00127.html
305 .\" Subject: [PATCH] Support LD_USE_LOAD_BIAS
307 By default (i.e., if this variable is not defined)
308 executables and prelinked
309 shared objects will honor base addresses of their dependent libraries
310 and (non-prelinked) position-independent executables (PIEs)
311 and other shared objects will not honor them.
314 is defined wit the value, both executables and PIEs
315 will honor the base addresses.
318 is defined with the value 0,
319 neither executables nor PIEs will honor the base addresses.
320 This variable is ignored by set-user-ID and set-group-ID programs.
324 If set to a non-empty string,
325 output symbol versioning information about the
326 program if querying information about the program (i.e., either
327 .B LD_TRACE_LOADED_OBJECTS
332 options have been given to the dynamic linker).
335 (ELF only)(glibc since 2.1.3)
336 If set to a non-empty string, warn about unresolved symbols.
343 when none is present.
348 a.out dynamic linker/loader
350 .IR /lib/ld\-linux.so. { 1 , 2 }
351 ELF dynamic linker/loader
354 File containing a compiled list of directories in which to search for
355 libraries and an ordered list of candidate libraries.
357 .I /etc/ld.so.preload
358 File containing a whitespace separated list of ELF shared libraries to
359 be loaded before the program.
367 functionality is available for executables compiled using libc version
369 ELF functionality is available since Linux 1.1.52 and libc5.
375 .\" ld.so: David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus
376 .\" Torvalds, Lars Wirzenius and Mitch D'Souza
377 .\" ld-linux.so: Roland McGrath, Ulrich Drepper and others.
379 .\" In the above, (libc5) stands for David Engel's ld.so/ld-linux.so.