Skip to content

Instantly share code, notes, and snippets.

@Tomwi
Created September 1, 2013 08:50
Show Gist options
  • Save Tomwi/6403163 to your computer and use it in GitHub Desktop.
Save Tomwi/6403163 to your computer and use it in GitHub Desktop.
#pragma pack(push, 1)
typedef struct elf32_hdr_struct
{
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type; //file type
Elf32_Half e_machine; //architecture
Elf32_Word e_version; //file version
Elf32_Addr e_entry; //virtual address the system first transfers control to.
Elf32_Off e_phoff; //program header offset in bytes, or 0 if there is none
Elf32_Off e_shoff; //section header offset in bytes, or 0 if there is none
Elf32_Word e_flags; //proccessor specific flags - intel x86 has none
Elf32_Half e_ehsize; //header size in bytes
Elf32_Half e_phentsize; //size in bytes of one entry in the program header
Elf32_Half e_phnum; //number of entries in the program header
Elf32_Half e_shentsize; //size in bytes of one entry in the section header
Elf32_Half e_shnum; //number of entries in the section header
Elf32_Half e_shstrndx; //index into the section header that holds the string table
}__attribute__((packed)) Elf32_Ehdr;
#pragma pack(pop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment