$ readelf -h <elf_object>
で、elf_objectのheaderを表示
例:
$ readelf -h a.o
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x401060
Start of program headers: 64 (bytes into file)
Start of section headers: 16840 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 11
Size of section headers: 64 (bytes)
Number of section headers: 33
Section header string table index: 32
$ readelf -x <Section header string table index> <elf_object>
で、Section header string table index sectionの中身を表示
例:
$ readelf -x 32 a.o
Hex dump of section '.shstrtab':
0x00000000 002e7379 6d746162 002e7374 72746162 ..symtab..strtab
0x00000010 002e7368 73747274 6162002e 696e7465 ..shstrtab..inte
0x00000020 7270002e 6e6f7465 2e676e75 2e627569 rp..note.gnu.bui
0x00000030 6c642d69 64002e6e 6f74652e 4142492d ld-id..note.ABI-
0x00000040 74616700 2e676e75 2e686173 68002e64 tag..gnu.hash..d
0x00000050 796e7379 6d002e64 796e7374 72002e67 ynsym..dynstr..g
0x00000060 6e752e76 65727369 6f6e002e 676e752e nu.version..gnu.
0x00000070 76657273 696f6e5f 72002e72 656c612e version_r..rela.
0x00000080 64796e00 2e72656c 612e706c 74002e69 dyn..rela.plt..i
0x00000090 6e697400 2e746578 74002e66 696e6900 nit..text..fini.
0x000000a0 2e726f64 61746100 2e65685f 6672616d .rodata..eh_fram
0x000000b0 655f6864 72002e65 685f6672 616d6500 e_hdr..eh_frame.
0x000000c0 2e696e69 745f6172 72617900 2e66696e .init_array..fin
0x000000d0 695f6172 72617900 2e64796e 616d6963 i_array..dynamic
0x000000e0 002e676f 74002e67 6f742e70 6c74002e ..got..got.plt..
0x000000f0 64617461 002e6273 73002e63 6f6d6d65 data..bss..comme
0x00000100 6e74002e 64656275 675f696e 666f002e nt..debug_info..
0x00000110 64656275 675f6162 62726576 002e6465 debug_abbrev..de
0x00000120 6275675f 6c696e65 002e6465 6275675f bug_line..debug_
0x00000130 73747200 str.