public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* fix Xtensa GAS problem with multi-slot instructions
@ 2004-11-05 17:26 Bob Wilson
  0 siblings, 0 replies; only message in thread
From: Bob Wilson @ 2004-11-05 17:26 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

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.


[-- Attachment #2: gas-frag-exp.diff --]
[-- Type: text/plain, Size: 1533 bytes --]

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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-05 17:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-05 17:26 fix Xtensa GAS problem with multi-slot instructions Bob Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).