wire / wire-format / elf-header
The ELF64 header is the first 64 bytes of every ELF object/executable/shared object/core dump. It identifies the file (magic \x7fELF), declares the class (32/64-bit), endianness, OS/ABI, type (relocatable/executable/shared/core), machine architecture, and offsets to the program and section header tables.
aka: ELF64 header (Executable and Linkable Format)
spec: System V ABI / ELF-64 Object File Format specification
The ELF64 header is the first 64 bytes of every ELF object/executable/shared object/core dump. It identifies the file (magic \x7fELF), declares the class (32/64-bit), endianness, OS/ABI, type (relocatable/executable/shared/core), machine architecture, and offsets to the program and section header tables.
| field | size | meaning |
|---|---|---|
| Magic | 4 bytes | 0x7F 'E' 'L' 'F' (0x7F 0x45 0x4C 0x46). |
| EI_CLASS | 1 byte | 1 = 32-bit (ELF32), 2 = 64-bit (ELF64). |
| EI_DATA | 1 byte | 1 = little-endian, 2 = big-endian. |
| EI_VERSION | 1 byte | ELF version (always 1). |
| EI_OSABI | 1 byte | Target OS/ABI (0 System V, 3 Linux, 6 Solaris, 9 FreeBSD, 12 OpenBSD, ...). |
| EI_ABIVERSION | 1 byte | ABI version (usually 0). |
| Padding | 7 bytes | Zero padding to 16-byte boundary. |
| e_type | 2 bytes | Object type: 1 relocatable, 2 executable, 3 shared object (DSO), 4 core. |
| e_machine | 2 bytes | Architecture: 0x03 x86, 0x28 ARM, 0x3E x86-64, 0xB7 AArch64, 0xF3 RISC-V. |
| e_version | 4 bytes | Object version (always 1). |
| e_entry | 8 bytes | Virtual address of entry point (0 if none). |
| e_phoff | 8 bytes | File offset to program header table. |
| e_shoff | 8 bytes | File offset to section header table. |
| e_flags | 4 bytes | Processor-specific flags. |
| e_ehsize | 2 bytes | ELF header size (64 for ELF64). |
| e_phentsize | 2 bytes | Program header entry size (56 for ELF64). |
| e_phnum | 2 bytes | Number of program header entries. |
| e_shentsize | 2 bytes | Section header entry size (64 for ELF64). |
| e_shnum | 2 bytes | Number of section header entries. |
| e_shstrndx | 2 bytes | Section name string table index. |
example:
7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 02 00 3e 00 01 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 38 00 01 00 00 00 00 00 00 00
ELF64 little-endian executable for x86-64
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/elf-header
or /wire-format/elf-header.json