This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GAS (ARM): Possible bug in relative/relocatable address detection


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]