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


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


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