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
GO_IF_LEGITIMATE_ADDRESS
and PRINT_OPERAND_ADDRESS
, as
well as 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.
PIC_OFFSET_TABLE_REGNUM
findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
PIC_OFFSET_TABLE_REGNUM
is clobbered by calls. Do not define
this macro if PPIC_OFFSET_TABLE_REGNUM
is not defined.
FINALIZE_PIC
The FINALIZE_PIC
macro serves as a hook to emit these special
codes once the function is being compiled into assembly code, but not
before. (It is not done before, because in the case of compiling an
inline function, it would lead to multiple PIC prologues being
included in functions which used inline functions and were compiled to
assembly language.)
LEGITIMATE_PIC_OPERAND_P (x)
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.