Previous: AVR32-Chars, Up: AVR32 Syntax

##### 9.5.2.2 Symbol references

The absolute value of a symbol can be obtained by simply naming the symbol. However, as AVR32 symbols have 32-bit values, most symbols have values that are outside the range of any instructions.

Instructions that take a PC-relative offset, e.g. `lddpc` or `rcall`, can also reference a symbol by simply naming the symbol (no explicit calculations necessary). In this case, the assembler or linker subtracts the address of the instruction from the symbol's value and inserts the result into the instruction. Note that even though an overflow is less likely to happen for a relative reference than for an absolute reference, the assembler or linker will generate an error if the referenced symbol is too far away from the current location.

Relative references can be used for data as well. For example:

                 lddpc   r0, 2f
         1:      add     r0, pc
                 ...
                 .align  2
         2:      .int    some_symbol - 1b

Here, r0 will end up with the run-time address of some_symbol even if the program was loaded at a different address than it was linked (position-independent code).

##### 9.5.2.3 Symbol modifiers

`hi(`symbol`)`
  Evaluates to the value of the symbol shifted right 16 bits. This will work even if symbol is defined in a different module.
`lo(`symbol`)`
  Evaluates to the low 16 bits of the symbol's value. This will work even if symbol is defined in a different module.
symbol`@got`
  Create a GOT entry for symbol and return the offset of that entry relative to the GOT base.