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.
131 Use objects named in LIST as auditors.
133 There are four important environment variables.
136 (libc5; glibc since 2.1.1)
137 If set to a nonempty string,
138 causes the dynamic linker to resolve all symbols
139 at program startup instead of deferring function call resolution to the point
140 when they are first referenced.
141 This is useful when using a debugger.
144 A colon-separated list of directories in which to search for
145 ELF libraries at execution-time.
148 environment variable.
151 A whitespace-separated list of additional, user-specified, ELF shared
152 libraries to be loaded before all others.
153 This can be used to selectively override functions in other shared libraries.
154 For set-user-ID/set-group-ID ELF binaries,
155 only libraries in the standard search
156 directories that are also set-user-ID will be loaded.
158 .B LD_TRACE_LOADED_OBJECTS
160 If set to a nonempty string, causes the program to list its dynamic library
161 dependencies, as if run by
163 instead of running normally.
165 Then there are lots of more or less obscure variables,
166 many obsolete or only for internal use.
168 .B LD_AOUT_LIBRARY_PATH
172 for a.out binaries only.
173 Old versions of ld\-linux.so.1 also supported
174 .BR LD_ELF_LIBRARY_PATH .
180 for a.out binaries only.
181 Old versions of ld\-linux.so.1 also supported
186 A colon-separated list of user-specified, ELF shared objects
187 to be loaded before all others in a separate linker namespace
188 (i.e., one that does not intrude upon the normal symbol bindings that
189 would occur in the process).
190 These libraries can be used to audit the operation of the dynamic linker.
192 is ignored for set-user-ID/set-group-ID binaries.
194 The dynamic linker will notify the audit
195 libraries at so-called auditing checkpoints\(emfor example,
196 loading a new library, resolving a symbol,
197 or calling a symbol from another shared object\(emby
198 calling an appropriate function within the audit library.
201 The auditing interface is largely compatible with that provided on Solaris,
203 .IR "Linker and Libraries Guide" ,
205 .IR "Runtime Linker Auditing Interface" .
209 Do not update the GOT (global offset table) and PLT (procedure linkage table)
210 after resolving a symbol.
214 Output verbose debugging information about the dynamic linker.
217 prints all debugging information it has, if set to
219 prints a help message about which categories can be specified in this
220 environment variable.
223 is ignored for set-user-ID/set-group-ID binaries.
229 output should be fed into, default is standard output.
231 is ignored for set-user-ID/set-group-ID binaries.
235 Allow weak symbols to be overridden (reverting to old glibc behavior).
236 For security reasons, since glibc 2.3.4,
238 is ignored for set-user-ID/set-group-ID binaries.
242 Mask for hardware capabilities.
246 Don't ignore the directory in the names of a.out libraries to be loaded.
247 Use of this option is strongly discouraged.
251 Suppress warnings about a.out libraries with incompatible minor
256 Path where the binary is found (for non-set-user-ID programs).
257 For security reasons, since glibc 2.4,
259 is ignored for set-user-ID/set-group-ID binaries.
260 .\" Only used if $ORIGIN can't be determined by normal means
261 .\" (from the origin path saved at load time, or from /proc/self/exe)?
265 Set to 0 to disable pointer guarding.
266 Any other value enables pointer guarding, which is also the default.
267 Pointer guarding is a security mechanism whereby some pointers to code
268 stored in writable program memory (return addresses saved by
270 or function pointers used by various glibc internals) are mangled
271 semi-randomly to make it more difficult for an attacker to hijack
272 the pointers for use in the event of a buffer overrun or
273 stack-smashing attack.
277 Shared object to be profiled,
278 specified either as a pathname or a soname.
279 Profiling output is written to the file whose name is:
280 "\fI$LD_PROFILE_OUTPUT\fP/\fI$LD_PROFILE\fP.profile".
286 output should be written.
287 If this variable is not defined, or is defined as an empty string,
291 is ignored for set-user-ID and set-group-ID programs,
297 Show auxiliary array passed up from the kernel.
298 For security reasons, since glibc 2.3.5,
300 is ignored for set-user-ID/set-group-ID binaries.
302 .\" Document LD_TRACE_PRELINKING (e.g.: LD_TRACE_PRELINKING=libx1.so ./prog)
304 .\" Also enables DL_DEBUG_PRELINK
307 .\" http://sources.redhat.com/ml/libc-hacker/2003-11/msg00127.html
308 .\" Subject: [PATCH] Support LD_USE_LOAD_BIAS
310 By default (i.e., if this variable is not defined)
311 executables and prelinked
312 shared objects will honor base addresses of their dependent libraries
313 and (nonprelinked) position-independent executables (PIEs)
314 and other shared objects will not honor them.
317 is defined wit the value, both executables and PIEs
318 will honor the base addresses.
321 is defined with the value 0,
322 neither executables nor PIEs will honor the base addresses.
323 This variable is ignored by set-user-ID and set-group-ID programs.
327 If set to a nonempty string,
328 output symbol versioning information about the
329 program if querying information about the program (i.e., either
330 .B LD_TRACE_LOADED_OBJECTS
335 options have been given to the dynamic linker).
338 (ELF only)(glibc since 2.1.3)
339 If set to a nonempty string, warn about unresolved symbols.
346 when none is present.
351 a.out dynamic linker/loader
353 .IR /lib/ld\-linux.so. { 1 , 2 }
354 ELF dynamic linker/loader
357 File containing a compiled list of directories in which to search for
358 libraries and an ordered list of candidate libraries.
360 .I /etc/ld.so.preload
361 File containing a whitespace separated list of ELF shared libraries to
362 be loaded before the program.
370 functionality is available for executables compiled using libc version
372 ELF functionality is available since Linux 1.1.52 and libc5.
378 .\" ld.so: David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus
379 .\" Torvalds, Lars Wirzenius and Mitch D'Souza
380 .\" ld-linux.so: Roland McGrath, Ulrich Drepper and others.
382 .\" In the above, (libc5) stands for David Engel's ld.so/ld-linux.so.