1LD.SO(8) Linux Programmer's Manual LD.SO(8)
2
3
4
6 ld.so, ld-linux.so* - dynamic linker/loader
7
9 The programs ld.so and ld-linux.so* find and load the shared libraries
10 needed by a program, prepare the program to run, and then run it.
11
12 Linux binaries require dynamic linking (linking at run time) unless the
13 -static option was given to ld during compilation.
14
15 The program ld.so handles a.out binaries, a format used long ago; ld-
16 linux.so* handles ELF (/lib/ld-linux.so.1 for libc5, /lib/ld-linux.so.2
17 for glibc2), which everybody has been using for years now. Otherwise
18 both have the same behaviour, and use the same support files and pro‐
19 grams ldd(1), ldconfig(8) and /etc/ld.so.conf.
20
21 The shared libraries needed by the program are searched for in various
22 places:
23
24 o (ELF only) Using the DT_RPATH dynamic section attribute of the
25 binary if present and DT_RUNPATH attribute does not exist. Use
26 of DT_RPATH is deprecated.
27
28 o Using the environment variable LD_LIBRARY_PATH. Except if the
29 executable is a set-user-ID/set-group-ID binary, in which case
30 it is ignored.
31
32 o (ELF only) Using the DT_RUNPATH dynamic section attribute of the
33 binary if present.
34
35 o From the cache file /etc/ld.so.cache which contains a compiled
36 list of candidate libraries previously found in the augmented
37 library path. If, however, the binary was linked with -z node‐
38 flib linker option, libraries in the default library paths are
39 skipped.
40
41 o In the default path /lib, and then /usr/lib. If the binary was
42 linked with -z nodeflib linker option, this step is skipped.
43
45 The dynamic linker can be run either indirectly through running some
46 dynamically linked program or library (in which case no command line
47 options to the dynamic linker can be passed and, in the ELF case, the
48 dynamic linker which is stored in the .interp section of the program is
49 executed) or directly by running:
50
51 /lib/ld-linux.so.* [OPTIONS] [PROGRAM [ARGUMENTS]]
52
54 --list List all dependencies and how they are resolved.
55
56 --verify
57 Verify that program is dynamically linked and this dynamic
58 linker can handle it.
59
60 --library-path PATH
61 Override LD_LIBRARY_PATH environment variable setting (see
62 below).
63
64 --ignore-rpath LIST
65 Ignore RPATH and RUNPATH information in object names in LIST.
66 This option has been supported by glibc2 for about one hour.
67 Then it was renamed into:
68
69 --inhibit-rpath LIST
70
72 There are four important environment variables.
73
74 LD_LIBRARY_PATH
75 A colon-separated list of directories in which to search for ELF
76 libraries at execution-time. Similar to the PATH environment
77 variable.
78
79 LD_PRELOAD
80 A whitespace-separated list of additional, user-specified, ELF
81 shared libraries to be loaded before all others. This can be
82 used to selectively override functions in other shared
83 libraries. For set-user-ID/set-group-ID ELF binaries, only
84 libraries in the standard search directories that are also set-
85 user-ID will be loaded.
86
87 LD_BIND_NOW
88 (libc5; glibc since 2.1.1) If set to non-empty string, causes
89 the dynamic linker to resolve all symbols at program startup
90 instead of deferring function call resolval to the point when
91 they are first referenced. This is useful when using a debug‐
92 ger.
93
94 LD_TRACE_LOADED_OBJECTS
95 (ELF only) If set to non-empty string, causes the program to
96 list its dynamic library dependencies, as if run by ldd(1),
97 instead of running normally.
98
99 Then there are lots of more or less obscure variables, many obsolete or
100 only for internal use.
101
102 LD_WARN
103 (ELF only)(glibc since 2.1.3) If set to non-empty string, warn
104 about unresolved symbols.
105
106 LD_NOWARN
107 (a.out only)(libc5) Suppress warnings about a.out libraries with
108 incompatible minor version numbers.
109
110 LD_BIND_NOT
111 (glibc since 2.1.95) Do not update the GOT (global offset table)
112 and PLT (procedure linkage table) after resolving a symbol.
113
114 LD_DEBUG
115 (glibc since 2.1) Output verbose debugging information about the
116 dynamic linker. If set to all prints all debugging information
117 it has, if set to help prints a help message about which cate‐
118 gories can be specified in this environment variable.
119
120 LD_DEBUG_OUTPUT
121 (glibc since 2.1) File where LD_DEBUG output should be fed into,
122 default is standard output. LD_DEBUG_OUTPUT is ignored for set-
123 user-ID/set-group-ID binaries.
124
125 LD_VERBOSE
126 (glibc since 2.1) If set to non-empty string, output symbol ver‐
127 sioning information about the program if querying information
128 about the program (ie. either LD_TRACE_LOADED_OBJECTS has been
129 set, or --list or --verify options have been given to the
130 dynamic linker).
131
132 LD_PROFILE
133 (glibc since 2.1) Shared object to be profiled.
134
135 LD_PROFILE_OUTPUT
136 (glibc since 2.1) File where LD_PROFILE output should be stored,
137 default is standard output. LD_PROFILE_OUTPUT is ignored for
138 set-user-ID/set-group-ID binaries.
139
140 LD_AOUT_LIBRARY_PATH
141 (libc5) Version of LD_LIBRARY_PATH for a.out binaries only. Old
142 versions of ld-linux.so.1 also supported LD_ELF_LIBRARY_PATH.
143
144 LD_AOUT_PRELOAD
145 (libc5) Version of LD_PRELOAD for a.out binaries only. Old ver‐
146 sions of ld-linux.so.1 also supported LD_ELF_PRELOAD.
147
148 LD_SHOW_AUXV
149 (glibc since 2.1) Show auxiliary array passed up from the ker‐
150 nel.
151
152 LD_HWCAP_MASK
153 (glibc since 2.1) Mask for hardware capabilities.
154
155 LD_ORIGIN_PATH
156 (glibc since 2.1) Path where the binary is found (for non-set-
157 user-ID programs).
158
159 LD_DYNAMIC_WEAK
160 (glibc since 2.1.91) Allow weak symbols to be overridden
161 (reverting to old glibc behaviour).
162
163 LD_KEEPDIR
164 (a.out only)(libc5) Don't ignore the directory in the names of
165 a.out libraries to be loaded. Use of this option is strongly
166 discouraged.
167
168 LDD_ARGV0
169 (libc5) argv[0] to be used by ldd(1) when none is present.
170
172 /lib/ld.so
173 a.out dynamic linker/loader
174 /lib/ld-linux.so.{1,2}
175 ELF dynamic linker/loader
176 /etc/ld.so.cache
177 File containing a compiled list of directories in which to
178 search for libraries and an ordered list of candidate libraries.
179 /etc/ld.so.preload
180 File containing a whitespace separated list of ELF shared
181 libraries to be loaded before the program.
182 lib*.so*
183 shared libraries
184
186 The ld.so functionality is available for executables compiled using
187 libc version 4.4.3 or greater. ELF functionality is available since
188 Linux 1.1.52 and libc5.
189
191 ldd(1), ldconfig(8)
192
193
194
195 2001-12-16 LD.SO(8)