bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple setting of a symbol


From: Nick Clifton
Subject: Re: Multiple setting of a symbol
Date: Thu, 07 Sep 2006 17:10:23 +0100
User-agent: Thunderbird 1.5.0.4 (X11/20060516)

Hi Konrad,

Specifically, given the code

my_variable:
        .long X
        X = 1
        X = 2

the new version assembles the value 1 into my_variable, while the old
version assembles the value 2.

The problem with this is what should happen in more complex situations. For example:

     .long X
     X = 1
     X = 2
     .long X
     X = 3

Now, should that first .long receive the value 2, as you suggested in your example, or 3, as that is the last value assigned to X ? Also what value should be given to the second .long ? 2, which was the value of X at the point in the code when it was defined, or 3 ?

Lets assume that you think that both .long's should have the value 3, which is the final value assigned to X. The you have to consider whether the assignments should be section specific, eg:

  .text
  .long X
  X = 1
  .data
  X = 2
  .long X
  .section "foo"
  X = 3

Does this make any difference to the values stored in the .long's ?

What if the symbol is used inside a loop, eg:

  .macro sum from, to
  X = \from
  .long X
  .if \to-\from
     sum "(\from+1)",\to
  .endif
  .endm

   sum 0,5

Should this produce a set if six .long's all with the value 5 ? (Currently it will produce the values 0 through 5 in order, which is what more people would expect I think).

Cheers
  Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]