The object file format for AIX 5.1 on an Itanium-based platform.
The file name a.out is the default output file name from the ld command, which is the link editor. The ld command makes an a.out executable if there were no errors in linking. The output file of the as command, which is the assembler, also follows the format of the a.out file, although its default file name is different.
Programs that manipulate ELF (Executable and Linking Format) files may use
the ELF library.
|Linking View||Execution View|
|ELF header||ELF header|
|Program header table||Program header table|
|Section 1||Segment 1|
|. . .|
|Section n||Segment 2|
|. . .|
|. . .||. . .|
|Section header table||Section header table|
An ELF header resides at the beginning and holds a "road map" describing the file's organization. Sections hold most of the of object file information for the linking view: instructions, data, symbol table, relocation information, and so on. Segments hold the object file information for the program execution view. As shown in the table above, a segment may contain one or more sections.
A program header table, if present, 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.
Although the figure shows the program header table immediately after the ELF header and the section header table following the sections, actual files may differ. Moreover, sections and segments have no specified order. Only the ELF header has a fixed position in the file.
When an a.out file is loaded into memory for execution, three logical segments are set up: the text segment, the data segment (initialized data followed by uninitialized, the latter actually being initialized to all 0s), and a stack. The text segment is not writable by the program; if other processes are executing the same a.out file, the processes will share a single text segment.
When the process image is created, the part of the file holding the end of text and the beginning of data may appear twice. The duplicated section of text that appears at the beginning of data is never executed. Instead, it is duplicated so that the operating system may bring in pieces of the file in multiples of the actual page size without realigning the beginning of the data section to a page boundary. If the last text address is a multiple of the maximal page size, no duplication is necessary. The data segment is extended as requested by the brk subroutine.
The as command, the cc command, the ld command.
The brk subroutine.
Introduction to elf Subroutines