1 .\" Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
5 .\" The contents of this file are subject to the terms of the
6 .\" Common Development and Distribution License (the "License").
7 .\" You may not use this file except in compliance with the License.
9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 .\" or http://www.opensolaris.org/os/licensing.
11 .\" See the License for the specific language governing permissions
12 .\" and limitations under the License.
14 .\" When distributing Covered Code, include this CDDL HEADER in each
15 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 .\" If applicable, add the following below this CDDL HEADER, with the
17 .\" fields enclosed by brackets "[]" replaced with your own identifying
18 .\" information: Portions Copyright [yyyy] [name of copyright owner]
22 .TH FIND_ELF 1ONBLD "Mar 25, 2010"
24 find_elf \- Locate ELF shared objects and executables
26 \fBfind_elf [-afrs] path\fP
30 command descends a directory hierarchy and produces one line
31 of output on stdout for each ELF executable or shared object found.
34 The following options are supported:
37 Disable alias processing. Symbolic links are treated as independent
38 files, each such link results in a separate OBJECT output line,
39 and ALIAS lines are not issued.
42 Fast Mode. When reading directories, the file name and modes are
43 used to eliminate files from consideration and speed up the search:
44 Directories with names that start with a '.' character are skipped.
45 Executables must have the execute bit set, and
46 shared objects must end with a .so extension. Files that do not
47 meet these requirements are silently eliminated from consideration without
51 Report file names as relative paths, relative to the given file or directory,
52 instead of fully qualified.
55 Only report shared objects.
59 produces a series of PREFIX, OBJECT, and ALIAS lines, which collectively
60 describe the ELF objects located. Whitespace is used within each
61 line to delimit the various fields of information provided.
63 If the \fB-r\fP option is used to specify that file names be reported
64 as relative paths, a PREFIX line is output to provide the base path from
65 which the relative names should be interpreted.
66 There can only be one PREFIX line, and it is output first, before any
67 OBJECT or ALIAS lines.
75 For each object found, an OBJECT line is produced to describe it:
79 OBJECT [32 | 64] [DYN | EXEC] [VERDEF | NOVERDEF] object-path
83 The first field provides the ELF class of the object, and will be
85 The second field provides the type of object, either
86 a shared object (DYN) or executable (EXEC).
87 The third field will be VERDEF if the object contains ELF
88 version definitions, and NOVERDEF if the object is not versioned.
89 The final field gives the path to the object.
91 Under Unix, a file can have multiple names. In the context of ELF
92 objects, this often happens for one of two reasons:
97 Compilation symlinks, used to provide a non-versioned name for a shared object.
103 Symlinks such as '32' and '64' used to provide alternative
104 non-machine specific paths to objects.
109 identifies an object via such an aliased name, it issues an ALIAS line
110 mapping it to the main name for the object:
114 ALIAS object-path alias-path
118 The \fB-a\fP option alters the handling of aliased names. When \fB-a\fP is
119 specified, each file results in a separate OBJECT line, as if they were
120 independent files rather than the same file with different names.
123 Assume the following hierarchy of files exist under /usr/lib/foo:
127 % /bin/ls -alRF /usr/lib/foo
130 drwxr-xr-x 3 root root 7 Jul 16 17:35 ./
131 drwxr-xr-x 34 root root 42 Jul 16 17:34 ../
132 lrwxrwxrwx 1 root bin 1 Jul 16 17:34 32 -> ./
133 lrwxrwxrwx 1 root bin 5 Jul 16 17:34 64 -> amd64/
134 drwxr-xr-x 2 root bin 4 Jul 16 17:35 amd64/
135 lrwxrwxrwx 1 root bin 11 Jul 16 17:35 libfoo.so -> libfoo.so.1*
136 -rwxr-xr-x 1 root bin 49132 Jul 16 17:35 libfoo.so.1*
140 drwxr-xr-x 2 root root 4 Jul 16 17:35 ./
141 drwxr-xr-x 3 root root 7 Jul 16 17:35 ../
142 lrwxrwxrwx 1 root bin 11 Jul 16 17:35 libfoo.so -> libfoo.so.1*
143 -rwxr-xr-x 1 root bin 72536 Jul 16 17:35 libfoo.so.1*
147 This hierarchy contains compilation symlinks (libfoo.so) and
148 path alias symlinks (32, 64), as discussed in OUTPUT.
151 produces the following output for the above hierarchy:
155 % find_elf -r /usr/lib/foo
157 OBJECT 64 DYN VERDEF amd64/libfoo.so.1
158 ALIAS amd64/libfoo.so.1 64/libfoo.so
159 ALIAS amd64/libfoo.so.1 64/libfoo.so.1
160 ALIAS amd64/libfoo.so.1 amd64/libfoo.so
161 OBJECT 32 DYN VERDEF libfoo.so.1
162 ALIAS libfoo.so.1 32/libfoo.so
163 ALIAS libfoo.so.1 32/libfoo.so.1
164 ALIAS libfoo.so.1 libfoo.so
168 Contrast this with the output when \fB-a\fP is used to treat
169 each name as an independent file:
173 % find_elf -ar /usr/lib/foo
175 OBJECT 32 DYN VERDEF 32/libfoo.so
176 OBJECT 32 DYN VERDEF 32/libfoo.so.1
177 OBJECT 64 DYN VERDEF 64/libfoo.so
178 OBJECT 64 DYN VERDEF 64/libfoo.so.1
179 OBJECT 64 DYN VERDEF amd64/libfoo.so.1
180 OBJECT 64 DYN VERDEF amd64/libfoo.so
181 OBJECT 32 DYN VERDEF libfoo.so.1
182 OBJECT 32 DYN VERDEF libfoo.so
188 is used to process an alias for which no target object is given,
189 there will be no output. For example, using /lib/libc.so, which
190 is a compilation symlink for /lib/libc.so.1:
194 % find_elf /lib/libc.so
198 In such situations, the \fB-a\fP option can be used to produce
203 % find_elf -a /lib/libc.so
204 OBJECT 32 DYN VERDEF /lib/libc.so
212 .BR check_rtime (1ONBLD),
213 .BR interface_check (1ONBLD),
214 .BR interface_cmp (1ONBLD),