17.20 Position Independent Code
This section describes macros that help implement generation of position
independent code. Simply defining these macros is not enough to
generate valid PIC; you must also add support to the macros
LEGITIMIZE_ADDRESS. You must modify the definition of
movsi to do something appropriate when the source operand
contains a symbolic address. You may also need to alter the handling of
switch statements so that they use relative addresses.
The register number of the register used to address a table of static data addresses in memory. In some cases this register is defined by a processor's “application binary interface” (ABI). When this macro is defined, RTL is generated for this register once, as with the stack pointer and frame pointer registers. If this macro is not defined, it is up to the machine-dependent files to allocate such a register (if necessary). Note that this register must be fixed when in use (e.g. when
Define this macro if the register defined by
PIC_OFFSET_TABLE_REGNUMis clobbered by calls. Do not define this macro if
PIC_OFFSET_TABLE_REGNUMis not defined.
A C expression that is nonzero if x is a legitimate immediate operand on the target machine when generating position independent code. You can assume that x satisfies
CONSTANT_P, so you need not check this. You can also assume flag_pic is true, so you need not check it either. You need not define this macro if all constants (including
SYMBOL_REF) can be immediate operands when generating position independent code.