HP eld Manual page 263

Table of Contents

Advertisement

TNS/E Native Object Files
Relocation Tables
In more detail, the reference must also be within the data segment, not the text
segment, of the loadfile. This is a requirement because the text and data segment
could get rebased by different amounts at runtime, changing the GP-relative addresses
of items in the text segment, but such references can't be updated at load time.
Although the HP NonStop operating system does not rebase the text and data
segments by different amounts at load time, we still obey this rule about 64-bit GP-
relative addressing, and it is important to the linker's -alf option, which can rebase the
text and data segments by different amounts.
\When using this relocation type, the compiler or assembler would generate code that
loads a 64-bit value into a register and adds it to the GP register. The linker would fill
in that 64-bit operand by subtracting the value of the GP register for this loadfile from
the address of the data item. The relocation table entry would not exist in the resulting
loadfile.
R_IA_64_GPREL64I is also used in gateway code, to calculate the 64-bit GP-relative
address of the procedure for which this is the gateway. Then the address of the
procedure is calculated by adding this value to the GP register.
R_IA_64_LTOFF22 -- 22-Bit GP-Relative Address of a .got Section Entry
This applies to the situation where there is a reference to a data item in code and the
compiler or assembler does not do it directly by GP-relative addressing, as described
in the previous two items. Here, the compiler or assembler generates code that adds a
signed 22-bit offset to the GP register in order to get the address of an entry in the .got
section, which in turn contains the address of the data item. The linker allocates that
.got section entry and fills in the 22-bit operand by subtracting the value of the GP
register for this loadfile from the address of this .got entry. This relocation table entry is
not present in loadfiles. The linker would instead generate a relocation table entry of
type R_IA_64_DIR64MSB to describe the .got entry.
It is also possible to use this relocation type to get the address of a procedure from the
.got. That is not a common thing to do, because you generally need the address of its
official function descriptor, which is done instead with R_IA_64_LTOFF_FPTR22.
However, gateways use R_IA_64_LTOFF22 to get the real address of the EnterPriv
labels from the .got section. Then that .got entry is used to branch to the EnterPriv
label. A function descriptor is not used in this case, because the gateway does not
need to set up the GP value for the EnterPriv label.
R_IA_64_LTOFF64I -- 64-Bit GP-Relative Address of a .got Section Entry
This may also be used in gateways, like R_IA_64_LTOFF22, to calculate the 64-bit
GP-relative address of the .got entry for an EnterPriv label.
R_IA_64_PLTOFF22 -- 22-Bit GP-Relative Address of a Local Function Descriptor
This applies to the situation where there is a direct procedure call and the compiler or
assembler has generated code that adds a signed 22-bit offset to the GP register in
order to get the address of the local function descriptor for the target procedure. The
linker allocates the local function descriptor and fills in the 22-bit operand by
eld Manual—527255-009
A-21

Advertisement

Table of Contents
loading

Table of Contents