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:
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.
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.
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.
Identifies the version of this object file's format. This field should have the current version number, named EV_CURRENT.
Virtual address where the process is to start. A value of 0 indicates no associated entry point.
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.)
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.)
Processor-specific flags associated with the file. For the Intel 80386, this field has value 0.
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.)
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.)
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.
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.)
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.
Type |
Value |
Description |
---|---|---|
none |
0 |
No file type |
rel |
1 |
Relocatable file |
exec |
2 |
Executable file |
dyn |
3 |
Shared object file |
core |
4 |
Core file |
loproc |
0xff00 |
Processor-specific |
hiproc |
0xffff |
Processor-specific |