• The GNU linker uses the linking view while creating an executable or a shared library. To do this, the linker needs more detailed information about the file than is necessary for execution. So the linking view provides a finer granularity— down to single sections. All the sections of an ELF file are listed in the section header table. A section always has a name and a type that tell the linker what to do with the section during link step. Standard section names start with a ‘.’ as in .text and .data.
• The dynamic loader (ld.so) uses the execution view to lay out the contents of the file into the process memory. The program header table describes which portion (segment in ELF terminology) of the file must be mapped to which process memory location. A segment might cover several sections simultaneously. Not all sections are needed for execution (e.g., sections with debugging information). Those simply aren’t covered by any segment in the program header table.
Although the ELF file format itself is platform-independent, the content of the sections isn’t, so usually some platform-dependent extensions exist. These specialties mostly comprise the structure of the procedure linkage table and global offset table—both used for dynamic linking.
More information about ELF and object file formats appears in the book Linkers & Loaders by John R. Levine (Morgan Kaufmann Publishers, San Diego, 2000, ISBN 1-55860-496-0).
Architecture-dependent extensions to ELF documentation appear on the Linux Foundation Website. Refer to:
• Linux for S/390 ELF Application Binary Interface Supplement, IBM Document Number LNUX-1107-00, 2001, http://oss.software.ibm.com/linux390/docu/ l390abi0.pdf
• Linux for zSeries ELF Application Binary Interface Supplement, IBM Document Number LNUX-1107-00, 2001, http://oss.software.ibm.com/linux390/docu/lzsabi0.pdf.
The process of translating source code written in a higher-level programming language into machine executable form occurs in three phases (see Figure 2). The first phase analyzes the source code and checks whether it conforms to the programming language specification. Most of the compiler’s error messages and warnings are issued in this phase. The result of the source code analysis is an internal program representation based on attributed syntax trees.