This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
GAS (ARM): Possible bug in relative/relocatable address detection
- From: Jens Bauer <jens-lists at gpio dot dk>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 28 May 2013 00:40:17 +0200
- Subject: 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