]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1995-2000 David Engel (david@ods.com) |
2 | .\" Copyright 1995 Rickard E. Faith (faith@cs.unc.edu) | |
3 | .\" Copyright 2000 Ben Collins (bcollins@debian.org) | |
4 | .\" Redone for GLibc 2.2 | |
5 | .\" Copyright 2000 Jakub Jelinek (jakub@redhat.com) | |
6 | .\" Corrected. | |
e15805cc | 7 | .\" and Copyright (C) 2012, 2016, Michael Kerrisk <mtk.manpages@gmail.com> |
2297bf0e | 8 | .\" |
fd0fc519 | 9 | .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) |
558f3367 | 10 | .\" Do not restrict distribution. |
fea681da | 11 | .\" May be distributed under the GNU General Public License |
fd0fc519 | 12 | .\" %%%LICENSE_END |
4784c377 | 13 | .\" |
9ba01802 | 14 | .TH LDD 1 2019-03-06 "" "Linux Programmer's Manual" |
fea681da | 15 | .SH NAME |
43151de3 | 16 | ldd \- print shared object dependencies |
fea681da | 17 | .SH SYNOPSIS |
1b369cc6 | 18 | .BR ldd " [\fIoption\fP]... \fIfile\fP..." |
fea681da MK |
19 | .SH DESCRIPTION |
20 | .B ldd | |
30ea59e7 | 21 | prints the shared objects (shared libraries) required by each program or |
43151de3 | 22 | shared object specified on the command line. |
98ea8ea3 | 23 | An example of its use and output is the following: |
e18862b0 MK |
24 | .PP |
25 | .in +2n | |
26 | .EX | |
98ea8ea3 MK |
27 | $ \fBldd /bin/ls\fP |
28 | linux-vdso.so.1 (0x00007ffcc3563000) | |
29 | libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000) | |
30 | libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000) | |
31 | libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000) | |
32 | libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000) | |
33 | libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000) | |
34 | /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000) | |
35 | libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000) | |
36 | libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000) | |
e18862b0 MK |
37 | .EE |
38 | .in | |
39 | .PP | |
ca93a9ed MK |
40 | In the usual case, |
41 | .B ldd | |
42 | invokes the standard dynamic linker (see | |
053439c9 | 43 | .BR ld.so (8)) |
ca93a9ed MK |
44 | with the |
45 | .B LD_TRACE_LOADED_OBJECTS | |
98ea8ea3 MK |
46 | environment variable set to 1. |
47 | This causes the dynamic linker to inspect the program's dynamic dependencies, | |
48 | and find (according to the rules described in | |
49 | .BR ld.so (8)) | |
50 | and load the objects that satisfy those dependencies. | |
51 | For each dependency, | |
a28b73cd | 52 | .B ldd |
98ea8ea3 MK |
53 | displays the location of the matching object |
54 | and the (hexadecimal) address at which it is loaded. | |
55 | (The | |
56 | .I linux-vdso | |
57 | and | |
58 | .I ld-linux | |
59 | shared dependencies are special; see | |
60 | .BR vdso (7) | |
61 | and | |
62 | .BR ld.so (8).) | |
63 | .\" | |
64 | .SS Security | |
7106a194 MK |
65 | Be aware that in some circumstances |
66 | (e.g., where the program specifies an ELF interpreter other than | |
67 | .IR ld-linux.so ), | |
68 | .\" The circumstances are where the program has an interpreter | |
69 | .\" other than ld-linux.so. In this case, ldd tries to execute the | |
70 | .\" program directly with LD_TRACE_LOADED_OBJECTS=1, with the | |
71 | .\" result that the program interpreter gets control, and can do | |
72 | .\" what it likes, or pass control to the program itself. | |
73 | .\" Much more detail at | |
74 | .\" http://www.catonmat.net/blog/ldd-arbitrary-code-execution/ | |
75 | some versions of | |
a28b73cd | 76 | .B ldd |
ca93a9ed | 77 | may attempt to obtain the dependency information |
e5486b10 MK |
78 | by attempting to directly execute the program, |
79 | which may lead to the execution of whatever code is defined | |
7106a194 | 80 | in the program's ELF interpreter, |
e5486b10 | 81 | and perhaps to execution of the program itself. |
ca93a9ed MK |
82 | .\" Mainline glibc's ldd allows this possibility (the line |
83 | .\" try_trace "$file" | |
84 | .\" in glibc 2.15, for example), but many distro versions of | |
85 | .\" ldd seem to remove that code path from the script. | |
072337de MK |
86 | (In glibc versions before 2.27, |
87 | .\" glibc commit eedca9772e99c72ab4c3c34e43cc764250aa3e3c | |
e5486b10 MK |
88 | the upstream |
89 | .B ldd | |
90 | implementation did this for example, | |
91 | although most distributions provided a modified version that did not.) | |
92 | .PP | |
ca93a9ed MK |
93 | Thus, you should |
94 | .I never | |
95 | employ | |
96 | .B ldd | |
97 | on an untrusted executable, | |
98 | since this may result in the execution of arbitrary code. | |
99 | A safer alternative when dealing with untrusted executables is: | |
e18862b0 MK |
100 | .PP |
101 | .in +4n | |
102 | .EX | |
103 | $ \fBobjdump \-p /path/to/program | grep NEEDED\fP | |
104 | .EE | |
105 | .in | |
106 | .PP | |
cec34a46 MK |
107 | Note, however, that this alternative shows only the direct dependencies |
108 | of the executable, while | |
109 | .B ldd | |
110 | shows the entire dependency tree of the executable. | |
fea681da MK |
111 | .SH OPTIONS |
112 | .TP | |
9de38bff | 113 | .B \-\-version |
fea681da MK |
114 | Print the version number of |
115 | .BR ldd . | |
116 | .TP | |
ed74a1a1 | 117 | .BR \-v ", " \-\-verbose |
75b94dc3 MK |
118 | Print all information, including, for example, |
119 | symbol versioning information. | |
fea681da | 120 | .TP |
ed74a1a1 | 121 | .BR \-u ", " \-\-unused |
46672d0d | 122 | Print unused direct dependencies. |
cd38a583 | 123 | (Since glibc 2.3.4.) |
46672d0d | 124 | .TP |
ed74a1a1 | 125 | .BR \-d ", " \-\-data\-relocs |
fea681da MK |
126 | Perform relocations and report any missing objects (ELF only). |
127 | .TP | |
ed74a1a1 | 128 | .BR \-r ", " \-\-function\-relocs |
fea681da MK |
129 | Perform relocations for both data objects and functions, and |
130 | report any missing objects or functions (ELF only). | |
131 | .TP | |
132 | .B \-\-help | |
133 | Usage information. | |
2fb50e2a MK |
134 | .\" .SH NOTES |
135 | .\" The standard version of | |
136 | .\" .B ldd | |
137 | .\" comes with glibc2. | |
138 | .\" Libc5 came with an older version, still present | |
139 | .\" on some systems. | |
140 | .\" The long options are not supported by the libc5 version. | |
141 | .\" On the other hand, the glibc2 version does not support | |
142 | .\" .B \-V | |
143 | .\" and only has the equivalent | |
144 | .\" .BR \-\-version . | |
145 | .\" .LP | |
146 | .\" The libc5 version of this program will use the name of a library given | |
147 | .\" on the command line as-is when it contains a \(aq/\(aq; otherwise it | |
148 | .\" searches for the library in the standard locations. | |
149 | .\" To run it | |
150 | .\" on a shared library in the current directory, prefix the name with "./". | |
fea681da MK |
151 | .SH BUGS |
152 | .B ldd | |
153 | does not work on a.out shared libraries. | |
154 | .PP | |
155 | .B ldd | |
156 | does not work with some extremely old a.out programs which were | |
157 | built before | |
158 | .B ldd | |
159 | support was added to the compiler releases. | |
160 | If you use | |
161 | .B ldd | |
162 | on one of these programs, the program will attempt to run with | |
aeb9b6a6 MK |
163 | .I argc |
164 | = 0 and the results will be unpredictable. | |
fea681da MK |
165 | .\" .SH AUTHOR |
166 | .\" David Engel. | |
167 | .\" Roland McGrath and Ulrich Drepper. | |
168 | .SH SEE ALSO | |
450c6969 | 169 | .BR pldd (1), |
cd22e342 | 170 | .BR sprof (1), |
fea681da MK |
171 | .BR ld.so (8), |
172 | .BR ldconfig (8) |