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]
Other format: [Raw text]

fix Xtensa assembler relaxtion problem


I've committed the following patch on both the mainline and 2.16 branch. It fixes a problem with a "movi" of a large, non-symbolic immediate value in the last slot of an Xtensa FLIX instruction. The "movi" operation is relaxed and temporarily changed to refer to an internal "SPECIAL_LITERAL" symbol, which is supposed to be fixed up later by the xg_resolve_literals() function. However, the code to call xg_resolve_literals() was skipping the last slot of multi-slot instructions. The patch corrects that (and also fixes an obviously spelling typo in a comment).

I ran the testsuites with an xtensa-elf target to test that this patch doesn't break anything. The default Xtensa processor configuration does not currently include any FLIX instructions, so I can't include a testcase for this problem, but I have verified separately that the patch does indeed correct the problem.

2005-03-10 Bob Wilson <bob.wilson@acm.org>

        * config/tc-xtensa.c (finish_vinsn): Include the last instruction slot
        when checking if xg_resolve_literals needs to be called.
        * config/tc-xtensa.h: Fix spelling typo in a comment.

Index: tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.22
diff -u -p -r1.22 tc-xtensa.c
--- tc-xtensa.c	3 Mar 2005 11:47:57 -0000	1.22
+++ tc-xtensa.c	10 Mar 2005 23:06:11 -0000
@@ -6145,7 +6145,7 @@ finish_vinsn (vliw_insn *vinsn)
 	      return;
 	    }
 
-	  for (j = 0; j < slotstack.ninsn - 1; j++)
+	  for (j = 0; j < slotstack.ninsn; j++)
 	    {
 	      TInsn *insn = &slotstack.insn[j];
 	      if (insn->insn_type == ITYPE_LITERAL)
@@ -6155,9 +6155,11 @@ finish_vinsn (vliw_insn *vinsn)
 		}
 	      else
 		{
+		  assert (insn->insn_type == ITYPE_INSN);
 		  if (lit_sym)
 		    xg_resolve_literals (insn, lit_sym);
-		  emit_single_op (insn);
+		  if (j != slotstack.ninsn - 1)
+		    emit_single_op (insn);
 		}
 	    }
 
Index: tc-xtensa.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.h,v
retrieving revision 1.7
diff -u -p -r1.7 tc-xtensa.h
--- tc-xtensa.h	4 Nov 2004 21:52:54 -0000	1.7
+++ tc-xtensa.h	10 Mar 2005 23:06:11 -0000
@@ -201,7 +201,7 @@ struct xtensa_frag_type
      first time through a relaxation....  */
   unsigned int relax_seen : 1;
 
-  /* Infomation that is needed in the object file and set when known.  */
+  /* Information that is needed in the object file and set when known.  */
   unsigned int is_literal : 1;
   unsigned int is_loop_target : 1;
   unsigned int is_branch_target : 1;

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