as: Alpha-Relocs

1 
1 9.2.3.3 Relocations
1 ...................
1 
1 Some of these relocations are available for ECOFF, but mostly only for
1 ELF. They are modeled after the relocation format introduced in Digital
1 Unix 4.0, but there are additions.
1 
1    The format is '!TAG' or '!TAG!NUMBER' where TAG is the name of the
1 relocation.  In some cases NUMBER is used to relate specific
1 instructions.
1 
1    The relocation is placed at the end of the instruction like so:
1 
1      ldah  $0,a($29)    !gprelhigh
1      lda   $0,a($0)     !gprellow
1      ldq   $1,b($29)    !literal!100
1      ldl   $2,0($1)     !lituse_base!100
1 
1 '!literal'
1 '!literal!N'
1      Used with an 'ldq' instruction to load the address of a symbol from
1      the GOT.
1 
1      A sequence number N is optional, and if present is used to pair
1      'lituse' relocations with this 'literal' relocation.  The 'lituse'
1      relocations are used by the linker to optimize the code based on
1      the final location of the symbol.
1 
1      Note that these optimizations are dependent on the data flow of the
1      program.  Therefore, if _any_ 'lituse' is paired with a 'literal'
1      relocation, then _all_ uses of the register set by the 'literal'
1      instruction must also be marked with 'lituse' relocations.  This is
1      because the original 'literal' instruction may be deleted or
1      transformed into another instruction.
1 
1      Also note that there may be a one-to-many relationship between
1      'literal' and 'lituse', but not a many-to-one.  That is, if there
1      are two code paths that load up the same address and feed the value
1      to a single use, then the use may not use a 'lituse' relocation.
1 
1 '!lituse_base!N'
1      Used with any memory format instruction (e.g. 'ldl') to indicate
1      that the literal is used for an address load.  The offset field of
1      the instruction must be zero.  During relaxation, the code may be
1      altered to use a gp-relative load.
1 
1 '!lituse_jsr!N'
1      Used with a register branch format instruction (e.g. 'jsr') to
1      indicate that the literal is used for a call.  During relaxation,
1      the code may be altered to use a direct branch (e.g. 'bsr').
1 
1 '!lituse_jsrdirect!N'
1      Similar to 'lituse_jsr', but also that this call cannot be vectored
1      through a PLT entry.  This is useful for functions with special
1      calling conventions which do not allow the normal call-clobbered
1      registers to be clobbered.
1 
1 '!lituse_bytoff!N'
1      Used with a byte mask instruction (e.g. 'extbl') to indicate that
1      only the low 3 bits of the address are relevant.  During
1      relaxation, the code may be altered to use an immediate instead of
1      a register shift.
1 
1 '!lituse_addr!N'
1      Used with any other instruction to indicate that the original
1      address is in fact used, and the original 'ldq' instruction may not
1      be altered or deleted.  This is useful in conjunction with
1      'lituse_jsr' to test whether a weak symbol is defined.
1 
1           ldq  $27,foo($29)   !literal!1
1           beq  $27,is_undef   !lituse_addr!1
1           jsr  $26,($27),foo  !lituse_jsr!1
1 
1 '!lituse_tlsgd!N'
1      Used with a register branch format instruction to indicate that the
1      literal is the call to '__tls_get_addr' used to compute the address
1      of the thread-local storage variable whose descriptor was loaded
1      with '!tlsgd!N'.
1 
1 '!lituse_tlsldm!N'
1      Used with a register branch format instruction to indicate that the
1      literal is the call to '__tls_get_addr' used to compute the address
1      of the base of the thread-local storage block for the current
1      module.  The descriptor for the module must have been loaded with
1      '!tlsldm!N'.
1 
1 '!gpdisp!N'
1      Used with 'ldah' and 'lda' to load the GP from the current address,
1      a-la the 'ldgp' macro.  The source register for the 'ldah'
1      instruction must contain the address of the 'ldah' instruction.
1      There must be exactly one 'lda' instruction paired with the 'ldah'
1      instruction, though it may appear anywhere in the instruction
1      stream.  The immediate operands must be zero.
1 
1           bsr  $26,foo
1           ldah $29,0($26)     !gpdisp!1
1           lda  $29,0($29)     !gpdisp!1
1 
1 '!gprelhigh'
1      Used with an 'ldah' instruction to add the high 16 bits of a 32-bit
1      displacement from the GP.
1 
1 '!gprellow'
1      Used with any memory format instruction to add the low 16 bits of a
1      32-bit displacement from the GP.
1 
1 '!gprel'
1      Used with any memory format instruction to add a 16-bit
1      displacement from the GP.
1 
1 '!samegp'
1      Used with any branch format instruction to skip the GP load at the
1      target address.  The referenced symbol must have the same GP as the
1      source object file, and it must be declared to either not use '$27'
1      or perform a standard GP load in the first two instructions via the
1      '.prologue' directive.
1 
1 '!tlsgd'
1 '!tlsgd!N'
1      Used with an 'lda' instruction to load the address of a TLS
1      descriptor for a symbol in the GOT.
1 
1      The sequence number N is optional, and if present it used to pair
1      the descriptor load with both the 'literal' loading the address of
1      the '__tls_get_addr' function and the 'lituse_tlsgd' marking the
1      call to that function.
1 
1      For proper relaxation, both the 'tlsgd', 'literal' and 'lituse'
1      relocations must be in the same extended basic block.  That is, the
1      relocation with the lowest address must be executed first at
1      runtime.
1 
1 '!tlsldm'
1 '!tlsldm!N'
1      Used with an 'lda' instruction to load the address of a TLS
1      descriptor for the current module in the GOT.
1 
1      Similar in other respects to 'tlsgd'.
1 
1 '!gotdtprel'
1      Used with an 'ldq' instruction to load the offset of the TLS symbol
1      within its module's thread-local storage block.  Also known as the
1      dynamic thread pointer offset or dtp-relative offset.
1 
1 '!dtprelhi'
1 '!dtprello'
1 '!dtprel'
1      Like 'gprel' relocations except they compute dtp-relative offsets.
1 
1 '!gottprel'
1      Used with an 'ldq' instruction to load the offset of the TLS symbol
1      from the thread pointer.  Also known as the tp-relative offset.
1 
1 '!tprelhi'
1 '!tprello'
1 '!tprel'
1      Like 'gprel' relocations except they compute tp-relative offsets.
1