]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man1/ldd.1
iconv.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, pldd.1, sprof...
[thirdparty/man-pages.git] / man1 / ldd.1
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.
7 .\" and Copyright (C) 2012, 2016, Michael Kerrisk <mtk.manpages@gmail.com>
8 .\"
9 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
10 .\" Do not restrict distribution.
11 .\" May be distributed under the GNU General Public License
12 .\" %%%LICENSE_END
13 .\"
14 .TH LDD 1 2017-07-13 "" "Linux Programmer's Manual"
15 .SH NAME
16 ldd \- print shared object dependencies
17 .SH SYNOPSIS
18 .BR ldd " [\fIoption\fP]... \fIfile\fP..."
19 .SH DESCRIPTION
20 .B ldd
21 prints the shared objects (shared libraries) required by each program or
22 shared object specified on the command line.
23 An example of its use and output is the following:
24 .PP
25 .in +2n
26 .EX
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)
37 .EE
38 .in
39 .PP
40 In the usual case,
41 .B ldd
42 invokes the standard dynamic linker (see
43 .BR ld.so (8))
44 with the
45 .B LD_TRACE_LOADED_OBJECTS
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,
52 .BR ldd
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
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
76 .BR ldd
77 may attempt to obtain the dependency information
78 by attempting to directly execute the program
79 (which may lead to the execution of whatever code is defined
80 in the program's ELF interpreter,
81 and perhaps to execution of the program itself).
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.
86 Thus, you should
87 .I never
88 employ
89 .B ldd
90 on an untrusted executable,
91 since this may result in the execution of arbitrary code.
92 A safer alternative when dealing with untrusted executables is:
93 .PP
94 .in +4n
95 .EX
96 $ \fBobjdump \-p /path/to/program | grep NEEDED\fP
97 .EE
98 .in
99 .PP
100 Note, however, that this alternative shows only the direct dependencies
101 of the executable, while
102 .B ldd
103 shows the entire dependency tree of the executable.
104 .SH OPTIONS
105 .TP
106 .B \-\-version
107 Print the version number of
108 .BR ldd .
109 .TP
110 .BR \-v ", " \-\-verbose
111 Print all information, including, for example,
112 symbol versioning information.
113 .TP
114 .BR \-u ", " \-\-unused
115 Print unused direct dependencies.
116 (Since glibc 2.3.4.)
117 .TP
118 .BR \-d ", " \-\-data\-relocs
119 Perform relocations and report any missing objects (ELF only).
120 .TP
121 .BR \-r ", " \-\-function\-relocs
122 Perform relocations for both data objects and functions, and
123 report any missing objects or functions (ELF only).
124 .TP
125 .B \-\-help
126 Usage information.
127 .\" .SH NOTES
128 .\" The standard version of
129 .\" .B ldd
130 .\" comes with glibc2.
131 .\" Libc5 came with an older version, still present
132 .\" on some systems.
133 .\" The long options are not supported by the libc5 version.
134 .\" On the other hand, the glibc2 version does not support
135 .\" .B \-V
136 .\" and only has the equivalent
137 .\" .BR \-\-version .
138 .\" .LP
139 .\" The libc5 version of this program will use the name of a library given
140 .\" on the command line as-is when it contains a \(aq/\(aq; otherwise it
141 .\" searches for the library in the standard locations.
142 .\" To run it
143 .\" on a shared library in the current directory, prefix the name with "./".
144 .SH BUGS
145 .B ldd
146 does not work on a.out shared libraries.
147 .PP
148 .B ldd
149 does not work with some extremely old a.out programs which were
150 built before
151 .B ldd
152 support was added to the compiler releases.
153 If you use
154 .B ldd
155 on one of these programs, the program will attempt to run with
156 .I argc
157 = 0 and the results will be unpredictable.
158 .\" .SH AUTHOR
159 .\" David Engel.
160 .\" Roland McGrath and Ulrich Drepper.
161 .SH SEE ALSO
162 .BR pldd (1),
163 .BR sprof (1),
164 .BR ld.so (8),
165 .BR ldconfig (8)