|
|
Object files participate in program linking (building a program) and program execution (running a program). For convenience and efficiency, the object file format provides parallel views of a file's contents, reflecting the differing needs of those activities. The object file's organization is shown below.
Linking View | Execution View |
---|---|
ELF header | ELF header |
Program header table | Program header table |
optional | |
Section 1 | Segment 1 |
[. . .] | |
Section n | Segment 2 |
[. . .] | |
[. . .] | [. . .] |
Section header table | Section header table |
optional |
Object file format
An ELF header resides at the beginning and holds a ``road map'' describing the file's organization. Sections hold the bulk of object file information for the linking view: instructions, data, symbol table, relocation information, and so on, these are described in ``Special sections''.
A program header table tells the system how to create a process image. Files used to build a process image (execute a program) must have a program header table; relocatable files do not need one. A section header table contains information describing the file's sections. Every section has an entry in the table; each entry gives information such as the section name, the section size, and so on. Files used during linking must have a section header table; other object files may or may not have one.