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