Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ reloc(4) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

a.out(4)

syms(4)

pld(1)

pstrip(1)

reloc(4)

NAME

reloc − relocation information for a common object file

SYNOPSIS

#include  <reloc.h>

DESCRIPTION

Object files have one relocation entry for each relocatable reference in the text or data.  If relocation information is present, it will be in the following format. 

structreloc
{
longr_vaddr ;/∗ (virtual) address of reference /
longr_symndx ;/∗ index into symbol table /
shortr_type ;/∗ relocation type /
#if _M88K
unsigned short r_offset;/∗ hi16 bits of constant in hi16 or ∗/
/∗ lo16 expression. ∗/
#endif
} ;
  /∗
 ∗ All generics
 ∗reloc. already performed to symbol in the same section
 ∗/
#define  R_ABS0
 /∗
 ∗ HCX Processor
 ∗
 ∗/
#define R_RELBYTE017
#define R_RELWORD020
#define R_RELLONG021
#define R_PCRBYTE022
#define R_PCRWORD023
#define R_PCRLONG024

As the link editor reads each input section and performs relocation, the relocation entries are read. They direct how references found within the input section are treated. 

R_ABS The reference is absolute, and no relocation is necessary.  The entry will be ignored. 

R_DIR24 A direct, 24-bit reference to a symbol’s virtual address. 

R_REL24 A ”PC-relative”, 24-bit reference to a symbol’s virtual address.  Relative references occur in instructions such as jumps and calls.  The actual address used is obtained by adding a constant to the value of the program counter at the time the instruction is executed. 

R_OPT16 An optimized, indirect, 16-bit reference through a transfer vector.  The instruction contains the offset into the transfer vector table to the transfer vector where the actual address of the referenced word is stored. 

R_IND24 An indirect, 24-bit reference through a transfer vector.  The instruction contains the virtual address of the transfer vector, where the actual address of the referenced word is stored. 

R_IND32 An indirect, 32-bit reference through a transfer vector.  The instruction contains the virtual address of the transfer vector, where the actual address of the referenced word is stored. 

R_RELBYTE
A direct 8-bit reference to a symbol’s virtual address.

R_RELWORD
A direct 16-bit reference to a symbol’s virtual address.

R_RELLONG
A direct 32-bit reference to a symbol’s virtual address.

R_PCRBYTE
A ”PC-relative”, 8-bit reference to a symbol’s virtual address.

R_PCRWORD
A ”PC-relative”, 16-bit reference to a symbol’s virtual address.

R_PCRLONG
A ”PC-relative”, 32-bit reference to a symbol’s virtual address.

On the HCX processors relocation of a symbol index of -1 indicates that the relative difference between the current segment’s start address and the program’s load address is added to the relocatable address. 

Other relocation types will be defined as they are needed. 

Relocation entries are generated automatically by the assembler and automatically utilized by the link editor. A link editor option exists for removing the relocation entries from an object file. 

SEE ALSO

a.out(4), syms(4). 
pld(1), pstrip(1) in the CX/UX User’s Reference Manual. 

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026