]>
Commit | Line | Data |
---|---|---|
2d6c6dd1 | 1 | .\" %%%LICENSE_START(PUBLIC_DOMAIN) |
fea681da | 2 | .\" This is in the public domain |
2d6c6dd1 | 3 | .\" %%%LICENSE_END |
6a717e5e | 4 | .\" |
734882f4 | 5 | .TH LD.SO 8 2017-05-03 "GNU" "Linux Programmer's Manual" |
fea681da | 6 | .SH NAME |
d74d5bd3 | 7 | ld.so, ld\-linux.so \- dynamic linker/loader |
a1d5f77c | 8 | .SH SYNOPSIS |
cd6dddf6 | 9 | The dynamic linker can be run either indirectly by running some |
43151de3 MK |
10 | dynamically linked program or shared object |
11 | (in which case no command-line options | |
a1d5f77c MK |
12 | to the dynamic linker can be passed and, in the ELF case, the dynamic linker |
13 | which is stored in the | |
14 | .B .interp | |
15 | section of the program is executed) or directly by running: | |
16 | .P | |
d74d5bd3 | 17 | .I /lib/ld\-linux.so.* |
a1d5f77c | 18 | [OPTIONS] [PROGRAM [ARGUMENTS]] |
fea681da MK |
19 | .SH DESCRIPTION |
20 | The programs | |
21 | .B ld.so | |
22 | and | |
d74d5bd3 | 23 | .B ld\-linux.so* |
43151de3 MK |
24 | find and load the shared objects (shared libraries) needed by a program, |
25 | prepare the program to run, and then run it. | |
fea681da MK |
26 | .LP |
27 | Linux binaries require dynamic linking (linking at run time) | |
28 | unless the | |
29 | .B \-static | |
30 | option was given to | |
f19a0f03 | 31 | .BR ld (1) |
fea681da MK |
32 | during compilation. |
33 | .LP | |
34 | The program | |
35 | .B ld.so | |
36 | handles a.out binaries, a format used long ago; | |
d74d5bd3 MK |
37 | .B ld\-linux.so* |
38 | (\fI/lib/ld\-linux.so.1\fP for libc5, \fI/lib/ld\-linux.so.2\fP for glibc2) | |
d8d00ab7 MK |
39 | handles ELF, |
40 | which everybody has been using for years now. | |
2b9b829d | 41 | Otherwise, both have the same behavior, and use the same |
fea681da MK |
42 | support files and programs |
43 | .BR ldd (1), | |
9af134cd | 44 | .BR ldconfig (8), |
fea681da MK |
45 | and |
46 | .IR /etc/ld.so.conf . | |
47 | .LP | |
43151de3 | 48 | When resolving shared object dependencies, |
15d116d5 MK |
49 | the dynamic linker first inspects each dependency |
50 | string to see if it contains a slash (this can occur if | |
43151de3 | 51 | a shared object pathname containing slashes was specified at link time). |
15d116d5 MK |
52 | If a slash is found, then the dependency string is interpreted as |
53 | a (relative or absolute) pathname, | |
43151de3 | 54 | and the shared object is loaded using that pathname. |
15d116d5 | 55 | .LP |
43151de3 | 56 | If a shared object dependency does not contain a slash, |
15d116d5 | 57 | then it is searched for in the following order: |
cd6dddf6 | 58 | .IP o 3 |
dc4b358f | 59 | Using the directories specified in the |
cd6dddf6 | 60 | DT_RPATH dynamic section attribute |
fea681da MK |
61 | of the binary if present and DT_RUNPATH attribute does not exist. |
62 | Use of DT_RPATH is deprecated. | |
63 | .IP o | |
64 | Using the environment variable | |
24fb0923 MK |
65 | .BR LD_LIBRARY_PATH |
66 | (unless the executable is being run in secure-execution mode; see below). | |
880f5b4b | 67 | in which case it is ignored. |
fea681da | 68 | .IP o |
dc4b358f | 69 | Using the directories specified in the |
cd6dddf6 | 70 | DT_RUNPATH dynamic section attribute |
fea681da MK |
71 | of the binary if present. |
72 | .IP o | |
73 | From the cache file | |
de6d7600 | 74 | .IR /etc/ld.so.cache , |
43151de3 | 75 | which contains a compiled list of candidate shared objects previously found |
c13182ef | 76 | in the augmented library path. |
cd6dddf6 | 77 | If, however, the binary was linked with the |
4d9b6984 | 78 | .B \-z nodeflib |
43151de3 MK |
79 | linker option, shared objects in the default paths are skipped. |
80 | Shared objects installed in hardware capability directories (see below) | |
81 | are preferred to other shared objects. | |
fea681da MK |
82 | .IP o |
83 | In the default path | |
8478ee02 | 84 | .IR /lib , |
fea681da | 85 | and then |
8478ee02 | 86 | .IR /usr/lib . |
39a15561 | 87 | (On some 64-bit architectures, the default paths for 64-bit shared objects are |
b9359c7a MK |
88 | .IR /lib64 , |
89 | and then | |
90 | .IR /usr/lib64 .) | |
cd6dddf6 | 91 | If the binary was linked with the |
4d9b6984 | 92 | .B \-z nodeflib |
fea681da | 93 | linker option, this step is skipped. |
eeb25d47 | 94 | .SS Rpath token expansion |
0a216931 | 95 | .PP |
e01dc26a | 96 | The dynamic linker |
99194a09 MK |
97 | understands certain token strings in an rpath specification |
98 | (DT_RPATH or DT_RUNPATH). | |
99 | Those strings are substituted as follows: | |
eeb25d47 MK |
100 | .TP |
101 | .IR $ORIGIN " (or equivalently " ${ORIGIN} ) | |
8a94e783 | 102 | This expands to |
43151de3 | 103 | the directory containing the program or shared object. |
0a216931 MK |
104 | Thus, an application located in |
105 | .I somedir/app | |
106 | could be compiled with | |
eeb25d47 | 107 | |
5c977011 | 108 | gcc \-Wl,\-rpath,\(aq$ORIGIN/../lib\(aq |
eeb25d47 | 109 | |
43151de3 | 110 | so that it finds an associated shared object in |
0a216931 | 111 | .I somedir/lib |
988db661 MK |
112 | no matter where |
113 | .I somedir | |
0a216931 MK |
114 | is located in the directory hierarchy. |
115 | This facilitates the creation of "turn-key" applications that | |
116 | do not need to be installed into special directories, | |
117 | but can instead be unpacked into any directory | |
43151de3 | 118 | and still find their own shared objects. |
909df276 MK |
119 | .TP |
120 | .IR $LIB " (or equivalently " ${LIB} ) | |
121 | This expands to | |
122 | .I lib | |
123 | or | |
124 | .I lib64 | |
125 | depending on the architecture | |
126 | (e.g., on x86-64, it expands to | |
127 | .IR lib64 | |
128 | and | |
129 | on x86-32, it expands to | |
130 | .IR lib ). | |
3f2f2461 MK |
131 | .TP |
132 | .IR $PLATFORM " (or equivalently " ${PLATFORM} ) | |
133 | This expands to a string corresponding to the processor type | |
134 | of the host system (e.g., "x86_64"). | |
135 | On some architectures, the Linux kernel doesn't provide a platform | |
136 | string to the dynamic linker. | |
137 | The value of this string is taken from the | |
138 | .BR AT_PLATFORM | |
139 | value in the auxiliary vector (see | |
140 | .BR getauxval (3)). | |
141 | .\" To get an idea of the places that $PLATFORM would match, | |
142 | .\" look at the output of the following: | |
0a216931 | 143 | .\" |
3f2f2461 MK |
144 | .\" mkdir /tmp/d |
145 | .\" LD_LIBRARY_PATH=/tmp/d strace -e open /bin/date 2>&1 | grep /tmp/d | |
0a216931 MK |
146 | .\" |
147 | .\" ld.so lets names be abbreviated, so $O will work for $ORIGIN; | |
148 | .\" Don't do this!! | |
9d4869b3 | 149 | .SH OPTIONS |
fea681da | 150 | .TP |
4d9b6984 | 151 | .B \-\-list |
fea681da MK |
152 | List all dependencies and how they are resolved. |
153 | .TP | |
4d9b6984 | 154 | .B \-\-verify |
fea681da MK |
155 | Verify that program is dynamically linked and this dynamic linker can handle |
156 | it. | |
157 | .TP | |
d74d5bd3 | 158 | .B \-\-inhibit\-cache |
8584e381 MK |
159 | Do not use |
160 | .IR /etc/ld.so.cache . | |
495dadb7 | 161 | .TP |
a831ad17 MK |
162 | .BI \-\-library\-path " path" |
163 | Use | |
164 | .I path | |
165 | instead of | |
fea681da MK |
166 | .B LD_LIBRARY_PATH |
167 | environment variable setting (see below). | |
0a8909c4 MK |
168 | The names |
169 | .IR ORIGIN , | |
170 | .IR LIB , | |
171 | and | |
172 | .IR PLATFORM | |
173 | are interpreted as for the | |
174 | .BR LD_LIBRARY_PATH | |
175 | environment variable. | |
fea681da | 176 | .TP |
a831ad17 MK |
177 | .BI \-\-inhibit\-rpath " list" |
178 | Ignore RPATH and RUNPATH information in object names in | |
179 | .IR list . | |
6e1064d3 | 180 | This option is ignored when running in secure-execution mode (see below). |
608dce1f | 181 | .TP |
a831ad17 MK |
182 | .BI \-\-audit " list" |
183 | Use objects named in | |
184 | .I list | |
185 | as auditors. | |
fea681da | 186 | .SH ENVIRONMENT |
6e1064d3 | 187 | Various environment variables influence the operation of the dynamic linker. |
9894eac3 MK |
188 | .\" |
189 | .SS Secure-execution mode | |
190 | For security reasons, | |
191 | the effects of some environment variables are voided or modified if | |
192 | the dynamic linker determines that the binary should be | |
193 | run in secure-execution mode. | |
59e6b4c6 MK |
194 | (For details, see the discussion of individual environment variables below.) |
195 | A binary is executed in secure-execution mode if the | |
9894eac3 MK |
196 | .B AT_SECURE |
197 | entry in the auxiliary vector (see | |
198 | .BR getauxval (3)) | |
199 | has a nonzero value. | |
200 | This entry may have a nonzero value for various reasons, including: | |
201 | .IP * 3 | |
202 | The process's real and effective user IDs differ, | |
203 | or the real and effective group IDs differ. | |
c93f2202 | 204 | This typically occurs as a result of executing |
9894eac3 MK |
205 | a set-user-ID or set-group-ID program. |
206 | .IP * | |
207 | A process with a non-root user ID executed a binary that | |
208 | conferred permitted or effective capabilities. | |
209 | .IP * | |
210 | A nonzero value may have been set by a Linux Security Module. | |
211 | .\" | |
212 | .SS Environment variables | |
6f6a4840 | 213 | Among the more important environment variables are the following: |
fea681da | 214 | .TP |
9a741b5b | 215 | .BR LD_ASSUME_KERNEL " (since glibc 2.2.3)" |
43151de3 | 216 | Each shared object can inform the dynamic linker of the minimum kernel ABI |
eeb25d47 | 217 | version that it requires. |
ef74d4ad MK |
218 | (This requirement is encoded in an ELF note section that is viewable via |
219 | .IR "readelf\ \-n" | |
220 | as a section labeled | |
221 | .BR NT_GNU_ABI_TAG .) | |
eeb25d47 MK |
222 | At run time, |
223 | the dynamic linker determines the ABI version of the running kernel and | |
43151de3 | 224 | will reject loading shared objects that specify minimum ABI versions |
eeb25d47 MK |
225 | that exceed that ABI version. |
226 | ||
227 | .BR LD_ASSUME_KERNEL | |
228 | can be used to | |
229 | cause the dynamic linker to assume that it is running on a system with | |
230 | a different kernel ABI version. | |
231 | For example, the following command line causes the | |
232 | dynamic linker to assume it is running on Linux 2.2.5 when loading | |
43151de3 | 233 | the shared objects required by |
eeb25d47 MK |
234 | .IR myprog : |
235 | ||
236 | .in +4n | |
237 | .nf | |
238 | $ \fBLD_ASSUME_KERNEL=2.2.5 ./myprog\fP | |
239 | .fi | |
240 | .in | |
241 | ||
43151de3 | 242 | On systems that provide multiple versions of a shared object |
eeb25d47 MK |
243 | (in different directories in the search path) that have |
244 | different minimum kernel ABI version requirements, | |
245 | .BR LD_ASSUME_KERNEL | |
43151de3 | 246 | can be used to select the version of the object that is used |
eeb25d47 | 247 | (dependent on the directory search order). |
6eca8dec | 248 | |
eeb25d47 | 249 | Historically, the most common use of the |
8a94e783 | 250 | .BR LD_ASSUME_KERNEL |
eeb25d47 MK |
251 | feature was to manually select the older |
252 | LinuxThreads POSIX threads implementation on systems that provided both | |
253 | LinuxThreads and NPTL | |
260c8fcd MK |
254 | (which latter was typically the default on such systems); |
255 | see | |
256 | .BR pthreads (7). | |
eeb25d47 | 257 | .TP |
9a741b5b | 258 | .BR LD_BIND_NOW " (since glibc 2.1.1)" |
aa796481 | 259 | If set to a nonempty string, |
e1725521 MK |
260 | causes the dynamic linker to resolve all symbols |
261 | at program startup instead of deferring function call resolution to the point | |
262 | when they are first referenced. | |
263 | This is useful when using a debugger. | |
264 | .TP | |
fea681da | 265 | .B LD_LIBRARY_PATH |
75c2bb63 | 266 | A list of directories in which to search for |
e01dc26a | 267 | ELF libraries at execution time. |
75c2bb63 | 268 | The items in the list are separated by either colons or semicolons. |
c13182ef | 269 | Similar to the |
fea681da MK |
270 | .B PATH |
271 | environment variable. | |
578616fa | 272 | |
6e1064d3 | 273 | This variable is ignored in secure-execution mode. |
0a8909c4 MK |
274 | |
275 | Within the pathnames specified in | |
276 | .BR LD_LIBRARY_PATH , | |
99194a09 | 277 | the dynamic linker expands the tokens |
0a8909c4 MK |
278 | .IR $ORIGIN , |
279 | .IR $LIB , | |
280 | and | |
281 | .IR $PLATFORM | |
282 | (or the versions using curly braces around the names) | |
283 | as described above in | |
284 | .IR "Rpath token expansion" . | |
285 | Thus, for example, | |
286 | the following would cause a library to be searched for in either the | |
287 | .I lib | |
288 | or | |
289 | .I lib64 | |
290 | subdirectory below the directory containing the program to be executed: | |
291 | ||
292 | $ \fBLD_LIBRARY_PATH='$ORIGIN/$LIB' prog\fP | |
293 | ||
294 | (Note the use of single quotes, which prevent expansion of | |
99194a09 | 295 | .I $ORIGIN |
0a8909c4 | 296 | and |
99194a09 | 297 | .I $LIB |
0a8909c4 | 298 | as shell variables!) |
fea681da MK |
299 | .TP |
300 | .B LD_PRELOAD | |
df7ef267 | 301 | A list of additional, user-specified, ELF shared |
43151de3 | 302 | objects to be loaded before all others. |
df7ef267 | 303 | The items of the list can be separated by spaces or colons. |
43151de3 MK |
304 | This can be used to selectively override functions in other shared objects. |
305 | The objects are searched for using the rules given under DESCRIPTION. | |
e9a13381 | 306 | |
24fb0923 | 307 | In secure-execution mode, |
be1cf739 | 308 | preload pathnames containing slashes are ignored. |
8dd4941b | 309 | Furthermore, shared objects are preloaded only |
f4279be5 | 310 | from the standard search directories and only |
8fe4dd08 | 311 | if they have set-user-ID mode bit enabled (which is not typical). |
0a8909c4 | 312 | |
61c5564c MK |
313 | Within the names specified in the |
314 | .BR LD_PRELOAD | |
99194a09 | 315 | list, the dynamic linker understands the tokens |
0a8909c4 MK |
316 | .IR $ORIGIN , |
317 | .IR $LIB , | |
318 | and | |
319 | .IR $PLATFORM | |
320 | (or the versions using curly braces around the names) | |
321 | as described above in | |
322 | .IR "Rpath token expansion" . | |
8b2bb705 MK |
323 | (See also the discussion of quoting under the description of |
324 | .BR LD_LIBRARY_PATH .) | |
0a8909c4 MK |
325 | .\" Tested with the following: |
326 | .\" | |
327 | .\" LD_PRELOAD='$LIB/libmod.so' LD_LIBRARY_PATH=. ./prog | |
328 | .\" | |
376c2e1c | 329 | .\" which will preload the libmod.so in 'lib' or 'lib64', using it |
0a8909c4 | 330 | .\" in preference to the version in '.'. |
fea681da | 331 | .TP |
dc4b358f | 332 | .BR LD_TRACE_LOADED_OBJECTS |
01132bd6 | 333 | If set (to any value), causes the program to list its dynamic |
fea681da MK |
334 | dependencies, as if run by |
335 | .BR ldd (1), | |
336 | instead of running normally. | |
337 | .LP | |
338 | Then there are lots of more or less obscure variables, | |
339 | many obsolete or only for internal use. | |
340 | .TP | |
9a741b5b | 341 | .BR LD_AUDIT " (since glibc 2.4)" |
54eb2620 PB |
342 | A colon-separated list of user-specified, ELF shared objects |
343 | to be loaded before all others in a separate linker namespace | |
344 | (i.e., one that does not intrude upon the normal symbol bindings that | |
345 | would occur in the process). | |
43151de3 | 346 | These objects can be used to audit the operation of the dynamic linker. |
e01dc26a | 347 | .IP |
54eb2620 | 348 | .B LD_AUDIT |
24fb0923 | 349 | is ignored in secure-execution mode. |
e01dc26a | 350 | .IP |
54eb2620 | 351 | The dynamic linker will notify the audit |
43151de3 MK |
352 | shared objects at so-called auditing checkpoints\(emfor example, |
353 | loading a new shared object, resolving a symbol, | |
54eb2620 | 354 | or calling a symbol from another shared object\(emby |
43151de3 | 355 | calling an appropriate function within the audit shared object. |
54eb2620 PB |
356 | For details, see |
357 | .BR rtld-audit (7). | |
358 | The auditing interface is largely compatible with that provided on Solaris, | |
359 | as described in its | |
360 | .IR "Linker and Libraries Guide" , | |
361 | in the chapter | |
362 | .IR "Runtime Linker Auditing Interface" . | |
e01dc26a | 363 | .IP |
61c5564c MK |
364 | Within the names specified in the |
365 | .BR LD_AUDIT | |
99194a09 | 366 | list, the dynamic linker understands the tokens |
879de6e7 MK |
367 | .IR $ORIGIN , |
368 | .IR $LIB , | |
369 | and | |
370 | .IR $PLATFORM | |
371 | (or the versions using curly braces around the names) | |
372 | as described above in | |
373 | .IR "Rpath token expansion" . | |
8b2bb705 MK |
374 | (See also the discussion of quoting under the description of |
375 | .BR LD_LIBRARY_PATH .) | |
e01dc26a | 376 | .IP |
50994c10 MK |
377 | Since glibc 2.13, |
378 | .\" commit 8e9f92e9d5d7737afdacf79b76d98c4c42980508 | |
379 | in secure-execution mode, | |
380 | names in the audit list that contain slashes are ignored, | |
381 | and only shared objects in the standard search directories that | |
382 | have the set-user-ID mode bit enabled are loaded. | |
fea681da | 383 | .TP |
9a741b5b | 384 | .BR LD_BIND_NOT " (since glibc 2.1.95)" |
963c1947 MK |
385 | If this environment variable is set to a nonempty string, |
386 | do not update the GOT (global offset table) and PLT (procedure linkage table) | |
a3a72ad2 | 387 | after resolving a function symbol. |
e5e9497f MK |
388 | By combining the use of this variable with |
389 | .BR LD_DEBUG | |
390 | (with the categories | |
391 | .IR bindings | |
392 | and | |
393 | .IR symbols ), | |
394 | one can observe all run-time function bindings. | |
fea681da | 395 | .TP |
9a741b5b | 396 | .BR LD_DEBUG " (since glibc 2.1)" |
ac59a601 | 397 | Output verbose debugging information about operation of the dynamic linker. |
e28421e9 MK |
398 | The content of this variable is one of more of the following categories, |
399 | separated by colons, commas, or (if the value is quoted) spaces: | |
400 | .RS | |
401 | .TP 12 | |
402 | .I help | |
1f6bc72f MK |
403 | Specifying |
404 | .IR help | |
405 | in the value of this variable does not run the specified program, | |
d81099fb | 406 | and displays a help message about which categories can be specified in this |
fea681da | 407 | environment variable. |
e28421e9 MK |
408 | .TP |
409 | .I all | |
410 | Print all debugging information (except | |
411 | .IR statistics | |
412 | and | |
413 | .IR unused ; | |
414 | see below). | |
415 | .TP | |
d81099fb MK |
416 | .I bindings |
417 | Display information about which definition each symbol is bound to. | |
418 | .TP | |
419 | .I files | |
420 | Display progress for input file. | |
421 | .TP | |
422 | .I libs | |
423 | Display library search paths. | |
424 | .TP | |
425 | .I reloc | |
426 | Display relocation processing. | |
427 | .TP | |
428 | .I scopes | |
429 | Display scope information. | |
430 | .TP | |
431 | .I statistics | |
432 | Display relocation statistics. | |
433 | .TP | |
434 | .I symbols | |
435 | Display search paths for each symbol look-up. | |
436 | .TP | |
437 | .I unused | |
438 | Determine unused DSOs. | |
439 | .TP | |
440 | .I versions | |
441 | Display version dependencies. | |
442 | .RE | |
443 | .IP | |
e4c14bd9 MK |
444 | Since glibc 2.3.4, |
445 | .B LD_DEBUG | |
ae861bf1 MG |
446 | is ignored in secure-execution mode, unless the file |
447 | .IR /etc/suid\-debug | |
448 | exists (the content of the file is irrelevant). | |
fea681da | 449 | .TP |
9a741b5b | 450 | .BR LD_DEBUG_OUTPUT " (since glibc 2.1)" |
fe689ea4 | 451 | By default, |
fea681da | 452 | .B LD_DEBUG |
fe689ea4 MK |
453 | output is written to standard error. |
454 | If | |
455 | .B LD_DEBUG_OUTPUT | |
456 | is defined, then output is written to the pathname specified by its value, | |
457 | with the suffix "." (dot) followed by the process ID appended to the pathname. | |
578616fa | 458 | |
097585ed | 459 | .B LD_DEBUG_OUTPUT |
24fb0923 | 460 | is ignored in secure-execution mode. |
fea681da | 461 | .TP |
9a741b5b | 462 | .BR LD_DYNAMIC_WEAK " (since glibc 2.1.91)" |
3337a4a3 MK |
463 | By default, when searching shared libraries to resolve a symbol reference, |
464 | the dynamic linker will resolve to the first definition it finds. | |
465 | ||
466 | Old glibc versions (before 2.2), provided a different behavior: | |
467 | if the linker found a symbol that was weak, | |
468 | it would remember that symbol and | |
469 | keep searching in the remaining shared libraries. | |
470 | If it subsequently found a strong definition of the same symbol, | |
471 | then it would instead use that definition. | |
472 | (If no further symbol was found, | |
473 | then the dynamic linker would use the weak symbol that it initially found.) | |
474 | ||
475 | The old glibc behavior was nonstandard. | |
f4279be5 | 476 | (Standard practice is that the distinction between |
3337a4a3 | 477 | weak and strong symbols should have effect only at static link time.) |
ae5686f6 | 478 | In glibc 2.2, |
3337a4a3 | 479 | .\" More precisely 2.1.92 |
c595ec7e MK |
480 | .\" See weak handling |
481 | .\" https://www.sourceware.org/ml/libc-hacker/2000-06/msg00029.html | |
482 | .\" To: GNU libc hacker <libc-hacker at sourceware dot cygnus dot com> | |
483 | .\" Subject: weak handling | |
484 | .\" From: Ulrich Drepper <drepper at redhat dot com> | |
485 | .\" Date: 07 Jun 2000 20:08:12 -0700 | |
486 | .\" Reply-To: drepper at cygnus dot com (Ulrich Drepper) | |
3337a4a3 MK |
487 | the dynamic linker was modified to provide the current behavior |
488 | (which was the behavior that was provided by most other implementations | |
489 | at that time). | |
490 | ||
491 | Defining the | |
492 | .B LD_DYNAMIC_WEAK | |
493 | environment variable (with any value) provides | |
494 | the old (nonstandard) glibc behavior, | |
495 | whereby a weak symbol in one shared library may be overridden by | |
496 | a strong symbol subsequently discovered in another shared library. | |
497 | (Note that even when this variable is set, | |
498 | a strong symbol in a shared library will not override | |
499 | a weak definition of the same symbol in the main program.) | |
578616fa | 500 | |
6e1064d3 | 501 | Since glibc 2.3.4, |
e1725521 | 502 | .B LD_DYNAMIC_WEAK |
24fb0923 | 503 | is ignored in secure-execution mode. |
e1725521 | 504 | .TP |
9a741b5b | 505 | .BR LD_HWCAP_MASK " (since glibc 2.1)" |
e1725521 MK |
506 | Mask for hardware capabilities. |
507 | .TP | |
9a741b5b | 508 | .BR LD_ORIGIN_PATH " (since glibc 2.1)" |
71ffb3ed | 509 | Path where the binary is found. |
578616fa MK |
510 | .\" Used only if $ORIGIN can't be determined by normal means |
511 | .\" (from the origin path saved at load time, or from /proc/self/exe)? | |
512 | ||
24fb0923 | 513 | Since glibc 2.4, |
e1725521 | 514 | .B LD_ORIGIN_PATH |
24fb0923 | 515 | is ignored in secure-execution mode. |
7b0cacbb | 516 | .TP |
bdf75f3e | 517 | .BR LD_POINTER_GUARD " (glibc from 2.4 to 2.22)" |
7b0cacbb PB |
518 | Set to 0 to disable pointer guarding. |
519 | Any other value enables pointer guarding, which is also the default. | |
520 | Pointer guarding is a security mechanism whereby some pointers to code | |
521 | stored in writable program memory (return addresses saved by | |
522 | .BR setjmp (3) | |
523 | or function pointers used by various glibc internals) are mangled | |
524 | semi-randomly to make it more difficult for an attacker to hijack | |
525 | the pointers for use in the event of a buffer overrun or | |
526 | stack-smashing attack. | |
ca1c3729 MK |
527 | Since glibc 2.23, |
528 | .\" commit a014cecd82b71b70a6a843e250e06b541ad524f7 | |
529 | .B LD_POINTER_GUARD | |
530 | can no longer be used to disable pointer guarding, | |
531 | which is now always enabled. | |
fea681da | 532 | .TP |
9a741b5b | 533 | .BR LD_PROFILE " (since glibc 2.1)" |
7c7a7df3 | 534 | The name of a (single) shared object to be profiled, |
8a7f3759 | 535 | specified either as a pathname or a soname. |
c64ea262 | 536 | Profiling output is appended to the file whose name is: |
8a7f3759 | 537 | "\fI$LD_PROFILE_OUTPUT\fP/\fI$LD_PROFILE\fP.profile". |
24dc407a MK |
538 | |
539 | Since glibc 2.2.5, | |
540 | .BR LD_PROFILE | |
d74d5bd3 | 541 | is ignored in secure-execution mode. |
fea681da | 542 | .TP |
9a741b5b | 543 | .BR LD_PROFILE_OUTPUT " (since glibc 2.1)" |
8a7f3759 | 544 | Directory where |
fea681da | 545 | .B LD_PROFILE |
8a7f3759 MK |
546 | output should be written. |
547 | If this variable is not defined, or is defined as an empty string, | |
548 | then the default is | |
549 | .IR /var/tmp . | |
578616fa | 550 | |
097585ed | 551 | .B LD_PROFILE_OUTPUT |
8977c66c MK |
552 | is ignored in secure-execution mode; instead |
553 | .IR /var/profile | |
554 | is always used. | |
24dc407a MK |
555 | (This detail is relevant only before glibc 2.2.5, |
556 | since in later glibc versions, | |
557 | .B LD_PROFILE | |
558 | is also ignored in secure-execution mode.) | |
fea681da | 559 | .TP |
9a741b5b | 560 | .BR LD_SHOW_AUXV " (since glibc 2.1)" |
b5ccc9bb MK |
561 | If this environment variable is defined (with any value), |
562 | show the auxiliary array passed up from the kernel (see also | |
563 | .BR getauxval (3)). | |
578616fa | 564 | |
ee955285 | 565 | Since glibc 2.3.4, |
ca2bcde1 | 566 | .B LD_SHOW_AUXV |
24fb0923 | 567 | is ignored in secure-execution mode. |
de2a932a | 568 | .TP |
9a741b5b | 569 | .BR LD_TRACE_PRELINKING " (since glibc 2.4)" |
f416bfde | 570 | If this environment variable is defined, |
a5817257 | 571 | trace prelinking of the object whose name is assigned to |
de2a932a MK |
572 | this environment variable. |
573 | (Use | |
574 | .BR ldd (1) | |
575 | to get a list of the objects that might be traced.) | |
576 | If the object name is not recognized, | |
577 | .\" (This is what seems to happen, from experimenting) | |
578 | then all prelinking activity is traced. | |
fea681da | 579 | .TP |
9a741b5b | 580 | .BR LD_USE_LOAD_BIAS " (since glibc 2.3.3)" |
e1725521 MK |
581 | .\" http://sources.redhat.com/ml/libc-hacker/2003-11/msg00127.html |
582 | .\" Subject: [PATCH] Support LD_USE_LOAD_BIAS | |
583 | .\" Jakub Jelinek | |
2656a3fa | 584 | By default (i.e., if this variable is not defined), |
e1725521 | 585 | executables and prelinked |
43151de3 | 586 | shared objects will honor base addresses of their dependent shared objects |
24b74457 | 587 | and (nonprelinked) position-independent executables (PIEs) |
e1725521 MK |
588 | and other shared objects will not honor them. |
589 | If | |
590 | .B LD_USE_LOAD_BIAS | |
dc70d1ea | 591 | is defined with the value 1, both executables and PIEs |
e1725521 MK |
592 | will honor the base addresses. |
593 | If | |
594 | .B LD_USE_LOAD_BIAS | |
595 | is defined with the value 0, | |
596 | neither executables nor PIEs will honor the base addresses. | |
578616fa | 597 | |
daad3ee9 | 598 | Since glibc 2.3.3, this variable is ignored in secure-execution mode. |
fea681da | 599 | .TP |
9a741b5b | 600 | .BR LD_VERBOSE " (since glibc 2.1)" |
aa796481 | 601 | If set to a nonempty string, |
e1725521 | 602 | output symbol versioning information about the |
2216fac7 | 603 | program if the |
e1725521 | 604 | .B LD_TRACE_LOADED_OBJECTS |
2216fac7 | 605 | environment variable has been set. |
fea681da | 606 | .TP |
dc4b358f | 607 | .BR LD_WARN " (since glibc 2.1.3) |
aa796481 | 608 | If set to a nonempty string, warn about unresolved symbols. |
fea681da | 609 | .TP |
9a741b5b | 610 | .BR LD_PREFER_MAP_32BIT_EXEC " (x86-64 only; since glibc 2.23)" |
3cdc1fc4 | 611 | According to the Intel Silvermont software optimization guide, for 64-bit |
5b479f37 L |
612 | applications, branch prediction performance can be negatively impacted |
613 | when the target of a branch is more than 4GB away from the branch. | |
3cdc1fc4 | 614 | If this environment variable is set (to any value), |
e01dc26a | 615 | the dynamic linker |
3cdc1fc4 MK |
616 | will first try to map executable pages using the |
617 | .BR mmap (2) | |
618 | .BR MAP_32BIT | |
619 | flag, and fall back to mapping without that flag if that attempt fails. | |
81583be9 | 620 | NB: MAP_32BIT will map to the low 2GB (not 4GB) of the address space. |
578616fa | 621 | |
3cdc1fc4 MK |
622 | Because |
623 | .B MAP_32BIT | |
624 | reduces the address range available for address space layout | |
625 | randomization (ASLR), | |
626 | .B LD_PREFER_MAP_32BIT_EXEC | |
627 | is always disabled in secure-execution mode. | |
fea681da MK |
628 | .SH FILES |
629 | .PD 0 | |
630 | .TP | |
8478ee02 | 631 | .I /lib/ld.so |
fea681da MK |
632 | a.out dynamic linker/loader |
633 | .TP | |
8478ee02 | 634 | .IR /lib/ld\-linux.so. { 1 , 2 } |
fea681da MK |
635 | ELF dynamic linker/loader |
636 | .TP | |
8478ee02 | 637 | .I /etc/ld.so.cache |
fea681da | 638 | File containing a compiled list of directories in which to search for |
43151de3 | 639 | shared objects and an ordered list of candidate shared objects. |
a110286b MK |
640 | See |
641 | .BR ldconfig (8). | |
fea681da | 642 | .TP |
8478ee02 | 643 | .I /etc/ld.so.preload |
43151de3 | 644 | File containing a whitespace-separated list of ELF shared objects to |
fea681da | 645 | be loaded before the program. |
95b6bd72 MK |
646 | See the discussion of |
647 | .BR LD_PRELOAD | |
648 | above. | |
649 | If both | |
650 | .BR LD_PRELOAD | |
651 | and | |
652 | .I /etc/ld.so.preload | |
653 | are employed, the libraries specified by | |
654 | .BR LD_PRELOAD | |
655 | are preloaded first. | |
656 | .I /etc/ld.so.preload | |
657 | has a system-wide effect, | |
658 | causing the specified libraries to be preloaded for | |
659 | all programs that are executed on the system. | |
660 | (This is usually undesirable, | |
661 | and is typically employed only as an emergency remedy, for example, | |
662 | as a temporary workaround to a library misconfiguration issue.) | |
fea681da MK |
663 | .TP |
664 | .B lib*.so* | |
43151de3 | 665 | shared objects |
fea681da MK |
666 | .PD |
667 | .SH NOTES | |
8ce45022 | 668 | .SS Hardware capabilities |
43151de3 | 669 | Some shared objects are compiled using hardware-specific instructions which do |
8ce45022 | 670 | not exist on every CPU. |
43151de3 | 671 | Such objects should be installed in directories whose names define the |
8ce45022 MK |
672 | required hardware capabilities, such as |
673 | .IR /usr/lib/sse2/ . | |
674 | The dynamic linker checks these directories against the hardware of the | |
43151de3 | 675 | machine and selects the most suitable version of a given shared object. |
8ce45022 MK |
676 | Hardware capability directories can be cascaded to combine CPU features. |
677 | The list of supported hardware capability names depends on the CPU. | |
678 | The following names are currently recognized: | |
679 | .TP | |
680 | .B Alpha | |
681 | ev4, ev5, ev56, ev6, ev67 | |
682 | .TP | |
683 | .B MIPS | |
684 | loongson2e, loongson2f, octeon, octeon2 | |
685 | .TP | |
686 | .B PowerPC | |
687 | 4xxmac, altivec, arch_2_05, arch_2_06, booke, cellbe, dfp, efpdouble, efpsingle, | |
688 | fpu, ic_snoop, mmu, notb, pa6t, power4, power5, power5+, power6x, ppc32, ppc601, | |
689 | ppc64, smt, spe, ucache, vsx | |
690 | .TP | |
691 | .B SPARC | |
692 | flush, muldiv, stbar, swap, ultra3, v9, v9v, v9v2 | |
693 | .TP | |
694 | .B s390 | |
695 | dfp, eimm, esan3, etf3enh, g5, highgprs, hpage, ldisp, msa, stfle, | |
696 | z900, z990, z9-109, z10, zarch | |
697 | .TP | |
698 | .B x86 (32-bit only) | |
699 | acpi, apic, clflush, cmov, cx8, dts, fxsr, ht, i386, i486, i586, i686, mca, mmx, | |
700 | mtrr, pat, pbe, pge, pn, pse36, sep, ss, sse, sse2, tm | |
fea681da | 701 | .SH SEE ALSO |
6b432477 | 702 | .BR ld (1), |
fea681da | 703 | .BR ldd (1), |
1a7735bb | 704 | .BR pldd (1), |
cf28f98a | 705 | .BR sprof (1), |
639c8860 | 706 | .BR dlopen (3), |
45fa8fcb | 707 | .BR getauxval (3), |
cef5dc27 | 708 | .BR elf (5), |
9894eac3 | 709 | .BR capabilities (7), |
c18ecec9 | 710 | .BR rtld-audit (7), |
4d96fe33 MK |
711 | .BR ldconfig (8), |
712 | .BR sln (8) | |
fea681da MK |
713 | .\" .SH AUTHORS |
714 | .\" ld.so: David Engel, Eric Youngdale, Peter MacDonald, Hongjiu Lu, Linus | |
715 | .\" Torvalds, Lars Wirzenius and Mitch D'Souza | |
d74d5bd3 | 716 | .\" ld\-linux.so: Roland McGrath, Ulrich Drepper and others. |
fea681da | 717 | .\" |
d74d5bd3 | 718 | .\" In the above, (libc5) stands for David Engel's ld.so/ld\-linux.so. |