a.out.4 (2010 09)

a
a.out(4) a.out(4)
#define e_lsel 3 /* L’: leftmost 21 bits */
#define e_rsel 4 /* R’: rightmost 11 bits */
#define e_ldsel 5 /* LD’: inverse of RD’ */
#define e_rdsel 6 /* RD’: rightmost 11 bits, filled left with ones */
#define e_lrsel 7 /* LR’: L’ with "rounded" constant */
#define e_rrsel 8 /* RR’: R’ with "rounded" constant */
#define e_nsel 9 /* N1’: set all bits to zero: for id of 3-inst
code gen sequence */
/* Values for fixup_format (typical instructions shown) */
#define i_exp14 0 /* 14-bit immediate (LDW, STW) */
#define i_exp21 1 /* 21-bit immediate (LDIL, ADDIL) */
#define i_exp11 2 /* 11-bit immediate (ADDI, SUBI) */
#define i_rel17 3 /* 17-bit pc-relative (BL) */
#define i_rel12 4 /* 12 bit pc-relative (COMBT, COMBF, etc.) */
#define i_data 5 /* whole word */
#define i_none 6
#define i_abs17 7 /* 17-bit absolute (BE, BLE) */
#define i_milli 8 /* 17-bit millicode call (BLE) */
#define i_break 9 /* reserved (no effect on HP-UX) */
In newer object files, relocation entries consist of a stream of bytes. The fixup_request_index field in the
subspace dictionary entry is a byte offset into the fixup dictionary defined by the file header, and the
fixup_request_quantity field defines the length of the fixup request stream, in bytes, for that subspace.
The first byte of each fixup request (the opcode) identifies the request and determines the length of the
request.
In general, the fixup stream is a series of linker instructions that governs how the linker places data in
the
a.out file. Certain fixup requests cause the linker to copy one or more bytes from the input sub-
space to the output subspace without change, while others direct the linker to relocate words or resolve
external references. Still others direct the linker to insert zeroes in the output subspace or to leave areas
uninitialized without copying any data from the input subspace, and others describe points in the code
without contributing any new data to the output file.
The include file
<reloc.h> defines constants for each major opcode. Many fixup requests use a range of
opcodes; only a constant for the beginning of the range is defined. The meaning of each fixup request is
described below. The opcode ranges and parameters for each fixup are described in the table further
below.
R_NO_RELOCATION Copy L bytes with no relocation.
R_ZEROES Insert L zero bytes into the output subspace.
R_UNINIT Skip L bytes in the output subspace.
R_RELOCATION Copy one data word with relocation. The word is assumed to contain a 32-bit
pointer relative to its own subspace.
R_DATA_ONE_SYMBOL Copy one data word with relocation relative to an external symbol whose sym-
bol index is S.
R_DATA_PLABEL Copy one data word as a 32-bit procedure label, referring to the symbol S. The
original contents of the word should be 0 (no static link) or 2 (static link
required).
R_SPACE_REF Copy one data word as a space reference. This fixup request is not currently
supported.
R_REPEATED_INIT Copy L bytes from the input subspace, replicating the data to fill M bytes in
the output subspace.
R_PCREL_CALL Copy one instruction word with relocation. The word is assumed to be a pc-
relative procedure call instruction (for example, BL). The target procedure is
identified by symbol S, and the parameter relocation bits are R.
R_ABS_CALL Copy one instruction word with relocation. The word is assumed to be an
absolute procedure call instruction (for example, BLE). The target procedure
is identified by symbol S, and the parameter relocation bits are R.
HP-UX 11i Version 3: September 2010 9 Hewlett-Packard Company 9