64-bit PowerPC ELF Application Binary Interface Supplement 1.4.1 | ||
---|---|---|
<<< Previous | Chapter 4. Object Files | Next >>> |
The Table of Contents, or TOC, is part of the data segment of an executable program.
This sections describes a typical layout of the TOC in an executable file or shared object. Particular tools need not follow this layout as specified here.
The TOC typically contains data items within the .got, .toc and .tocbss sections, which can be addressed with 16-bit signed offsets from the TOC base. The TOC base is typically the first address in the TOC plus 0x8000, thus permitting a full 64 Kbyte TOC. The .got section is typically created by the link editor based on @got relocations. The .toc and .tocbss sections are typically included from relocatable object files referenced during the link.
The TOC may straddle the boundary between initialized and uninitialized data in the data segment. The usual order of sections in the data segment, some of which may be empty, is:
.data .got .toc .tocbss .plt |
The link editor may create multiple TOC sections, as specified in Section 3.5.2. In such a case, the .got and .toc sections will be repeated as necessary, possibly renamed to preserve unique section names. Any occurrence of .tocbss in a TOC section other than the last one will be converted into a .toc section initialized to contain zero bytes.
Compilers may generate "short-form," one-instruction references for all data items that are in the TOC section for the object file being compiled. Such references are relative to the TOC pointer register, r2, which always holds the base of the TOC section for the object file.
In a shared object, only data items with local (non-global) scope may be addressed via the TOC pointer. Global data items must be addressed via the GOT, even if they appear in a .toc or .tocbss section.
A compiler which places some data items in the TOC must provide an option to avoid doing so in a particular compilation.
<<< Previous | Home | Next >>> |
Special Sections | Up | Symbol Table |