LoginSignup
2
2

More than 5 years have passed since last update.

linux > .elfファイルのsection情報表示 > readelf -S [ファイル]

Last updated at Posted at 2015-03-19

動作確認

CentOS 6.5

各セクションのアドレスなどの情報を表示する

$readelf -S sample.elf
There are 34 section headers, starting at offset 0xc5864:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .boot             PROGBITS        00000000 008000 000240 00  AX  0   0  4
  [ 2] .text             PROGBITS        00000240 008240 00a4c4 00  AX  0   0  4
  [ 3] .text.startup     PROGBITS        0000a704 012704 00001c 00  AX  0   0  4
  [ 4] .handoff          PROGBITS        0000ff40 017f40 00004c 00  AX  0   0  4
  [ 5] .mmu_tbl          PROGBITS        00010000 018000 004000 00   A  0   0  1
  [ 6] .init             PROGBITS        00014000 01c000 000018 00  AX  0   0  4
  [ 7] .fini             PROGBITS        00014018 01c018 000018 00  AX  0   0  4
  [ 8] .glue_7           PROGBITS        00014030 01c030 000000 00  AX  0   0  4
  [ 9] .glue_7t          PROGBITS        00014030 01c030 000000 00  AX  0   0  4
  [10] .rodata           PROGBITS        00014030 01c030 0001c0 00   A  0   0  4
  [11] .eh_frame         PROGBITS        000141f0 01c1f0 000004 00   A  0   0  4
  [12] .jcr              PROGBITS        000141f4 01c1f4 000004 00  WA  0   0  4
  [13] .init_array       INIT_ARRAY      000141f8 01c1f8 000004 00  WA  0   0  4
  [14] .comment          PROGBITS        000141fc 01d32c 000030 01  MS  0   0  1
  [15] .fini_array       FINI_ARRAY      000141fc 01c1fc 000004 00  WA  0   0  4
  [16] .ARM.attributes   ARM_ATTRIBUTES  00014200 01d35c 00003f 00      0   0  1
  [17] .data             PROGBITS        00014200 01c200 001128 00  WA  0   0  8
  [18] .init_array.00000 PROGBITS        00015328 01d328 000004 00  WA  0   0  4
  [19] .bss              NOBITS          00015340 01d32c 00acc0 00  WA  0   0 64
  [20] .heap             NOBITS          00020000 01d32c 001000 00  WA  0   0  1
  [21] .stack            NOBITS          ffff0000 020000 006000 00  WA  0   0  1
  [22] .debug_info       PROGBITS        00000000 01d39b 0068e0 00      0   0  1
  [23] .debug_abbrev     PROGBITS        00000000 023c7b 00198f 00      0   0  1
  [24] .debug_loc        PROGBITS        00000000 02560a 0019a8 00      0   0  1
  [25] .debug_aranges    PROGBITS        00000000 026fb8 000340 00      0   0  8
  [26] .debug_line       PROGBITS        00000000 0272f8 002f07 00      0   0  1
  [27] .debug_macinfo    PROGBITS        00000000 02a1ff 098919 00      0   0  1
  [28] .debug_str        PROGBITS        00000000 0c2b18 001999 01  MS  0   0  1
  [29] .debug_frame      PROGBITS        00000000 0c44b4 00124c 00      0   0  4
  [30] .debug_ranges     PROGBITS        00000000 0c5700 000018 00      0   0  1
  [31] .shstrtab         STRTAB          00000000 0c5718 00014b 00      0   0  1
  [32] .symtab           SYMTAB          00000000 0c5db4 001e00 10     33 307  4
  [33] .strtab           STRTAB          00000000 0c7bb4 000f76 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

参考

(抜粋の上、意訳)
- PROGBITS : programに関係するdata
- SYMTAB : symbol table
- REL : relocation entries
- NOBITS : empty. データを持たない
- STRTAB : string table
- DYNAMIC : dynamic linkingに関する詳細
- NULL : inactive、かつ、どのsectionにも関係しない

AddrとOffの意味については調査中であるが、例としてAddr:240, Off:08240の場合、0x240で始まるsection(.text)を0x8240に配置しているということかもしれない。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2