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]

Re: --enable-checking for gas


This fixes a few of the gas assertion failures.  The only real problem
here, I think, was tc-i386.c:md_operand assuming that
parse_real_register returned a pointer to an element of i386_regtab.
You could get i386_float_regtab as well.  Fixed by moving
i386_float_regtab into i386_regtab.

Jan, please check that removing the assert in symbol_clone is
correct.  It triggers on gas/testsuite/gas/all/redef2.s, where
 .set sym, xtrn
 .long sym
 .set sym, 0x22222222
first sets sym to an undefined external, then to a constant.

gas/
	* expr.c (expr): Assert on rankarg, not rank which can be unsigned.
	* read.c (read_a_source_file): Remove buffer_limit[-1] assertion.
	Don't skip over NUL char.
	(pseudo_set): Set X_op for registers to O_register.
	* symbols.c (symbol_clone): Remove assertion that sym is defined.
	(resolve_symbol_value): Resolve O_register symbols.
	* config/tc-i386.c (parse_real_register): Don't use i386_float_regtab.
	Instead find st(0) by hash lookup.
	* config/tc-ppc.c (ppc_macro): Warning fix.
opcodes/
	* i386-opc.c (i386_float_regtab, i386_float_regtab_size): Delete.
	Move contents to..
	(i386_regtab): ..here.
	* i386-opc.h (i386_float_regtab, i386_float_regtab_size): Delete.

Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.68
diff -u -p -r1.68 expr.c
--- gas/expr.c	24 Oct 2006 18:10:57 -0000	1.68
+++ gas/expr.c	21 Apr 2007 06:20:38 -0000
@@ -1636,7 +1636,7 @@ expr (int rankarg,		/* Larger # is highe
   operatorT op_right;
   int op_chars;
 
-  know (rank >= 0);
+  know (rankarg >= 0);
 
   /* Save the value of dot for the fixup code.  */
   if (rank == 0)
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.124
diff -u -p -r1.124 read.c
--- gas/read.c	26 Mar 2007 12:23:48 -0000	1.124
+++ gas/read.c	21 Apr 2007 06:20:41 -0000
@@ -607,8 +607,6 @@ read_a_source_file (char *name)
 
       last_eol = NULL;
 #endif
-      know (buffer_limit[-1] == '\n');	/* Must have a sentinel.  */
-
       while (input_line_pointer < buffer_limit)
 	{
 	  /* We have more of this buffer to parse.  */
@@ -705,8 +703,7 @@ read_a_source_file (char *name)
 	     If you must pass stuff, please pass a tree!)  */
 	  if ((c = *input_line_pointer++) == '\t'
 	      || c == ' '
-	      || c == '\f'
-	      || c == 0)
+	      || c == '\f')
 	    c = *input_line_pointer++;
 
 	  know (c != ' ');	/* No further leading whitespace.  */
@@ -3491,6 +3488,7 @@ pseudo_set (symbolS *symbolP)
       S_SET_SEGMENT (symbolP, reg_section);
       S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
       set_zero_frag (symbolP);
+      symbol_get_value_expression (symbolP)->X_op = O_register;
       break;
 
     case O_symbol:
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.83
diff -u -p -r1.83 symbols.c
--- gas/symbols.c	15 Mar 2007 12:11:49 -0000	1.83
+++ gas/symbols.c	21 Apr 2007 06:20:42 -0000
@@ -563,8 +563,6 @@ symbol_clone (symbolS *orgsymP, int repl
     orgsymP = local_symbol_convert ((struct local_symbol *) orgsymP);
   bsymorg = orgsymP->bsym;
 
-  know (S_IS_DEFINED (orgsymP));
-
   newsymP = obstack_alloc (&notes, sizeof (*newsymP));
   *newsymP = *orgsymP;
   bsymnew = bfd_make_empty_symbol (bfd_asymbol_bfd (bsymorg));
@@ -1123,6 +1121,9 @@ resolve_symbol_value (symbolS *symp)
 	  final_val += symp->sy_frag->fr_address / OCTETS_PER_BYTE;
 	  if (final_seg == expr_section)
 	    final_seg = absolute_section;
+	  /* Fall through.  */
+
+	case O_register:
 	  resolved = 1;
 	  break;
 
@@ -1400,7 +1401,6 @@ resolve_symbol_value (symbolS *symp)
 		      && symbol_resolved_p (op_symbol));
 	  break;
 
-	case O_register:
 	case O_big:
 	case O_illegal:
 	  /* Give an error (below) if not in expr_section.  We don't
Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.260
diff -u -p -r1.260 tc-i386.c
--- gas/config/tc-i386.c	18 Apr 2007 16:15:55 -0000	1.260
+++ gas/config/tc-i386.c	21 Apr 2007 06:20:47 -0000
@@ -5804,14 +5804,16 @@ parse_real_register (char *reg_string, c
 	    ++s;
 	  if (*s >= '0' && *s <= '7')
 	    {
-	      r = &i386_float_regtab[*s - '0'];
+	      int fpr = *s - '0';
 	      ++s;
 	      if (is_space_char (*s))
 		++s;
 	      if (*s == ')')
 		{
 		  *end_op = s + 1;
-		  return r;
+		  r = hash_find (reg_hash, "st(0)");
+		  know (r);
+		  return r + fpr;
 		}
 	    }
 	  /* We have "%st(" then garbage.  */
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.118
diff -u -p -r1.118 tc-ppc.c
--- gas/config/tc-ppc.c	21 Apr 2007 05:15:41 -0000	1.118
+++ gas/config/tc-ppc.c	21 Apr 2007 06:20:50 -0000
@@ -2816,7 +2816,7 @@ ppc_macro (str, macro)
   char *s;
   unsigned int len;
   const char *format;
-  int arg;
+  unsigned int arg;
   char *send;
   char *complete;
 
@@ -2854,7 +2854,7 @@ ppc_macro (str, macro)
       else
 	{
 	  arg = strtol (format + 1, &send, 10);
-	  know (send != format && arg >= 0 && arg < count);
+	  know (send != format && arg < count);
 	  len += strlen (operands[arg]);
 	  format = send;
 	}
Index: opcodes/i386-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/i386-opc.c,v
retrieving revision 1.8
diff -u -p -r1.8 i386-opc.c
--- opcodes/i386-opc.c	18 Apr 2007 16:15:55 -0000	1.8
+++ opcodes/i386-opc.c	21 Apr 2007 06:21:15 -0000
@@ -1712,12 +1712,7 @@ const reg_entry i386_regtab[] =
   /* No type will make this register rejected for all purposes except
      for addressing.  This saves creating one extra type for RIP.  */
   {"rip", BaseIndex, 0, 0},
-};
-
-const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);
-
-const reg_entry i386_float_regtab[] =
-{
+  /* fp regs.  */
   {"st(0)", FloatReg|FloatAcc, 0, 0},
   {"st(1)", FloatReg, 0, 1},
   {"st(2)", FloatReg, 0, 2},
@@ -1728,7 +1723,7 @@ const reg_entry i386_float_regtab[] =
   {"st(7)", FloatReg, 0, 7}
 };
 
-const unsigned int i386_float_regtab_size = ARRAY_SIZE (i386_float_regtab);
+const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);
 
 /* Segment stuff.  */
 const seg_entry cs = { "cs", 0x2e };
Index: opcodes/i386-opc.h
===================================================================
RCS file: /cvs/src/src/opcodes/i386-opc.h,v
retrieving revision 1.6
diff -u -p -r1.6 i386-opc.h
--- opcodes/i386-opc.h	18 Apr 2007 16:15:55 -0000	1.6
+++ opcodes/i386-opc.h	21 Apr 2007 06:21:15 -0000
@@ -223,8 +223,6 @@ reg_entry;
 
 extern const reg_entry i386_regtab[];
 extern const unsigned int i386_regtab_size;
-extern const reg_entry i386_float_regtab[];
-extern const unsigned int i386_float_regtab_size;
 
 typedef struct
 {

-- 
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]