This is the mail archive of the 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.

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 */

					.syntax				unified
					.type				tableFunction,%function
					.type				handlerFunction1,%function					/* if disabling this line, assembling also succeeds. */
					.global				tableFunction
					.global				handlerFunction1
					.text															/* (doesn't matter) */

tableFunction:		bx					lr

		.if 01
					.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

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