gas: inconsistencies w/ immediates
Andrew Morton
andrewm@uow.edu.au
Mon Jul 31 05:08:00 GMT 2000
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.
More information about the Binutils
mailing list