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]

GAS (ARM): Possible bug in relative/relocatable address detection


Hi list.

The GAS I'm using is from Binutils 2.23.1
I've written a macro to generate a table of relative offsets.

					.macro				IntTab	nextVector:req,prologue
					.ifnb				\prologue
					.hword				(\prologue - tableBase)
					.else
					.hword				(xHSyncStartInterrupt - tableBase)
					.endif
;//					.hword				((\nextVector - tableBase) | 0)				/* this can be done, but not without the (... | 0) */
;//					.hword				((\nextVector - tableBase))					/* fails */
					.hword				(\nextVector - tableBase)					/* fails */
					.endm


If I omit (... | 0), I get the following error:

Error: cannot represent BFD_RELOC_16_PCREL relocation in this object file format

I'm building for ARM, but this may apply to all platforms.

...But if I add (... | 0), the generated table appears to be correct.
You can also use...
	(... >> 0)
	(... << 0)
	(... & ~0)
	(... ^ 0)
	(... * 1)
	(... / 1)
...But you still get the error if you use (... + 0) or (... - 0).

As the parameters to the macro are all relocatable, and (relocatable - relocatable) = relative, this seems to be a bug.


Love
Jens


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