This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Incorrect code generated with m68k-elf-as
- To: pjak at snafu dot de
- Subject: Re: Incorrect code generated with m68k-elf-as
- From: amodra at one dot net dot au
- Date: Sun, 27 May 2001 21:32:27 +0930
- Cc: binutils at sourceware dot cygnus dot com
- References: <E153qZU-0000Wo-00@smart.visp-europe.psi.com>
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;