This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

m68hc11 fixup sizes


This patch fixes another "fixup not contained within frag" error
with BFD_RELOC_M68HC11_RL_JUMP fixups, found sometimes when compiling
libgcc.  It's a little hard to trigger;  I had trouble duplicating the
bug report I'd received.  To hit the bug gas needs to require a new
frag immediately after the frag with the fixup, which puts the fixup
right at the end of its frag.  Since it has a size of 1, the generic
gas code thinks it extends past the end of the frag and so emits an
error.  However, this particular reloc type never modifes the frag
contents, and it can mark its jump instruction for the linker just as
effectively at the end of the frag as at the beginning of the next
frag.  So the fix I chose was to set its size to zero.  An alternative
would be to call frag_grow with the size of the jump insn before
emitting the fixup.

I believe the same problem exists with BFD_RELOC_M68HC11_RL_GROUP,
so I set those fixups to zero size too.  The BFD_RELOC_M68HC11_24
change is simply a typo fix.

	* config/tc-m68hc11.c (fixup24): Correct fixup size.
	(build_jump_insn): Likewise.
	(build_insn): Likewise.
	(s_m68hc11_relax): Likewise.

Index: gas/config/tc-m68hc11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68hc11.c,v
retrieving revision 1.50
diff -u -p -r1.50 tc-m68hc11.c
--- gas/config/tc-m68hc11.c	23 Oct 2006 03:23:49 -0000	1.50
+++ gas/config/tc-m68hc11.c	27 Feb 2007 07:42:32 -0000
@@ -1,5 +1,5 @@
 /* tc-m68hc11.c -- Assembler code for the Motorola 68HC11 & 68HC12.
-   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    Written by Stephane Carrez (stcarrez@nerim.fr)
 
@@ -1518,7 +1518,7 @@ fixup24 (expressionS *oper, int mode, in
       fixS *fixp;
 
       /* Now create a 24-bit fixup.  */
-      fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 2,
+      fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 3,
 			  oper, FALSE, BFD_RELOC_M68HC11_24);
       number_to_chars_bigendian (f, 0, 3);
     }
@@ -1594,7 +1594,7 @@ build_jump_insn (struct m68hc11_opcode *
       frag = frag_now;
       where = frag_now_fix ();
 
-      fix_new (frag_now, frag_now_fix (), 1,
+      fix_new (frag_now, frag_now_fix (), 0,
                &abs_symbol, 0, 1, BFD_RELOC_M68HC11_RL_JUMP);
 
       if (code == M6811_BSR || code == M6811_BRA || code == M6812_BSR)
@@ -1654,7 +1654,7 @@ build_jump_insn (struct m68hc11_opcode *
       frag = frag_now;
       where = frag_now_fix ();
 
-      fix_new (frag_now, frag_now_fix (), 1,
+      fix_new (frag_now, frag_now_fix (), 0,
                &abs_symbol, 0, 1, BFD_RELOC_M68HC11_RL_JUMP);
 
       f = m68hc11_new_insn (2);
@@ -1669,7 +1669,7 @@ build_jump_insn (struct m68hc11_opcode *
       frag = frag_now;
       where = frag_now_fix ();
       
-      fix_new (frag_now, frag_now_fix (), 1,
+      fix_new (frag_now, frag_now_fix (), 0,
                &abs_symbol, 0, 1, BFD_RELOC_M68HC11_RL_JUMP);
 
       /* Branch offset must fit in 8-bits, don't do some relax.  */
@@ -2102,7 +2102,7 @@ build_insn (struct m68hc11_opcode *opcod
   format = opcode->format;
 
   if (format & M6811_OP_BRANCH)
-    fix_new (frag_now, frag_now_fix (), 1,
+    fix_new (frag_now, frag_now_fix (), 0,
              &abs_symbol, 0, 1, BFD_RELOC_M68HC11_RL_JUMP);
 
   if (format & OP_EXTENDED)
@@ -2704,7 +2704,7 @@ s_m68hc11_relax (int ignore ATTRIBUTE_UN
       return;
     }
 
-  fix_new_exp (frag_now, frag_now_fix (), 2, &ex, 1,
+  fix_new_exp (frag_now, frag_now_fix (), 0, &ex, 1,
                BFD_RELOC_M68HC11_RL_GROUP);
 
   demand_empty_rest_of_line ();

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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