This is the mail archive of the
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: Wed, 29 May 2013 14:46:04 +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> <20130528031318207293 dot ff43c7c2 at gpio dot dk> <20130528015648 dot GD6878 at bubble dot grove dot modra dot org>
I'm never sure. 30 years of software development taught me to never be sure...
The reason that I use macros, is that on my end, they gives a better overview, thus reducing the chance of bugs and errors.
Anyway, I've narrowed it down a bit. To me it seems that '.type' affects the outcome.
It does not matter at all whether or not I use a .text or .section directive.
I see nothing in the documentation for .type, that it should have such side-effects.
However, if removing '.type' from handlerFunction* then it succeeds.
I've removed all macros, so the file has been reduced to make it easy to overview.
Try dropping this into a text-file and assemble it with the command line supplied.
-Unless, of course, that you already have the answer. ;)
;/* File: testSection.S */
;/* Assemble using the following command-line: */
;/* arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -x assembler-with-cpp -c testSection.S */
.type handlerFunction1,%function /* if disabling this line, assembling also succeeds. */
.text /* (doesn't matter) */
tableFunction: bx lr
.hword (handlerFunction1 - tableBase) /* fails */
.hword ((handlerFunction1 - tableBase) | 1) /* succeeds */
handlerFunction1: bx lr
On Tue, 28 May 2013 11:26:48 +0930, Alan Modra wrote:
> On Tue, May 28, 2013 at 03:13:18AM +0200, Jens Bauer wrote:
>> They are in the same section,
> Are you sure? Macros can be confusing.. Please post a self-contained
> testcase if you need further help.
>> -So I keep switching *to* the .fastcode section, but not out of it.
> That shouldn't matter.
> Alan Modra
> Australia Development Lab, IBM