Node:Alpha-Relocs, Previous:Alpha-Regs, Up:Alpha Syntax
Some of these relocations are available for ECOFF, but mostly only for ELF. They are modeled after the relocation format introduced in Digial Unix 4.0, but there are additions.
The format is !tag or !tag!number
where tag is the name of the relocation. In some cases
number is used to relate specific instructions.
The relocation is placed at the end of the instruction like so:
ldah $0,a($29) !gprelhigh lda $0,a($0) !gprellow ldq $1,b($29) !literal!100 ldl $2,0($1) !lituse_base!100
!literal
!literal!N
ldq instruction to load the address of a symbol
from the GOT.
A sequence number N is optional, and if present is used to pair
lituse relocations with this literal relocation. The
lituse relocations are used by the linker to optimize the code
based on the final location of the symbol.
Note that these optimizations are dependent on the data flow of the
program. Therefore, if any lituse is paired with a
literal relocation, then all uses of the register set by
the literal instruction must also be marked with lituse
relocations. This is because the original literal instruction
may be deleted or transformed into another instruction.
Also note that there may be a one-to-many relationship between
literal and lituse, but not a many-to-one. That is, if
there are two code paths that load up the same address and feed the
value to a single use, then the use may not use a lituse
relocation.
!lituse_base!N
ldl) to indicate
that the literal is used for an address load. The offset field of the
instruction must be zero. During relaxation, the code may be altered
to use a gp-relative load.
!lituse_jsr!N
jsr) to
indicate that the literal is used for a call. During relaxation, the
code may be altered to use a direct branch (e.g. bsr).
!lituse_bytoff!N
extbl) to indicate
that only the low 3 bits of the address are relevant. During relaxation,
the code may be altered to use an immediate instead of a register shift.
!lituse_addr!N
ldq instruction may not be
altered or deleted. This is useful in conjunction with lituse_jsr
to test whether a weak symbol is defined.
ldq $27,foo($29) !literal!1 beq $27,is_undef !lituse_addr!1 jsr $26,($27),foo !lituse_jsr!1
!gpdisp!N
ldah and lda to load the GP from the current
address, a-la the ldgp macro. The source register for the
ldah instruction must contain the address of the ldah
instruction. There must be exactly one lda instruction paired
with the ldah instruction, though it may appear anywhere in
the instruction stream. The immediate operands must be zero.
bsr $26,foo ldah $29,0($26) !gpdisp!1 lda $29,0($29) !gpdisp!1
!gprelhigh
ldah instruction to add the high 16 bits of a
32-bit displacement from the GP.
!gprellow
!gprel
!samegp
$27
or perform a standard GP load in the first two instructions via the
.prologue directive.