「readelf」の版間の差分

提供: セキュリティ
移動: 案内検索
(ページの作成:「readelf とは、ELFファイルの情報を表示するUnixコマンドです。 '''読み方''' ;readelf:りーど いーえるえふ __TOC__ == 概...」)
 
 
行124: 行124:
 
== 関連項目 ==
 
== 関連項目 ==
 
{{binary}}
 
{{binary}}
{{debugger}}
+
* [[デバッガ]]
{{assembler}}
+
* [[アセンブラ]]
<!-- vim: filetype=mediawiki -->
+
<!-- vim: filetype=mediawiki
 +
-->

2015年3月22日 (日) 21:34時点における最新版

readelf とは、ELFファイルの情報を表示するUnixコマンドです。

読み方

readelf
りーど いーえるえふ

概要

readelfは、objdumpコマンドの機能に似ていますが、逆アセンブラの機能は、持っていません。

インストール

使い方

コマンドラインオプション

Usage: readelf <option(s)> elf-file(s)
 Display information about the contents of ELF format files
 Options are:
  -a --all               Equivalent to: -h -l -S -s -r -d -V -A -I
  -h --file-header       Display the ELF file header
  -l --program-headers   Display the program headers
     --segments          An alias for --program-headers
  -S --section-headers   Display the sections' header
     --sections          An alias for --section-headers
  -g --section-groups    Display the section groups
  -t --section-details   Display the section details
  -e --headers           Equivalent to: -h -l -S
  -s --syms              Display the symbol table
     --symbols           An alias for --syms
  --dyn-syms             Display the dynamic symbol table
  -n --notes             Display the core notes (if present)
  -r --relocs            Display the relocations (if present)
  -u --unwind            Display the unwind info (if present)
  -d --dynamic           Display the dynamic section (if present)
  -V --version-info      Display the version sections (if present)
  -A --arch-specific     Display architecture specific information (if any).
  -c --archive-index     Display the symbol/file index in an archive
  -D --use-dynamic       Use the dynamic section info when displaying symbols
  -x --hex-dump=<number|name>
                         Dump the contents of section <number|name> as bytes
  -p --string-dump=<number|name>
                         Dump the contents of section <number|name> as strings
  -R --relocated-dump=<number|name>
                         Dump the contents of section <number|name> as relocated bytes
  -w[lLiaprmfFsoRt] or
  --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,
               =frames-interp,=str,=loc,=Ranges,=pubtypes,
               =gdb_index,=trace_info,=trace_abbrev,=trace_aranges]
                         Display the contents of DWARF2 debug sections
  --dwarf-depth=N        Do not display DIEs at depth N or greater
  --dwarf-start=N        Display DIEs starting with N, at the same depth
                         or deeper
  -I --histogram         Display histogram of bucket list lengths
  -W --wide              Allow output width to exceed 80 characters
  @<file>                Read options from <file>
  -H --help              Display this information
  -v --version           Display the version number of readelf

実行例

ファイルのセクションヘッダ内の情報を表示します。

% readelf -S /bin/pwd
There are 26 section headers, starting at offset 0xff0:
 
Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000400200  00000200
       0000000000000015  0000000000000000   A       0     0     1
  [ 2] .note.ABI-tag     NOTE             0000000000400218  00000218
       0000000000000018  0000000000000000   A       0     0     4
  [ 3] .hash             HASH             0000000000400230  00000230
       0000000000000094  0000000000000004   A       4     0     8
  [ 4] .dynsym           DYNSYM           00000000004002c8  000002c8
       00000000000001b0  0000000000000018   A       5     1     8
  [ 5] .dynstr           STRTAB           0000000000400478  00000478
       0000000000000094  0000000000000000   A       0     0     1
  [ 6] .gnu.version      VERSYM           000000000040050c  0000050c
       0000000000000024  0000000000000002   A       4     0     2
  [ 7] .gnu.version_r    VERNEED          0000000000400530  00000530
       0000000000000020  0000000000000000   A       5     1     8
  [ 8] .rela.dyn         RELA             0000000000400550  00000550
       0000000000000030  0000000000000018   A       4     0     8
  [ 9] .rela.plt         RELA             0000000000400580  00000580
       0000000000000108  0000000000000018   A       4    11     8
  [10] .init             PROGBITS         0000000000400688  00000688
       0000000000000013  0000000000000000  AX       0     0     4
  [11] .plt              PROGBITS         000000000040069c  0000069c
       00000000000000c0  0000000000000010  AX       0     0     4
  [12] .text             PROGBITS         0000000000400760  00000760
       0000000000000264  0000000000000000  AX       0     0     16
  [13] .fini             PROGBITS         00000000004009c4  000009c4
       000000000000000e  0000000000000000  AX       0     0     4
  [14] .rodata           PROGBITS         00000000004009d2  000009d2
       000000000000001f  0000000000000001 AMS       0     0     1
  [15] .eh_frame_hdr     PROGBITS         00000000004009f4  000009f4
       0000000000000024  0000000000000000   A       0     0     4
  [16] .eh_frame         PROGBITS         0000000000400a18  00000a18
       0000000000000084  0000000000000000   A       0     0     8
  [17] .ctors            PROGBITS         0000000000600aa0  00000aa0
       0000000000000010  0000000000000000  WA       0     0     8
  [18] .dtors            PROGBITS         0000000000600ab0  00000ab0
       0000000000000010  0000000000000000  WA       0     0     8
  [19] .jcr              PROGBITS         0000000000600ac0  00000ac0
       0000000000000008  0000000000000000  WA       0     0     8
  [20] .dynamic          DYNAMIC          0000000000600ac8  00000ac8
       0000000000000190  0000000000000010  WA       5     0     8
  [21] .got.plt          PROGBITS         0000000000600c58  00000c58
       0000000000000070  0000000000000008  WA       0     0     8
  [22] .data             PROGBITS         0000000000600cc8  00000cc8
       0000000000000018  0000000000000000  WA       0     0     8
  [23] .bss              NOBITS           0000000000600ce0  00000ce0
       0000000000000038  0000000000000000  WA       0     0     32
  [24] .comment          PROGBITS         0000000000000000  00000ce0
       000000000000023e  0000000000000000           0     0     1
  [25] .shstrtab         STRTAB           0000000000000000  00000f1e
       00000000000000d2  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

関連項目