as: CRIS-Pic
1
1 9.8.4.2 Symbols in position-independent code
1 ............................................
1
1 When generating position-independent code (SVR4 PIC) for use in
1 cris-axis-linux-gnu or crisv32-axis-linux-gnu shared libraries, symbol
1 suffixes are used to specify what kind of run-time symbol lookup will be
1 used, expressed in the object as different _relocation types_. Usually,
1 all absolute symbol values must be located in a table, the _global
1 offset table_, leaving the code position-independent; independent of
1 values of global symbols and independent of the address of the code.
1 The suffix modifies the value of the symbol, into for example an index
1 into the global offset table where the real symbol value is entered, or
1 a PC-relative value, or a value relative to the start of the global
1 offset table. All symbol suffixes start with the character ':' (omitted
1 in the list below). Every symbol use in code or a read-only section
1 must therefore have a PIC suffix to enable a useful shared library to be
1 created. Usually, these constructs must not be used with an additive
1 constant offset as is usually allowed, i.e. no 4 as in 'symbol + 4' is
1 allowed. This restriction is checked at link-time, not at
1 assembly-time.
1
1 'GOT'
1
1 Attaching this suffix to a symbol in an instruction causes the
1 symbol to be entered into the global offset table. The value is a
1 32-bit index for that symbol into the global offset table. The
1 name of the corresponding relocation is 'R_CRIS_32_GOT'. Example:
1 'move.d [$r0+extsym:GOT],$r9'
1
1 'GOT16'
1
1 Same as for 'GOT', but the value is a 16-bit index into the global
1 offset table. The corresponding relocation is 'R_CRIS_16_GOT'.
1 Example: 'move.d [$r0+asymbol:GOT16],$r10'
1
1 'PLT'
1
1 This suffix is used for function symbols. It causes a _procedure
1 linkage table_, an array of code stubs, to be created at the time
1 the shared object is created or linked against, together with a
1 global offset table entry. The value is a pc-relative offset to
1 the corresponding stub code in the procedure linkage table. This
1 arrangement causes the run-time symbol resolver to be called to
1 look up and set the value of the symbol the first time the function
1 is called (at latest; depending environment variables). It is only
1 safe to leave the symbol unresolved this way if all references are
1 function calls. The name of the relocation is
1 'R_CRIS_32_PLT_PCREL'. Example: 'add.d fnname:PLT,$pc'
1
1 'PLTG'
1
1 Like PLT, but the value is relative to the beginning of the global
1 offset table. The relocation is 'R_CRIS_32_PLT_GOTREL'. Example:
1 'move.d fnname:PLTG,$r3'
1
1 'GOTPLT'
1
1 Similar to 'PLT', but the value of the symbol is a 32-bit index
1 into the global offset table. This is somewhat of a mix between
1 the effect of the 'GOT' and the 'PLT' suffix; the difference to
1 'GOT' is that there will be a procedure linkage table entry
1 created, and that the symbol is assumed to be a function entry and
1 will be resolved by the run-time resolver as with 'PLT'. The
1 relocation is 'R_CRIS_32_GOTPLT'. Example: 'jsr
1 [$r0+fnname:GOTPLT]'
1
1 'GOTPLT16'
1
1 A variant of 'GOTPLT' giving a 16-bit value. Its relocation name
1 is 'R_CRIS_16_GOTPLT'. Example: 'jsr [$r0+fnname:GOTPLT16]'
1
1 'GOTOFF'
1
1 This suffix must only be attached to a local symbol, but may be
1 used in an expression adding an offset. The value is the address
1 of the symbol relative to the start of the global offset table.
1 The relocation name is 'R_CRIS_32_GOTREL'. Example: 'move.d
1 [$r0+localsym:GOTOFF],r3'
1