[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in gas, with expressions in macros
From: |
Nick Clifton |
Subject: |
Re: Bug in gas, with expressions in macros |
Date: |
29 Nov 2001 10:21:02 +0000 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 |
Hi Peter,
> I have a very strange bug in binutils/gas, using gas 2.10.91 or
> 2.11.2 or the current CVS, when using the .if directive inside
> macros and listings.
>
> assembling the following code:
> .macro VEC name
> .if ( . - .__start_of_init__ )
> .string "Hello"
> .endif
> .endm
>
> .__start_of_init__:
>
> VEC _vector_1
> with
>
> address@hidden gas-test]$ as -o gcrt1.o gcrt1.s --verbose -an
> GNU assembler version 2.10.91 (i386-redhat-linux) using BFD version
> 2.10.91.0.2
> gcrt1.s: Assembler messages:
> gcrt1.s:10: Error: non-constant expression in ".if" statement
>
> I get an error of a non-contant expression.
>
> but if I turn listings off (without the -an) then it assembles ok, ie
I suspect that this is due to the listing option causing the code to
be broken up into individual lines, each in their own frag. Since the
.if statement is now in a different frag from the .__start_of_init__
label the expression parser cannot resolve the contents of the .if to
a constant number. (Frags can change their size, so the distance
between the frag containing __start_of_init__ and the frag containing
'.' cannot be computed). Hence the error message.
I am not sure what to suggest as a workaround though. You could
always just not use the listing options... :-)
Cheers
Nick