* Incorrect code generated with m68k-elf-as
@ 2001-05-26 19:46 pjak
2001-05-27 4:55 ` amodra
0 siblings, 1 reply; 2+ messages in thread
From: pjak @ 2001-05-26 19:46 UTC (permalink / raw)
To: binutils; +Cc: pjak
I have a problem when assembling m68k-elf code.
The code that causes the problem is pretty long
(about 20k), it can be found here:
http://www.laseranimation.com/peter/error6.s
When assembling this with "m68k-elf-as -a error6.s"
everything seems to be ok.
But without listing the generated code is incorrect.
A diff of a dump of the a.out files:
@@ -162,8 +162,8 @@
20c: 33c0 0000 0000 movew %d0,0 <_a5625850_>
212: 70ff moveq #-1,%d0
214: 33c0 0000 0000 movew %d0,0 <_a5625850_>
- 21a: 600c bras 228 <_a5626516_+0x5e>
- 21c: 4879 0000 0000 pea 0 <_a5625850_>
+ 21a: 6000 4879 braw 4a95 <_a5626102_+0x3e99>
+ 21e: 0000 0000 orib #0,%d0
222: 4eb9 0000 0000 jsr 0 <_a5625850_>
228: 4e5e unlk %fp
22a: 4e75 rts
@@ -312,8 +312,7 @@
416: 4a79 0000 0000 tstw 0 <_a5625850_>
41c: 673c beqs 45a <_a5627150_+0x4c>
41e: 4a80 tstl %d0
- 420: 660a bnes 42c <_a5627150_+0x1e>
- 422: 4200 clrb %d0
+ 420: 6600 4200 bnew 4622 <_a5626102_+0x3a26>
424: 13c0 0000 0000 moveb %d0,0 <_a5625850_>
42a: 6018 bras 444 <_a5627150_+0x36>
42c: 2f00 movel %d0,%sp@-
The branches at 21a and 420 are messed (incorrect
offset 0).
Peter Jakubek
pjak@snafu.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Incorrect code generated with m68k-elf-as
2001-05-26 19:46 Incorrect code generated with m68k-elf-as pjak
@ 2001-05-27 4:55 ` amodra
0 siblings, 0 replies; 2+ messages in thread
From: amodra @ 2001-05-27 4:55 UTC (permalink / raw)
To: pjak; +Cc: binutils
On Sun, May 27, 2001 at 04:46:24AM +0100, pjak@snafu.de wrote:
>
> The branches at 21a and 420 are messed (incorrect
> offset 0).
Wow, this bug predates gas-1.38.1 Fixed like this
gas/ChangeLog
* config/tc-m68k.c (md_assemble): Ensure variable part of frag is
allocated in the same chunk as the fixed part.
--
Alan Modra
Index: gas/config/tc-m68k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.c,v
retrieving revision 1.22
diff -u -p -r1.22 tc-m68k.c
--- tc-m68k.c 2001/05/22 09:01:55 1.22
+++ tc-m68k.c 2001/05/27 11:38:36
@@ -3664,6 +3664,21 @@ md_assemble (str)
}
/* There's some frag hacking */
+ {
+ /* Calculate the max frag size. */
+ int wid;
+
+ wid = 2 * the_ins.fragb[0].fragoff;
+ for (n = 1; n < the_ins.nfrag; n++)
+ wid += 2 * (the_ins.numo - the_ins.fragb[n - 1].fragoff);
+ /* frag_var part. */
+ wid += 10;
+ /* Make sure the whole insn fits in one chunk, in particular that
+ the var part is attached, as we access one byte before the
+ variable frag for byte branches. */
+ frag_grow (wid);
+ }
+
for (n = 0, fromP = &the_ins.opcode[0]; n < the_ins.nfrag; n++)
{
int wid;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-05-27 4:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-26 19:46 Incorrect code generated with m68k-elf-as pjak
2001-05-27 4:55 ` amodra
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).