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: undefined symbol in immediate operand


Hi

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!

Jeremy


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