IA-32 Assembly Language Reference Manual

ELF Header

The ELF header is always located at the beginning of the ELF file. It describes the ELF file organization and contains the actual sizes of the object file control structures.

The ELF header consists of the following fields, or members, some have the value 0 for relocatable files:

e_ident

This is a byte array consisting of the EI_NIDENT initial bytes of the ELF header, where EI_NIDENT is a name for 16. The elements of this array mark the file as an ELF object file and provide machine-independent data that can be used to decode and interpret the file's contents.

e_type

Identifies the object file type. A value of 1, that has the name ET_REL, specifies a relocatable file. Table 3-1 describes all the object file types.

e_machine

Specifies the required architecture for an individual file. A value of 3, that has the name EM_386, specifies Intel 80386. EM_486, specifies Intel 80486.

e_version

Identifies the version of this object file's format. This field should have the current version number, named EV_CURRENT.

e_entry

Virtual address where the process is to start. A value of 0 indicates no associated entry point.

e_phoff

Program header table's file offset, in bytes. The value of 0 indicates no program header. (Relocatable files do not need a program header table.)

e_shoff

Section header table's file offset, in bytes. The value of 0 indicates no section header table. (Relocatable files must have a section header table.)

e_flag

Processor-specific flags associated with the file. For the Intel 80386, this field has value 0.

e_ehsize

ELF header's size, in bytes.

e_phentsize

Size, in bytes, of entries in the program header table. All entries are the same size. (Relocatable files do not need a program header table.)

e_phnum

Number of entries in program header table. A value of 0 indicates the file has no program header table. (Relocatable files do not need a program header table.)

e_shentsize

Size, in bytes, of the section header structure. A section header is one entry in the section header table; all entries are the same size.

e_shnum

Number of entries in section header table. A value of 0 indicates the file has no section header table. (Relocatable files must have a section header table.)

e_shstrndx

Section header table index of the entry associated with the section name string table. A value of SHN_UNDEF indicates the file does not have a section name string table.

Table 3-1 Object File Types

Type 

Value 

Description 

none 

No file type 

rel 

Relocatable file 

exec 

Executable file 

dyn 

Shared object file 

core 

Core file 

loproc 

0xff00 

Processor-specific 

hiproc 

0xffff 

Processor-specific