Allows for the definition of a local symbol as the table of contents of an external symbol so that the local symbol can be used in expressions.
The .tocof pseudo-op makes the Name2 value globally visible to the linker and marks the Name1 symbol as the table of contents (TOC) of another module that contains the symbol Name2. As a result, a local symbol can be defined as the TOC of an external symbol so that the local symbol can be used in expressions or to refer to the TOC of another module, usually in a .tc statement. This pseudo-op generates a Relocation Dictionary entry (RLD) that causes this data to be initialized to the address of the TOC external symbols. The .tocof pseudo-op can be used for intermodule calls that require the caller to first load up the address of the called module's TOC before transferring control.
|Name1||Specifies a local symbol that acts as the TOC of a module that contains the Name2 value. The Name1 symbol should appear in .tc statements.|
|Name2||Specifies an external symbol that exists within a module that contains a TOC.|
The following example illustrates the use of the .tocof pseudo-op:
tocbeg: .toc apb: .tc [tc],pb,tpb # This is an unnamed TOC entry # that contains two addresses: # the address of pb and # the address of the TOC # containing pb. .tocof tpb,pb .set always,0x14 .csect [PR] .using tocbeg,rtoc l 14,apb # Load R14 with the address # of pb. l rtoc,apb+4 # Load the TOC register with the # address pb's TOC. mtspr lr,14 # Move to Link Register. bcr always,0 # Branch Conditional Register branch # address is contained in the Link # register.
The .tc pseudo-op, .toc pseudo-op.