ナビゲーションリンクをスキップ | |
印刷ビューの終了 | |
![]() |
マニュアルページセクション 1: ユーザーコマンド Oracle Solaris 11 Information Library (日本語) |
- identify ELF file type
elffile [-s basic | detail | summary] filename...
The elffile utility is a specialized variant of the file command that is intended for use with ELF objects and related file types. elffile can identify files of the following types:
In addition to the information provided by file, elffile identifies the types of the archive members.
elffile provides the same output as file
Files of any other type are reported as non-ELF. No attempt to further classify such files is made. The file utility is recommended for general purpose file identification.
The following options are supported:
Specify the style of output to be provided
Produce a one-line description in the same format used by file.
For non-archives, summary output is the same as basic. When processing archives, the basic output line is followed by one line of output for each archive member.
For non-archives, summary output is the same as basic. When processing archives, a summary description of the archive contents is added to the end of the basic output. If the -s option is not specified, elffile uses the summary style by default.
The output produced for archives when using the summary style depends on the contents of the archive. If the archive contains a homogeneous collection of objects for the same platform, the platform details are shown in the same format used for a single object. Otherwise, a summary description is produced. The detail style can be used to obtain more specific information about individual archive members.
The summary and detail styles require examination of every member of an archive. Speed of execution is proportional to the number of archive members, and can be slow for extremely large archives.
例 1 Displaying Summary Output for Archives
The following example displays the summary output from elffile for archives with differing content. The following archives are used.
ELF objects for a single platform.
ELF objects for more than one platform.
ELF objects and non-ELF files.
Non-ELF files.
The summary output for archives depends on the types of the archive members.
example% elffile same_elf.a mixed_elf.a mixed.a not_elf.a same_elf.a: current ar archive, 32-bit symbol table, ELF 64-bit LSB relocatable AMD64 Version 1 mixed_elf.a: current ar archive, 32-bit symbol table, mixed ELF content mixed.a: current ar archive, 32-bit symbol table, mixed ELF and non-ELF content not_elf.a: current ar archive, non-ELF content
例 2 Filtering Detailed Output for Archives
The detailed output from elffile produces one line of output for the archive, followed by one line of output per archive member. This output can be easily filtered in order to present the information in various forms. The following example demonstrates this using the archive, libCstd.a which contains relocatable objects for a 64–bit x86 system. The unfiltered detailed elffile output for this archive is as follows.
example% elffile -s detail libCstd.a libCstd.a: current ar archive, 32-bit symbol table libCstd.a(bitset.o): ELF 64-bit LSB relocatable AMD64 Version 1 [CMOV] libCstd.a(complex.o): ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 SSE CMOV FPU] libCstd.a(limits.o): ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 SSE FPU] libCstd.a(limitsinit.o): ELF 64-bit LSB relocatable AMD64 Version 1 libCstd.a(stdexcept.o): ELF 64-bit LSB relocatable AMD64 Version 1 [SSE CMOV] ...
This output shows that each object is tagged with the hardware capabilities it requires to run. These capability tags vary depending on the code found in each object. The following command filters the output from elffile to identify each unique capability mask, and to count the number of objects containing each mask within the archive. The sed command is used to remove the archive member name from the output, with the result that the output for every archive member with the same capability mask will be identical. The sort command is used to group these identical lines together, and the uniq command is used to replace each unique group with a single line from the group, preceded with a count of how many times that line occurred within the group.
example% elffile -s detail libCstd.a | sed 's,(.*),,' | sort -f | uniq -c 1 libCstd.a: current ar archive, 32-bit symbol table 777 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 1 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [CMOV FPU] 126 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [CMOV] 12 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [FPU] 69 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE CMOV] 2 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 CMOV] 3 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 SSE CMOV FPU] 3 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 SSE CMOV] 1 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 SSE FPU] 2 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2 SSE] 20 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE2] 4 libCstd.a: ELF 64-bit LSB relocatable AMD64 Version 1 [SSE]
The following exit values are returned:
Successful completion
An error occurred
See attributes(5) for descriptions of the following attributes:
|