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: Thu, 30 May 2013 18:01:32 +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> <20130529140152 dot GL6878 at bubble dot grove dot modra dot org> <20130529163943300239 dot 1a93cd9e at gpio dot dk>
On Wed, May 29, 2013 at 04:39:43PM +0200, Jens Bauer wrote:
> Hi Alan.
> Please forgive me for any possible misunderstandings in advance. ;)
> > /* Force output of R_ARM_REL32 relocations against thumb function symbols.
> > This is needed to ensure the low bit is handled correctly. */
> Question: *Is* the low bit actually handled correctly, or is this just the easiest way to fix the problem? :)
> > #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
> To me it smells a bit like a quickfix; is this because the linker does not know how to do a bitwise OR operation ?
The TC_FORCE_RELOCATION comment means that the *assembler* doesn't do
the right thing in some situations, but the linker does. By emitting
a relocation you leave final resolution of the value to link time.
I'm no ARM expert, but I'd guess that what is "correct" handling for
the low bit of thumb symbols depends on context (the ARM ABI reloc
specs seem to indicate this). The comment also mentions R_ARM_REL32
relocs (but doesn't test for them!) so your use case obviously wasn't
Australia Development Lab, IBM