[Top][All Lists]

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

[Bug gas/997] invalid error messages, and internal error abort

From: amodra at bigpond dot net dot au
Subject: [Bug gas/997] invalid error messages, and internal error abort
Date: 9 Jun 2005 06:29:43 -0000

------- Additional Comments From amodra at bigpond dot net dot au  2005-06-09 
06:29 -------
This is a consequence of the way gas resolves symbols.  The problem is that the
first assignment to msglen isn't resolved immediately when parts of the
expression use symbols ("." and "msg" here) in different frags.  A frag is a
chunk of code/data being assembled, with a fixed part and a variable part. 
Because gas knows that frags might have a variable part, it leaves such
expressions for later evaluation, after all frags have their variable parts
fixed.  Thus the second assignment to msglen also can't be evaluated
immediately, and gas simply sets the value of msglen to "msglen & 0xff", exactly
as would be done if the first assignment had never been encountered.  Which
results in a symbol definition loop.

The reason that -a causes the failure is that turning on listings employs a hack
where a frag is allocated for each line.  However, this can happen without -a if
 a new frag is needed for some other reason.

I see a number of possible solutions, all of which I'm disinclined to implement
1) Rewrite gas listing code to do without frags, possibly combined with
2) Modify gas symbol evaluation code to allow immediate subtraction of symbols
in different frags if all intervening frags are fixed in size.
3) Have gas generate multiple versions of symbols.

(3) is probably the easiest to implement.  You can do it yourself at the user
level, of course:

msg: .asciz  "hello world.\n"
x = .-msg-1
msglen=x & 0xff



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

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