.ref pseudo-op
Purpose
Creates a R_REF type entry in the relocation table for one or more symbols.
Syntax
.ref Name[,Name...]
Description
The .ref pseudo-op supports the creation of multiple RLD entries in the same location. This psuedo-op is used in the output of some compilers to ensure the linkage editor does not discard routines that are used but not referenced explicitly in the text or data sections.
For example, in C++, constructors and destructors are used to construct and destroy class objects. Constructors and destructors are sometimes called only from the run-time environment without any explicit reference in the text section.
The following rules apply to the placement of a .ref pseudo-op in the source program:
- The .ref pseudo-op cannot be included in a dsect or csect with a storage mapping class of BS or UC.
- The .ref pseudo-op cannot be included in common sections or local common sections.
The following rules apply to the operands of the .ref pseudo-op (the Name parameter):
- The symbol must be defined in the current source module.
- External symbols can be used if they are defined by .extern or .globl.
- Within the current source module, the symbol can be a csect name (meaning a Qualname) or a label defined in the csect.
- The following symbols
cannot be used for the .ref operand:
- pseudo-op .dsect names
- labels defined within a dsect
- a csect name with a storage mapping class of BS or UC
- labels defined within a csect with a storage mapping class of BS or UC
- a pseudo-op .set Name operand which represents a non-relocatable expression type
Parameters
Item | Description |
---|---|
Name | Specifies a symbol for which a R_REF type entry in the relocation table should be created. |
Examples
The following example demonstrates the use of the .ref pseudo-op:
.csect a1[pr]
C1: l 10, 20(20)
.long 0xff
.csect a2[pr]
.set r10,10
.extern C4
C2: .long 10
C3: .long 20
.ref C1,C2,C3
.ref C4