[arm] patch for GOTOFF relocs
Richard Earnshaw
rearnsha@arm.com
Mon Feb 18 09:35:00 GMT 2002
philb@gnu.org said:
> 2002-02-17 Philip Blundell <pb@nexus.co.uk>
> * config/arm/arm.c (arm_encode_call_attribute): Operate on any
> decl, not just FUNCTION_DECL.
> (legitimize_pic_address): Handle local SYMBOL_REF like LABEL_REF.
> (arm_assemble_integer): Likewise.
> * config/arm/arm.h (ARM_ENCODE_CALL_TYPE): Allow any decl to be
> marked local.
Ok, provided this doesn't break NetBSD a.out pic code (which has limited
relocs).
Incidentally, for the example you cite, the optimal PIC code would be:
f:
ldr r0, .L3
.L2
ldr r0, [pc, r0]
mov pc, lr
.L3
.word a-(.L2+8)
There's no need to indirect off the GOT for this example at all! However,
in the more general case it probably gives better sub-expression
elimination to do so.
R.
More information about the Gcc-patches
mailing list