This is the mail archive of the
mailing list for the binutils project.
gas: undefined symbol in immediate operand
- From: "Jeremy Dexter" <jeremy dot dexter at datataker dot com dot au>
- To: <binutils at sourceware dot org>
- Date: Thu, 24 Aug 2006 13:51:24 +1000
- Subject: gas: undefined symbol in immediate operand
I'm finding that if I accidentally enter an undefined symbol name as an
*immediate* operand, then as will accept it without any warning. I've tried
this on binutils 2.14 and 2.17 for ARM and PowerPC.
For example, the ARM assembler produces the following:
.equ Moo, 0x42
297 0148 000080E3 orr r0,r0,#moo
Note the typo in the symbol name. The assembler accepts it and adds an
undefined symbol "moo" to the object file, but the linker will not flag it
as undefined, which I presume is because there is no valid reference to it.
So you end up with code that ORs the value 0x00 rather than 0x42.
I would have thought that the assembler is at fault here. An immediate
operand should resolve to a *constant* - an external symbol reference should
not be accepted here. Or am I missing something?
Thanks in advance!