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 GAS problem with multi-slot instructions


This patch fixes a problem in the Xtensa port of GAS that only shows up with multi-slot instructions. For relaxation, the code had been looking at expansion associated only with the first slot of each instruction, but other slots may also cause expansion.

Tested with an xtensa-elf target. Committed on the mainline.


2004-11-05 Sterling Augustine <sterling@tensilica.com>


        * config/tc-xtensa.c (total_frag_text_expansion): New.
        (md_estimate_size_before_relax): Use it.
        (find_address_of_next_align_frag): Likewise.

Index: config/tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.14
diff -u -p -r1.14 tc-xtensa.c
--- config/tc-xtensa.c	4 Nov 2004 21:52:54 -0000	1.14
+++ config/tc-xtensa.c	5 Nov 2004 01:14:20 -0000
@@ -442,6 +442,7 @@ static void set_literal_pool_location (s
 static void xtensa_set_frag_assembly_state (fragS *);
 static void finish_vinsn (vliw_insn *);
 static bfd_boolean emit_single_op (TInsn *);
+static int total_frag_text_expansion (fragS *);
 
 /* Alignment Functions.  */
 
@@ -5706,7 +5707,7 @@ md_atof (int type, char *litP, int *size
 int
 md_estimate_size_before_relax (fragS *fragP, segT seg ATTRIBUTE_UNUSED)
 {
-  return fragP->tc_frag_data.text_expansion[0];
+  return total_frag_text_expansion (fragP);
 }
 
 
@@ -6762,6 +6763,19 @@ emit_single_op (TInsn *orig_insn)
 }
 
 
+static int
+total_frag_text_expansion (fragS *fragP)
+{
+  int slot;
+  int total_expansion = 0;
+
+  for (slot = 0; slot < MAX_SLOTS; slot++)
+    total_expansion += fragP->tc_frag_data.text_expansion[slot];
+
+  return total_expansion;
+}
+
+
 /* Emit a vliw instruction to the current fragment.  */
 
 static void
@@ -8641,8 +8655,7 @@ find_address_of_next_align_frag (fragS *
 		  (*widens)++;
 		  break;
 		}
-	      /* FIXME: shouldn't this add the expansion of all slots?  */
-	      address += fragP->tc_frag_data.text_expansion[0];
+	      address += total_frag_text_expansion (fragP);;
 	      break;
 
 	    case RELAX_IMMED:

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