|
|
As described here, the object file format supports various processors with 8-bit bytes and 32-bit or 64-bit architectures. Nevertheless, it is intended to be extensible to larger (or smaller) architectures. Object files therefore represent some control data with a machine-independent format, making it possible to identify object files and interpret their contents in a common way. Remaining data in an object file use the encoding of the target processor, regardless of the machine on which the file was created.
Name | Size | Alignment | Purpose |
---|---|---|---|
Elf32_Addr | 4 | 4 | Unsigned program address |
Elf32_Off | 4 | 4 | Unsigned file offset |
Elf32_Half | 2 | 2 | Unsigned medium integer |
Elf32_Word | 4 | 4 | Unsigned integer |
Elf32_Sword | 4 | 4 | Signed integer |
unsigned char | 1 | 1 | Unsigned small integer |
32-Bit data types
Name | Size | Alignment | Purpose |
---|---|---|---|
Elf64_Addr | 8 | 8 | Unsigned program address |
Elf64_Off | 8 | 8 | Unsigned file offset |
Elf64_Half | 2 | 2 | Unsigned medium integer |
Elf64_Word | 4 | 4 | Unsigned integer |
Elf64_Sword | 4 | 4 | Signed integer |
Elf64_Xword | 8 | 8 | Unsigned long integer |
Elf64_Sxword | 8 | 8 | Signed long integer |
unsigned char | 1 | 1 | Unsigned small integer |
64-Bit data types
All data structures that the object file format
defines follow the ``natural'' size and alignment guidelines
for the relevant class. If necessary, data structures contain
explicit padding to ensure 8-byte alignment for 8-byte objects,
4-byte alignment for 4-byte objects, to force structure sizes to
a multiple of 4 or 8, and so forth.
Data also have suitable alignment from the beginning of the file.
Thus, for example, a structure containing an
Elf32_Addr
member will be aligned on a 4-byte boundary within the file.
For portability reasons, ELF uses no bit-fields.