This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: GAS (ARM): Possible bug in relative/relocatable address detection
- From: Jens Bauer <jens-lists at gpio dot dk>
- To: Alan Modra <amodra at gmail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 28 May 2013 03:13:18 +0200
- 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>
Hi Alan.
On Tue, 28 May 2013 09:53:42 +0930, Alan Modra wrote:
> On Tue, May 28, 2013 at 12:40:17AM +0200, Jens Bauer wrote:
>> ...But if I add (... | 0), the generated table appears to be correct.
>
> That is likely a bug. You probably ought to be getting an error.
>
> I suspect you are trying to subtract two symbols defined in different
> sections.
They are in the same section, but this might be a cause:
I've not 'switched out' of that section, however, I did 'switch in' several times (each time I started a new function)
> That generally isn't allowed because sections don't have a
> fixed relation to each other at assembly time, and ELF relocations
> normally only specify one symbol. In your case it looks like the
> subtrahend symbol is defined in the same section as the expression,
> gas converts the subtrahend to a pc-relative value (in order to reduce
> the number of symbols to one), but ARM doesn't support a 16-bit
> pc-relative relocation.
I think this all makes sense.
Between my labels, I have something like this...
.section .fastcode,"ax",%progbits
.global functionName
.type functionName,%function
.func functionName,functionName
.thumb_func
.align
functionName:
... all generated by using a macro.
-So I keep switching *to* the .fastcode section, but not out of it.
I've used .pool once (right above the last function), but otherwise I don't think there is any other directives used between the symbols.
I could try creating a few 'section' wrapper macros, which sets a variable, so the section will only be switched in case it's not already the current section.
If section switching stays in the same section, isn't it incorrect to put a 'break' / 'slice' at the new .section position ?
Love
Jens