Debian Codegraph @

upstream/debian-unstable/man1/ldd.1

raw
1 .\" Copyright 1995-2000, David Engel <[email protected]>
2 .\" Copyright 1995, Rickard E. Faith <[email protected]>
3 .\" Copyright 2000, Ben Collins <[email protected]>
4 .\" Copyright 2000, Jakub Jelinek <[email protected]>
5 .\" Copyright 2012-2016, Michael Kerrisk <[email protected]>
6 .\" Copyright, the authors of the Linux man-pages project
7 .\"
8 .\" SPDX-License-Identifier: GPL-1.0-or-later
9 .\"
10 .TH ldd 1 2026-02-08 "Linux man-pages 6.18"
11 .SH NAME
12 ldd \- print shared object dependencies
13 .SH SYNOPSIS
14 .SY ldd
15 .RI [ option \~.\|.\|.\&]
16 .IR file \~.\|.\|.
17 .YS
18 .SH DESCRIPTION
19 .B ldd
20 prints the shared objects (shared libraries) required by each program or
21 shared object specified on the command line.
22 An example of its use and output
23 is the following:
24 .P
25 .in +4n
26 .EX
27 .RB $ " ldd /bin/ls" ;
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 .P
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 .B 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;
60 see
61 .BR vdso (7)
62 and
63 .BR ld.so (8).)
64 .\"
65 .SS Security
66 Be aware that in some circumstances
67 (e.g., where the program specifies an ELF interpreter other than
68 .IR ld\-linux.so ),
69 .\" The circumstances are where the program has an interpreter
70 .\" other than ld-linux.so. In this case, ldd tries to execute the
71 .\" program directly with LD_TRACE_LOADED_OBJECTS=1, with the
72 .\" result that the program interpreter gets control, and can do
73 .\" what it likes, or pass control to the program itself.
74 .\" Much more detail at
75 .\" http://www.catonmat.net/blog/ldd-arbitrary-code-execution/
76 some versions of
77 .B ldd
78 may attempt to obtain the dependency information
79 by attempting to directly execute the program,
80 which may lead to the execution of whatever code is defined
81 in the program's ELF interpreter,
82 and perhaps to execution of the program itself.
83 .\" Mainline glibc's ldd allows this possibility (the line
84 .\" try_trace "$file"
85 .\" in glibc 2.15, for example), but many distro versions of
86 .\" ldd seem to remove that code path from the script.
87 (Before glibc 2.27,
88 .\" glibc commit eedca9772e99c72ab4c3c34e43cc764250aa3e3c
89 the upstream
90 .B ldd
91 implementation did this for example,
92 although most distributions provided a modified version that did not.)
93 .P
94 Thus, you should
95 .I never
96 employ
97 .B ldd
98 on an untrusted executable,
99 since this may result in the execution of arbitrary code.
100 A safer alternative when dealing with untrusted executables is:
101 .P
102 .in +4n
103 .EX
104 .RB $ " objdump \-p /path/to/program | grep NEEDED" ;
105 .EE
106 .in
107 .P
108 Note, however, that this alternative shows only the direct dependencies
109 of the executable, while
110 .B ldd
111 shows the entire dependency tree of the executable.
112 .SH OPTIONS
113 .TP
114 .B \-\-version
115 Print the version number of
116 .BR ldd .
117 .TP
118 .B \-\-verbose
119 .TQ
120 .B \-v
121 Print all information, including, for example,
122 symbol versioning information.
123 .TP
124 .B \-\-unused
125 .TQ
126 .B \-u
127 Print unused direct dependencies.
128 (Since glibc 2.3.4.)
129 .TP
130 .B \-\-data\-relocs
131 .TQ
132 .B \-d
133 Perform relocations and report any missing objects (ELF only).
134 .TP
135 .B \-\-function\-relocs
136 .TQ
137 .B \-r
138 Perform relocations for both data objects and functions, and
139 report any missing objects or functions (ELF only).
140 .TP
141 .B \-\-help
142 Usage information.
143 .\" .SH NOTES
144 .\" The standard version of
145 .\" .B ldd
146 .\" comes with glibc2.
147 .\" Libc5 came with an older version, still present
148 .\" on some systems.
149 .\" The long options are not supported by the libc5 version.
150 .\" On the other hand, the glibc2 version does not support
151 .\" .B \-V
152 .\" and only has the equivalent
153 .\" .BR \-\-version .
154 .\" .P
155 .\" The libc5 version of this program will use the name of a library given
156 .\" on the command line as-is when it contains a \[aq]/\[aq]; otherwise it
157 .\" searches for the library in the standard locations.
158 .\" To run it
159 .\" on a shared library in the current directory, prefix the name with "./".
160 .SH BUGS
161 .B ldd
162 does not work on a.out shared libraries.
163 .P
164 .B ldd
165 does not work with some extremely old a.out programs which were
166 built before
167 .B ldd
168 support was added to the compiler releases.
169 If you use
170 .B ldd
171 on one of these programs, the program will attempt to run with
172 .I argc
173 = 0 and the results will be unpredictable.
174 .\" .SH AUTHOR
175 .\" David Engel.
176 .\" Roland McGrath and Ulrich Drepper.
177 .SH SEE ALSO
178 .BR pldd (1),
179 .BR sprof (1),
180 .BR ld.so (8),
181 .BR ldconfig (8)