Some object file control structures can grow, because the ELF header contains their actual sizes. If the object file format changes, a program may encounter control structures that are larger or smaller than expected. An ELF header is set by the following C structure declaration:
e_ident The first bytes mark the file as an object file and provide machine-independent data with which to decode and interpret the file's contents.
e_type Identifies the object file type. Possible types are:
Name | Value | Meaning |
---|---|---|
ET_NONE |
0 |
No file type |
ET_REL |
1 |
Relocatable file |
ET_EXEC |
2 |
Executable file |
ET_LOPROC |
0xff00 |
Processor-specific |
ET_HIPROC |
0xffff |
Processor-specific |
e_machine Specifies the target architecture for an individual file:
e_version Identifies the object file version.
Name | Value | Meaning |
---|---|---|
EV_NONE |
0 |
Invalid version |
EV_CURRENT |
1 |
Current version |
The value 1 signifies the original file format; extensions will create new versions with higher numbers. The value of EV_CURRENT, though given as 1 above, will change as necessary to reflect the current version number.
e_entry Gives the virtual address to which the system first transfers control upon starting the process. If the file has no associated entry point, this member holds zero.
e_phoff Program header table's file offset in bytes. If the file has no program header table, it holds zero.
e_shoff Section header table's file offset in bytes. If the file has no section header table, this field holds zero.
e_flags Processor-specific flags associated with the file. Flag names take the form EF_machine_flag.
e_ehsize ELF header size in bytes.
e_phentsize Size in bytes of one entry in the file's program header table; all entries are the same size.
e_phnum Number of entries in the program header table. The product of e_phentsize and e_phnum gives the table's size in bytes. If a file has no program header table, e_phnum holds the value zero.
e_shentize Section header's size in bytes. A section header is one entry in the section header table; all entries are the same size.
e_shnum Number of entries in the section header table. The product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero.
e_shstrndx Section header table index of the entry associated with the section name string table. If the file has no section name string table, this member holds the value SHN_UNDEF.