Assembles expressions into a Table of Contents (TOC) entry.
.tc | [Name][TC], Expression[,Expression,...] |
The .tc pseudo-op assembles Expressions into a TOC entry, which contains the address of a routine, the address of a function descriptor, or the address of an external variable. A .tc statement can only appear inside the scope of a .toc pseudo-op. A TOC entry can be relocated as a body. TOC entry statements can have local labels, which will be relative to the beginning of the entire TOC as declared by the first .toc statement. Addresses contained in the TOC entry can be accessed using these local labels and the TOC Register GPR 2.
TOC entries that contain only one address are subject to being combined by the binder. This can occur if the TOC entries have the same name and reference the same control section (csect) (symbol). Be careful when coding TOC entries that reference nonzero offsets within a csect. To prevent unintended combining of TOC entries, unique names should be assigned to TOC entries that reference different offsets within a csect.
The following example illustrates the use of the .tc pseudo-op:
.toc # Create three TOC entries, the first # with the name proga, the second # with the name progb, and the last # unnamed. T.proga: .tc proga[TC],progr[RW],dataA T.progb: .tc progb[TC],proga[PR],progb[PR] T.progax: .tc proga[TC],dataB .tc [TC],dataB .csect proga[PR] # A .csect should precede any statements following a # .toc/.tc section which do not belong in the TOC. l 5,T.proga(2) # The address of progr[RW] # is loaded into GPR 5. l 5,T.progax(2) # The address of progr[RW] # is loaded into GPR 5. l 5,T.progb+4(2) # The address of progb[PR] # is loaded into GPR 5.
.csect Pseudo-op, .toc Pseudo-op, .tocof Pseudo-op.