From: alan@spri.levels.unisa.edu.au (Alan Modra)
To: gas2@cygnus.com
Subject: Re: gas fixup problem?
Date: Sat, 24 Jun 1995 03:51:00 -0000 [thread overview]
Message-ID: <m0sPSnu-0000y0C@mullet> (raw)
In-Reply-To: <no.id>
>
> /usr/i486-linux/bin/as zzz.s; nm a.out
> 00000000 t L0
> 00000006 t L1
> 00000002 t L2 !!!!!!!!!
> 00000006 t L3
> 00000015 t L4
> 00000094 t L5
>
> --------------------zzz.s----------------
> .text
> L0:
> jz L5
> L1:
> L2:
> L3:
> .space -(L2 - L0 + 0x7f) & (16-1), 0x90
>
> L4:
> .space 0x7f, 0x90
> L5:
> -----------------------------------------
>
> The idea of the .space here is to align L5, given we know how much
> code is between the .space and L5. Maybe this bug is just related to
> .space, but if it's something to do with expression evaluation, then
> it is a more serious one. I'll see if I can fix it myself, but my
> time is rather limited at the moment. Maybe someone else will get
> curious as to what is wrong here?
>
A bit more info. The problem seems to be caused inside S_GET_VALUE()
in write.c around line 1937. S_GET_VALUE tries to evaluate the
expression, and in so doing resolves L2 to be equal to 2, correct for
the first time round when the "jz" is assumed to be a short
instruction. When gas decide that the "jz" needs to be a long branch
occupying 6 bytes, the value of L2 is marked as resolved so isn't
adjusted.
I'm not sure I have the time to figure out how all the gas internals
work, so a fix from me will take a while...
.org also exhibits the same sort of behaviour with
-------------------------------
.text
Z0:
jz Z9
Z1:
Z2:
.org (15 & -(Z2 - Z0)) + .
Z5:
.space 0x7f, 0x90
Z9:
-------------------------------
similarly giving wrong values for Z2
The slightly more contrived
-------------------------------
.text
Z0:
jz Z9
Z1:
Z2:
.org (Z2 - Z0 + 1) + .
Z5:
.space 0x7f, 0x90
Z9:
-------------------------------
bombs with
z1.s: Assembler messages:
z1.s:9: Error: attempt to .org/.space backwards? (-3)
z1.s:9: Internal error!
Assertion failure in write_contents at write.c line 924.
Please report this bug.
next parent reply other threads:[~1995-06-24 3:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <no.id>
1995-06-24 3:51 ` Alan Modra [this message]
1995-06-21 16:57 Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m0sPSnu-0000y0C@mullet \
--to=alan@spri.levels.unisa.edu.au \
--cc=gas2@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).