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