最終更新:2019-10-06 (日) 10:44:23 (1626d)
ELFヘッダ
Top / ELFヘッダ
内容
- マジックナンバー
- ABIとか
- ELF/プログラムヘッダテーブルのサイズ、エントリ数
- ELF/セクションヘッダテーブルのサイズ、エントリ数
ELF/プログラムヘッダテーブル
- セグメントの種類とか
ELF/セクションヘッダテーブル
確認
- readelf -h? : Display the ELF file header
$ readelf -h hello 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: 0x400430 Start of program headers: 64 (bytes into file) Start of section headers: 6680 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 9 Size of section headers: 64 (bytes) Number of section headers: 31 Section header string table index: 28
定義
- elf.h?
-
#define EI_NIDENT (16) typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf32_Half e_type; /* Object file type */ Elf32_Half e_machine; /* Architecture */ Elf32_Word e_version; /* Object file version */ Elf32_Addr e_entry; /* Entry point virtual address */ Elf32_Off e_phoff; /* Program header table file offset */ Elf32_Off e_shoff; /* Section header table file offset */ Elf32_Word e_flags; /* Processor-specific flags */ Elf32_Half e_ehsize; /* ELF header size in bytes */ Elf32_Half e_phentsize; /* Program header table entry size */ Elf32_Half e_phnum; /* Program header table entry count */ Elf32_Half e_shentsize; /* Section header table entry size */ Elf32_Half e_shnum; /* Section header table entry count */ Elf32_Half e_shstrndx; /* Section header string table index */ } Elf32_Ehdr; typedef struct { unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */ Elf64_Half e_type; /* Object file type */ Elf64_Half e_machine; /* Architecture */ Elf64_Word e_version; /* Object file version */ Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; /* Processor-specific flags */ Elf64_Half e_ehsize; /* ELF header size in bytes */ Elf64_Half e_phentsize; /* Program header table entry size */ Elf64_Half e_phnum; /* Program header table entry count */ Elf64_Half e_shentsize; /* Section header table entry size */ Elf64_Half e_shnum; /* Section header table entry count */ Elf64_Half e_shstrndx; /* Section header string table index */ } Elf64_Ehdr;
バイト 名前 値 unsigned char e_ident Magic number and other info Elf64_Half? e_type? Object file type Elf64_Half? e_machine? Architecture Elf64_Word? e_version? Object file version Elf64_Addr? e_entry? Entry point virtual address Elf64_Off? e_phoff? Program header table file offset Elf64_Off? e_shoff? Section header table file offset Elf64_Word? e_flags? Processor-specific flags Elf64_Half? e_ehsize? ELF header size in bytes ELFヘッダのサイズ 64 Elf64_Half? e_phentsize? Program header table entry size ELF/プログラムヘッダテーブルのエントリのサイズ 56 Elf64_Half? e_phnum? Program header table entry count ELF/プログラムヘッダテーブルのエントリ数 9 Elf64_Half? e_shentsize? Section header table entry size ELF/セクションヘッダテーブルのエントリ(Elf64_Shdr)のサイズ 64 Elf64_Half? e_shnum Section header table entry count ELF/セクションヘッダテーブルのエントリ数 31 Elf64_Half? e_shstrndx? Section header string table index .shstrtab (SHT_STRTAB)がどのセクションヘッダに格納されているかを示すインデックス 28
-