This is the mail archive of the
mailing list for the binutils project.
Re: GAS (ARM): Possible bug in relative/relocatable address detection
- From: Alan Modra <amodra at gmail dot com>
- To: Jens Bauer <jens-lists at gpio dot dk>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 29 May 2013 23:31:52 +0930
- Subject: Re: GAS (ARM): Possible bug in relative/relocatable address detection
- References: <20130528004017761596 dot 7c67cd64 at gpio dot dk> <20130528002342 dot GC6878 at bubble dot grove dot modra dot org> <20130528031318207293 dot ff43c7c2 at gpio dot dk> <20130528015648 dot GD6878 at bubble dot grove dot modra dot org> <20130529144604402815 dot c516ad73 at gpio dot dk>
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
Your wrapping of the subtraction avoids this check, which I suppose is
a bug, but you might see it as a feature..
Australia Development Lab, IBM