struct elf32 { u32 e_entry hex; u32 e_phoff; u32 e_shoff; }; struct elf64 { u64 e_entry hex; u64 e_phoff; u64 e_shoff; }; struct elf { u8 ei_magic[4] | matches('\x7fELF') str; u8 ei_class hex; // word size u8 ei_data hex; // endianess u8 ei_version; u8 ei_osabi; u8 ei_abi_version; u8 padding[7] nul; u16 e_type hex; u16 e_machine hex; u32 e_version; select (ei_class) { 1) struct elf32 elf32; 2) struct elf64 elf64; } arch; u32 e_flags hex; u16 e_ehsz; u16 e_phentsize; u16 e_phnum; u16 e_shentsize; u16 e_shnum; u16 e_shstrndx; };