Elf32 Linker Format

This page sums up the most important parts of the Elf32 Objectfile Format.

File Format

ELF Header
Program Header Table (optional)
Section 1
...
Section n
...
Section Header Table

ELF Header

The ELF header is mandatory and acts as a "road map" containing the files structure.

 1public struct Elf32Header
 2{
 3    byte Ident[16];
 4    ushort FileType;
 5    ushort MachineType;
 6    uint Version;
 7    uint EntryAdress;
 8    uint ProgramHeaderOffset;
 9    uint SectionHeaderOffset;
10    uint Flags;
11    ushort ElfHeaderSize;
12    ushort ProgramHeaderEntitySize;
13    ushort ProgramHeaderEntryNumber;
14    ushort SectionHeaderSize;
15    ushort SectionHeaderEntryNumber;
16    ushort SectionHeaderStringIndex;
17}

Section Headers

 1public struct SectionHeader
 2{
 3    uint Name;
 4    uint Type;
 5    uint Flags;
 6    uint Address;
 7    uint Offset;
 8    uint Size;
 9    uint Link;
10    uint Info;
11    uint AddressAlignment;
12    uint EntitySize;
13}