Data Representation
The object file format supports various processors with 8-bit bytes, 32-bit architectures and 64-bit architectures. Nevertheless, the data representation is intended to be extensible to larger, or smaller, architectures. Table 14-1 and Table 14-2 list the 32-bit data types and 64-bit data types.
Object files represent some control data with a machine-independent format. This format provides for the common identification and interpretation of object files. The remaining data in an object file use the encoding of the target processor, regardless of the machine on which the file was created.
Table 14-1 ELF 32-Bit Data Types
Name | Size | Alignment | Purpose |
---|---|---|---|
|
|
|
Unsigned program address |
|
|
|
Unsigned medium integer |
|
|
|
Unsigned file offset |
|
|
|
Signed integer |
|
|
|
Unsigned integer |
|
|
|
Unsigned small integer |
Table 14-2 ELF 64-Bit Data Types
Name | Size | Alignment | Purpose |
---|---|---|---|
|
|
|
Unsigned program address |
|
|
|
Unsigned medium integer |
|
|
|
Unsigned file offset |
|
|
|
Signed integer |
|
|
|
Unsigned integer |
|
|
|
Unsigned long integer |
|
|
|
Signed long integer |
|
|
|
Unsigned small integer |
All data structures that the object file format defines follow the natural size and alignment guidelines for the relevant class. Data structures can contain explicit padding to ensure 4-byte alignment for 4-byte objects, to force structure sizes to a multiple of 4, and so forth. Data also have suitable alignment from the beginning of the file. Thus, for example, a structure containing an Elf32_Addr
member is aligned on a 4-byte boundary within the file. Similarly, a structure containing an Elf64_Addr
member is aligned on an 8-byte boundary.
Note:
For portability, ELF uses no bit-fields.