On the SPARC platform, relocation entries apply to bytes (byte8), half-words (half16), words (word32), and extended-words (xword64).
The dispn family of relocation fields (disp19, disp22, disp30) are word-aligned, sign-extended, PC-relative displacements. All encode a value with its least significant bit in position 0 of the word, and differ only in the number of bits allocated to the value.
The d2/disp8 and d2/disp14 variants encode 16 and 10-bit displacement values using two non-contiguous bit fields, d2, and dispn.
The immn family of relocation fields (imm5, imm6, imm7, imm10, imm13, imm22) represent unsigned integer constants. All encode a value with its least significant bit in position 0 of the word, and differ only in the number of bits allocated to the value.
The simmn family of relocation fields (simm10, simm11, simm13, simm22) represent signed integer constants. All encode a value with its least significant bit in position 0 of the word, and differ only in the number of bits allocated to the value.
Field names in the following table tell whether the relocation type checks for overflow. A calculated relocation value can be larger than the intended field, and a relocation type can verify (V) the value fits or truncate (T) the result. As an example, V-simm13 means that the computed value can not have significant, nonzero bits outside the simm13 field.
|
Some relocation types have semantics beyond simple calculation.
Resembles R_SPARC_LO10, except that the relocation refers to the address of the symbol's GOT entry. Additionally, R_SPARC_GOT10 instructs the link-editor to create a global offset table.
Resembles R_SPARC_13, except that the relocation refers to the address of the symbol's GOT entry. Additionally, R_SPARC_GOT13 instructs the link-editor to create a global offset table.
Resembles R_SPARC_22, except that the relocation refers to the address of the symbol's GOT entry. Additionally, R_SPARC_GOT22 instructs the link-editor to create a global offset table.
Resembles R_SPARC_WDISP30, except that the relocation refers to the address of the symbol's procedure linkage table entry. Additionally, R_SPARC_WPLT30 instructs the link-editor to create a procedure linkage table.
Created by the link-editor for dynamic executables to preserve a read-only text segment. The relocation offset member refers to a location in a writable segment. The symbol table index specifies a symbol that should exist both in the current object file and in a shared object. During execution, the runtime linker copies data associated with the shared object's symbol to the location specified by the offset. See Copy Relocations.
Resembles R_SPARC_32, except that the relocation sets a GOT entry to the address of the specified symbol. The special relocation type enables you to determine the correspondence between symbols and GOT entries.
Created by the link-editor for dynamic objects to provide lazy binding. The relocation offset member gives the location of a procedure linkage table entry. The runtime linker modifies the procedure linkage table entry to transfer control to the designated symbol address.
Created by the link-editor for dynamic objects. The relocation offset member gives the location within a shared object that contains a value representing a relative address. The runtime linker computes the corresponding virtual address by adding the virtual address at which the shared object is loaded to the relative address. Relocation entries for this type must specify a value of zero for the symbol table index.
Resembles R_SPARC_32, except that the relocation refers to an unaligned word. The word to be relocated must be treated as four separate bytes with arbitrary alignment, not as a word aligned according to the architecture requirements.
Resembles R_SPARC_HI22, except that the relocation truncates rather than validates.
Resembles R_SPARC_PC22, except that the relocation truncates rather than validates.
Used with R_SPARC_LOX10 for executables that are confined to the uppermost 4 gigabytes of the 64–bit address space. Similar to R_SPARC_HI22, but supplies ones complement of linked value.
Used with R_SPARC_HIX22. Similar to R_SPARC_LO10, but always sets bits 10 through 12 of the linked value.
Used with the R_SPARC_H44 and R_SPARC_M44 relocation types to generate a 44-bit absolute addressing model.
Used to initialize a register symbol. The relocation offset member contains the register number to be initialized. A corresponding register symbol must exist for this register. The symbol must be of type SHN_ABS.
These relocations provide for code transformations.
The following notation, used in relocation calculation, is unique to 64–bit SPARC.
The secondary addend used to compute the value of the relocation field. This addend is extracted from the r_info field by applying the ELF64_R_TYPE_DATA macro.
The relocations that are listed in the following table extend, or alter, the relocations defined for 32–bit SPARC. See Relocation Types.
|
The following relocation type has semantics beyond simple calculation.
Resembles R_SPARC_LO10, except that an extra offset is added to make full use of the 13-bit signed immediate field.