This is the mail archive of the binutils@sources.redhat.com 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]

gas: inconsistencies w/ immediates


Using HJ's 2.9.5.0.34 binutils release (x86):

The handling of immediate constants appears to be inconsistent:


	movl	$1234,%eax

OK, this moves an immediate into eax.


	movl	$1234/$10,%eax

This fails because it is treating $10 as a label, not as a constant.


	.equ	some_label,$1234

Here, the assembler treats $1234 as a label!



This bizarre handling of $NNN really bites because this is the format in
which compiler-generated constants come out of GCC. For example, suppose
you wish to do this:


foo()
{
        asm(".equ SIZEOF_FOO,%0" :: "i" (sizeof foo));
}

bar()
{
        asm("movl $SIZEOF_FOO,%eax");
}

main()
{}

mnm:/home/morton> gcc -O x.c
/tmp/cc86xNLu1.o: In function `bar':
/tmp/cc86xNLu1.o(.text+0xc): undefined reference to `$1'


I'm unaware of any workaround which will allow the above to be done.


So is it possible to make the following changes:

1: Support $NN in gas expressions (I don't need this, but it
   seems sensible) and

2: Support $NN as integers (not labels) in pseudo-ops.

Thanks.

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