This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: forward references in equates
On Mon, Sep 19, 2005 at 09:35:51AM +0200, Jan Beulich wrote:
> >>> Alan Modra <amodra@bigpond.net.au> 17.09.05 16:14:46 >>>
> >On Fri, Sep 16, 2005 at 01:58:19PM +0200, Jan Beulich wrote:
> >>
> >> .equiv two, 2*one
> >> .equ one, 1
> >> .equiv three, 3*one
> >>
> >> .data
> >>
> >> .byte one
> >> .byte two
> >> .byte three
> >
> >I'd be reasonably confortable if gas gave 1, 2, 3 for the above,
>
> That'd be my expectation, too.
>
> >> .equ one, -1
> >> .byte one
> >> .byte two
> >> .byte three
> >
> >but what should these be? I'd be inclined to say -1, 2, 3. Are you
> >proposing that the last three values be -1, -2, -3? That would be
> >changing the meaning of .equiv, I think.
>
> I'm not as determined about the third value, but the second value
> should certainly be -2 (as the definition of two is clearly using a
> forward reference).
I don't agree that it follows from the definition of "two" being a
forward reference to "one" that the evaluation of "two" *must* always be
"2*one". .set and its variations define symbols, not functions or
macros, so there are other quite reasonable possibilities. I'm not
saying that expecting -2 is unreasonable, in fact that might be the most
useful result. What do other assemblers give for your testcase?
--
Alan Modra
IBM OzLabs - Linux Technology Centre