This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Incorrect code generated with m68k-elf-as


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]