GAS (ARM): Possible bug in relative/relocatable address detection
Alan Modra
amodra@gmail.com
Wed May 29 14:02:00 GMT 2013
On Wed, May 29, 2013 at 02:46:04PM +0200, Jens Bauer wrote:
> 30 years of software development taught me to never be sure...
:-)
> .type handlerFunction1,%function /* if disabling this line, assembling also succeeds. */
Ah ha! From tc-arm.h, when a fixup is a subtraction of two symbols in
the same section we hit
/* Force output of R_ARM_REL32 relocations against thumb function symbols.
This is needed to ensure the low bit is handled correctly. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
(THUMB_IS_FUNC ((FIX)->fx_addsy) \
|| !SEG_NORMAL (SEG))
So the subtraction isn't allowed, the subtrahend is converted to a
pc-relative value, and then we run into lack of a suitable 16-bit
pc-relative relocation.
Your wrapping of the subtraction avoids this check, which I suppose is
a bug, but you might see it as a feature..
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list