1 find_elf(1ONBLD)              illumos Build Tools             find_elf(1ONBLD)
   2 
   3 
   4 
   5 NAME
   6        find_elf - Locate ELF shared objects and executables
   7 
   8 SYNOPSIS
   9        find_elf [-afrs] path
  10 
  11 DESCRIPTION
  12        The find_elf command descends a directory hierarchy and produces one
  13        line of output on stdout for each ELF executable or shared object
  14        found.
  15 
  16 OPTIONS
  17        The following options are supported:
  18 
  19        -a  Disable alias processing. Symbolic links are treated as independent
  20            files, each such link results in a separate OBJECT output line, and
  21            ALIAS lines are not issued.
  22 
  23        -f  Fast Mode. When reading directories, the file name and modes are
  24            used to eliminate files from consideration and speed up the search:
  25            Directories with names that start with a '.' character are skipped.
  26            Executables must have the execute bit set, and shared objects must
  27            end with a .so extension. Files that do not meet these requirements
  28            are silently eliminated from consideration without further
  29            analysis.
  30 
  31        -r  Report file names as relative paths, relative to the given file or
  32            directory, instead of fully qualified.
  33 
  34        -s  Only report shared objects.
  35 
  36 OUTPUT
  37        find_elf produces a series of PREFIX, OBJECT, and ALIAS lines, which
  38        collectively describe the ELF objects located. Whitespace is used
  39        within each line to delimit the various fields of information provided.
  40 
  41        If the -r option is used to specify that file names be reported as
  42        relative paths, a PREFIX line is output to provide the base path from
  43        which the relative names should be interpreted.  There can only be one
  44        PREFIX line, and it is output first, before any OBJECT or ALIAS lines.
  45 
  46            PREFIX path
  47 
  48        For each object found, an OBJECT line is produced to describe it:
  49 
  50            OBJECT [32 | 64] [DYN | EXEC] [VERDEF | NOVERDEF] object-path
  51 
  52        The first field provides the ELF class of the object, and will be
  53        either 32 or 64.  The second field provides the type of object, either
  54        a shared object (DYN) or executable (EXEC).  The third field will be
  55        VERDEF if the object contains ELF version definitions, and NOVERDEF if
  56        the object is not versioned.  The final field gives the path to the
  57        object.
  58 
  59        Under Unix, a file can have multiple names. In the context of ELF
  60        objects, this often happens for one of two reasons:
  61 
  62            o      Compilation symlinks, used to provide a non-versioned name
  63                   for a shared object.
  64 
  65            o      Symlinks such as '32' and '64' used to provide alternative
  66                   non-machine specific paths to objects.
  67 
  68        When find_elf identifies an object via such an aliased name, it issues
  69        an ALIAS line mapping it to the main name for the object:
  70 
  71            ALIAS object-path alias-path
  72 
  73        The -a option alters the handling of aliased names. When -a is
  74        specified, each file results in a separate OBJECT line, as if they were
  75        independent files rather than the same file with different names.
  76 
  77 
  78 EXAMPLES
  79        Assume the following hierarchy of files exist under /usr/lib/foo:
  80 
  81            % /bin/ls -alRF /usr/lib/foo
  82            /usr/lib/foo:
  83            total 111
  84            drwxr-xr-x  3 root root    7 Jul 16 17:35 ./
  85            drwxr-xr-x 34 root root   42 Jul 16 17:34 ../
  86            lrwxrwxrwx  1 root bin     1 Jul 16 17:34 32 -> ./
  87            lrwxrwxrwx  1 root bin     5 Jul 16 17:34 64 -> amd64/
  88            drwxr-xr-x  2 root bin     4 Jul 16 17:35 amd64/
  89            lrwxrwxrwx  1 root bin    11 Jul 16 17:35 libfoo.so -> libfoo.so.1*
  90            -rwxr-xr-x  1 root bin 49132 Jul 16 17:35 libfoo.so.1*
  91 
  92            /usr/lib/foo/amd64:
  93            total 150
  94            drwxr-xr-x  2 root root   4 Jul 16 17:35 ./
  95            drwxr-xr-x  3 root root   7 Jul 16 17:35 ../
  96            lrwxrwxrwx  1 root bin    11 Jul 16 17:35 libfoo.so -> libfoo.so.1*
  97            -rwxr-xr-x  1 root bin 72536 Jul 16 17:35 libfoo.so.1*
  98 
  99        This hierarchy contains compilation symlinks (libfoo.so) and path alias
 100        symlinks (32, 64), as discussed in OUTPUT.  find_elf produces the
 101        following output for the above hierarchy:
 102 
 103            % find_elf -r /usr/lib/foo
 104            PREFIX /usr/lib/foo
 105            OBJECT 64 DYN  VERDEF  amd64/libfoo.so.1
 106            ALIAS                  amd64/libfoo.so.1  64/libfoo.so
 107            ALIAS                  amd64/libfoo.so.1  64/libfoo.so.1
 108            ALIAS                  amd64/libfoo.so.1  amd64/libfoo.so
 109            OBJECT 32 DYN  VERDEF  libfoo.so.1
 110            ALIAS                  libfoo.so.1        32/libfoo.so
 111            ALIAS                  libfoo.so.1        32/libfoo.so.1
 112            ALIAS                  libfoo.so.1        libfoo.so
 113 
 114        Contrast this with the output when -a is used to treat each name as an
 115        independent file:
 116 
 117            % find_elf -ar /usr/lib/foo
 118            PREFIX /usr/lib/foo
 119            OBJECT 32 DYN  VERDEF  32/libfoo.so
 120            OBJECT 32 DYN  VERDEF  32/libfoo.so.1
 121            OBJECT 64 DYN  VERDEF  64/libfoo.so
 122            OBJECT 64 DYN  VERDEF  64/libfoo.so.1
 123            OBJECT 64 DYN  VERDEF  amd64/libfoo.so.1
 124            OBJECT 64 DYN  VERDEF  amd64/libfoo.so
 125            OBJECT 32 DYN  VERDEF  libfoo.so.1
 126            OBJECT 32 DYN  VERDEF  libfoo.so
 127 
 128        When find_elf is used to process an alias for which no target object is
 129        given, there will be no output. For example, using /lib/libc.so, which
 130        is a compilation symlink for /lib/libc.so.1:
 131 
 132            % find_elf /lib/libc.so
 133 
 134        In such situations, the -a option can be used to produce the desired
 135        output:
 136 
 137            % find_elf -a /lib/libc.so
 138            OBJECT 32 DYN  VERDEF   /lib/libc.so
 139 
 140 
 141 
 142 SEE ALSO
 143        check_rtime(1ONBLD), interface_check(1ONBLD), interface_cmp(1ONBLD),
 144        ld(1), ldd(1), elfdump(1), pvs(1).
 145 
 146 
 147 
 148                                  25 March 2010                find_elf(1ONBLD)