public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* --enable-checking for gas
@ 2007-04-21  6:50 Alan Modra
  2007-04-21  7:32 ` Alan Modra
  2007-04-21 12:50 ` Fallout for VAX (was: --enable-checking for gas) Jan-Benedict Glaw
  0 siblings, 2 replies; 6+ messages in thread
From: Alan Modra @ 2007-04-21  6:50 UTC (permalink / raw)
  To: binutils

Further cleanup of ppc-opc.c, and add --enable-checking configure
option to gas.  --enable-checking, on by default except for a release,
turns on all the gas "know" assertions.  We trigger quite a few...

gas/
	* as.h (ENABLE_CHECKING): Default define to 0.
	(know): Assert if ENABLE_CHECKING.
	(struct relax_type): Remove superfluous declaration.
	* configure.in (--enable-checking): New.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/tc-ppc.c (ppc_setup_opcodes): Do checks when ENABLE_CHECKING.
	Check for duplicate powerpc_operands entries.
opcodes/
	* ppc-opc.c (powerpc_operands): Delete duplicate entries.
	(BA_MASK, FXM_MASK, STRM_MASK, VA_MASK, VB_MASK, VC_MASK): Delete.
	(VD_MASK, WS_MASK, MTMSRD_L, XRT_L): Delete.
	(powerpc_opcodes): Replace uses of MTMSRD_L and XRT_L.

Index: gas/as.h
===================================================================
RCS file: /cvs/src/src/gas/as.h,v
retrieving revision 1.55
diff -u -p -r1.55 as.h
--- gas/as.h	9 Mar 2007 07:14:23 -0000	1.55
+++ gas/as.h	21 Apr 2007 04:56:36 -0000
@@ -258,7 +258,11 @@ typedef addressT valueT;
 #endif
 /* COMMON now defined */
 
-#ifdef DEBUG
+#ifndef ENABLE_CHECKING
+#define ENABLE_CHECKING 0
+#endif
+
+#if ENABLE_CHECKING || defined (DEBUG)
 #ifndef know
 #define know(p) assert(p)	/* Verify our assumptions!  */
 #endif /* not yet defined */
@@ -566,7 +570,6 @@ segT   subseg_get (const char *, int);
 struct expressionS;
 struct fix;
 typedef struct symbol symbolS;
-struct relax_type;
 typedef struct frag fragS;
 
 /* literal.c */
Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.200
diff -u -p -r1.200 configure.in
--- gas/configure.in	15 Mar 2007 14:31:24 -0000	1.200
+++ gas/configure.in	21 Apr 2007 04:56:42 -0000
@@ -30,6 +30,7 @@ AC_ARG_ENABLE(targets,
   no)	    enable_targets= ;;
   *)	    enable_targets=$enableval ;;
 esac])dnl
+
 AC_ARG_ENABLE(commonbfdlib,
 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
 [case "${enableval}" in
@@ -38,6 +39,20 @@ AC_ARG_ENABLE(commonbfdlib,
   *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
 esac])dnl
 
+ac_checking=yes
+if grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then
+  ac_checking=
+fi
+AC_ARG_ENABLE(checking,
+[  --enable-checking       enable run-time checks],
+[case "${enableval}" in
+  no|none)  ac_checking= ;;
+  *)	    ac_checking=yes ;;
+esac])dnl
+if test x$ac_checking != x ; then
+  AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
+fi
+
 using_cgen=no
 
 AM_BINUTILS_WARNINGS
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.117
diff -u -p -r1.117 tc-ppc.c
--- gas/config/tc-ppc.c	20 Apr 2007 13:42:03 -0000	1.117
+++ gas/config/tc-ppc.c	21 Apr 2007 04:56:49 -0000
@@ -1248,7 +1248,6 @@ ppc_setup_opcodes (void)
   const struct powerpc_opcode *op_end;
   const struct powerpc_macro *macro;
   const struct powerpc_macro *macro_end;
-  unsigned int i;
   bfd_boolean bad_insn = FALSE;
 
   if (ppc_hash != NULL)
@@ -1259,60 +1258,77 @@ ppc_setup_opcodes (void)
   /* Insert the opcodes into a hash table.  */
   ppc_hash = hash_new ();
 
-  /* Check operand masks.  Code here and in the disassembler assumes
-     all the 1's in the mask are contiguous.  */
-  for (i = 0; i < num_powerpc_operands; ++i)
-    {
-      unsigned long mask = powerpc_operands[i].bitm;
-      unsigned long right_bit;
-
-      right_bit = mask & -mask;
-      mask += right_bit;
-      right_bit = mask & -mask;
-      if (mask != right_bit)
-	{
-	  as_bad (_("powerpc_operands[%d].bitm invalid"), i);
-	  bad_insn = TRUE;
+  if (ENABLE_CHECKING)
+    {
+      unsigned int i;
+
+      /* Check operand masks.  Code here and in the disassembler assumes
+	 all the 1's in the mask are contiguous.  */
+      for (i = 0; i < num_powerpc_operands; ++i)
+	{
+	  unsigned long mask = powerpc_operands[i].bitm;
+	  unsigned long right_bit;
+	  unsigned int j;
+
+	  right_bit = mask & -mask;
+	  mask += right_bit;
+	  right_bit = mask & -mask;
+	  if (mask != right_bit)
+	    {
+	      as_bad (_("powerpc_operands[%d].bitm invalid"), i);
+	      bad_insn = TRUE;
+	    }
+	  for (j = i + 1; j < num_powerpc_operands; ++j)
+	    if (memcmp (&powerpc_operands[i], &powerpc_operands[j],
+			sizeof (powerpc_operands[0])) == 0)
+	      {
+		as_bad (_("powerpc_operands[%d] duplicates powerpc_operands[%d]"),
+			j, i);
+		bad_insn = TRUE;
+	      }
 	}
     }
 
   op_end = powerpc_opcodes + powerpc_num_opcodes;
   for (op = powerpc_opcodes; op < op_end; op++)
     {
-      const unsigned char *o;
-      unsigned long omask = op->mask;
-
-      /* The mask had better not trim off opcode bits.  */
-      if ((op->opcode & omask) != op->opcode)
+      if (ENABLE_CHECKING)
 	{
-	  as_bad (_("mask trims opcode bits for %s"),
-		  op->name);
-	  bad_insn = TRUE;
-	}
+	  const unsigned char *o;
+	  unsigned long omask = op->mask;
 
-      /* The operands must not overlap the opcode or each other.  */
-      for (o = op->operands; *o; ++o)
-	if (*o >= num_powerpc_operands)
-	  {
-	    as_bad (_("operand index error for %s"),
-		    op->name);
-	    bad_insn = TRUE;
-	  }
-	else
-	  {
-	    const struct powerpc_operand *operand = &powerpc_operands[*o];
-	    if (operand->shift >= 0)
+	  /* The mask had better not trim off opcode bits.  */
+	  if ((op->opcode & omask) != op->opcode)
+	    {
+	      as_bad (_("mask trims opcode bits for %s"),
+		      op->name);
+	      bad_insn = TRUE;
+	    }
+
+	  /* The operands must not overlap the opcode or each other.  */
+	  for (o = op->operands; *o; ++o)
+	    if (*o >= num_powerpc_operands)
+	      {
+		as_bad (_("operand index error for %s"),
+			op->name);
+		bad_insn = TRUE;
+	      }
+	    else
 	      {
-		unsigned long mask = operand->bitm << operand->shift;
-		if (omask & mask)
+		const struct powerpc_operand *operand = &powerpc_operands[*o];
+		if (operand->shift >= 0)
 		  {
-		    as_bad (_("operand %d overlap in %s"),
-			    (int) (o - op->operands), op->name);
-		    bad_insn = TRUE;
+		    unsigned long mask = operand->bitm << operand->shift;
+		    if (omask & mask)
+		      {
+			as_bad (_("operand %d overlap in %s"),
+				(int) (o - op->operands), op->name);
+			bad_insn = TRUE;
+		      }
+		    omask |= mask;
 		  }
-		omask |= mask;
 	      }
-	  }
+	}
 
       if ((op->flags & ppc_cpu & ~(PPC_OPCODE_32 | PPC_OPCODE_64)) != 0
 	  && ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0
Index: opcodes/ppc-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
retrieving revision 1.93
diff -u -p -r1.93 ppc-opc.c
--- opcodes/ppc-opc.c	20 Apr 2007 12:25:13 -0000	1.93
+++ opcodes/ppc-opc.c	21 Apr 2007 04:57:14 -0000
@@ -76,7 +76,7 @@ static long extract_tbr (unsigned long, 
 \f
 /* The operands table.
 
-   The fields are bits, shift, insert, extract, flags.
+   The fields are bitm, shift, insert, extract, flags.
 
    We used to put parens around the various additions, like the one
    for BA just below.  However, that caused trouble with feeble
@@ -94,7 +94,9 @@ const struct powerpc_operand powerpc_ope
 
   /* The BA field in an XL form instruction.  */
 #define BA UNUSED + 1
-#define BA_MASK (0x1f << 16)
+  /* The BI field in a B form or XL form instruction.  */
+#define BI BA
+#define BI_MASK (0x1f << 16)
   { 0x1f, 16, NULL, NULL, PPC_OPERAND_CR },
 
   /* The BA field in an XL form instruction when it must be the same
@@ -148,6 +150,8 @@ const struct powerpc_operand powerpc_ope
 
   /* The BF field in an X or XL form instruction.  */
 #define BF BDPA + 1
+  /* The CRFD field in an X form instruction.  */
+#define CRFD BF
   { 0x7, 23, NULL, NULL, PPC_OPERAND_CR },
 
   /* An optional BF field.  This is used for comparison instructions,
@@ -159,14 +163,9 @@ const struct powerpc_operand powerpc_ope
 #define BFA OBF + 1
   { 0x7, 18, NULL, NULL, PPC_OPERAND_CR },
 
-  /* The BI field in a B form or XL form instruction.  */
-#define BI BFA + 1
-#define BI_MASK (0x1f << 16)
-  { 0x1f, 16, NULL, NULL, PPC_OPERAND_CR },
-
   /* The BO field in a B form instruction.  Certain values are
      illegal.  */
-#define BO BI + 1
+#define BO BFA + 1
 #define BO_MASK (0x1f << 21)
   { 0x1f, 21, insert_bo, extract_bo, 0 },
 
@@ -191,18 +190,19 @@ const struct powerpc_operand powerpc_ope
 
   /* The CRB field in an X form instruction.  */
 #define CRB CR + 1
+  /* The MB field in an M form instruction.  */
+#define MB CRB
+#define MB_MASK (0x1f << 6)
   { 0x1f, 6, NULL, NULL, 0 },
 
-  /* The CRFD field in an X form instruction.  */
-#define CRFD CRB + 1
-  { 0x7, 23, NULL, NULL, PPC_OPERAND_CR },
-
   /* The CRFS field in an X form instruction.  */
-#define CRFS CRFD + 1
+#define CRFS CRB + 1
   { 0x7, 0, NULL, NULL, PPC_OPERAND_CR },
 
   /* The CT field in an X form instruction.  */
 #define CT CRFS + 1
+  /* The MO field in an mbar instruction.  */
+#define MO CT
   { 0x1f, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
 
   /* The D field in a D form instruction.  This is a displacement off
@@ -239,6 +239,8 @@ const struct powerpc_operand powerpc_ope
 
   /* The FL1 field in a POWER SC form instruction.  */
 #define FL1 E + 1
+  /* The U field in an X form instruction.  */
+#define U FL1
   { 0xf, 12, NULL, NULL, 0 },
 
   /* The FL2 field in a POWER SC form instruction.  */
@@ -272,7 +274,6 @@ const struct powerpc_operand powerpc_ope
 
   /* The FXM field in an XFX instruction.  */
 #define FXM FRS + 1
-#define FXM_MASK (0xff << 12)
   { 0xff, 12, insert_fxm, extract_fxm, 0 },
 
   /* Power4 version for mfcr.  */
@@ -305,13 +306,8 @@ const struct powerpc_operand powerpc_ope
 #define LS LIA + 1
   { 0x3, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
 
-  /* The MB field in an M form instruction.  */
-#define MB LS + 1
-#define MB_MASK (0x1f << 6)
-  { 0x1f, 6, NULL, NULL, 0 },
-
   /* The ME field in an M form instruction.  */
-#define ME MB + 1
+#define ME LS + 1
 #define ME_MASK (0x1f << 1)
   { 0x1f, 1, NULL, NULL, 0 },
 
@@ -330,13 +326,9 @@ const struct powerpc_operand powerpc_ope
 #define MB6_MASK (0x3f << 5)
   { 0x3f, 5, insert_mb6, extract_mb6, 0 },
 
-  /* The MO field in an mbar instruction.  */
-#define MO MB6 + 1
-  { 0x1f, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
-
   /* The NB field in an X form instruction.  The value 32 is stored as
      0.  */
-#define NB MO + 1
+#define NB MB6 + 1
   { 0x1f, 11, NULL, extract_nb, PPC_OPERAND_PLUS1 },
 
   /* The NSI field in a D form instruction.  This is the same as the
@@ -399,24 +391,22 @@ const struct powerpc_operand powerpc_ope
 #define RT_MASK (0x1f << 21)
   { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR },
 
-  /* The RS field of the DS form stq instruction, which has special
-     value restrictions.  */
+  /* The RS and RT fields of the DS form stq instruction, which have
+     special value restrictions.  */
 #define RSQ RS + 1
-  { 0x1e, 21, NULL, NULL, PPC_OPERAND_GPR_0 },
-
-  /* The RT field of the DQ form lq instruction, which has special
-     value restrictions.  */
-#define RTQ RSQ + 1
+#define RTQ RSQ
   { 0x1e, 21, NULL, NULL, PPC_OPERAND_GPR_0 },
 
   /* The RS field of the tlbwe instruction, which is optional.  */
-#define RSO RTQ + 1
+#define RSO RSQ + 1
 #define RTO RSO
   { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL },
 
   /* The SH field in an X or M form instruction.  */
 #define SH RSO + 1
 #define SH_MASK (0x1f << 11)
+  /* The other UIMM field in a EVX form instruction.  */
+#define EVUIMM SH
   { 0x1f, 11, NULL, NULL, 0 },
 
   /* The SH field in an MD form instruction.  This is split.  */
@@ -459,7 +449,6 @@ const struct powerpc_operand powerpc_ope
 
   /* The STRM field in an X AltiVec form instruction.  */
 #define STRM SR + 1
-#define STRM_MASK (0x3 << 21)
   { 0x3, 21, NULL, NULL, 0 },
 
   /* The SV field in a POWER SC form instruction.  */
@@ -476,33 +465,25 @@ const struct powerpc_operand powerpc_ope
 #define TO_MASK (0x1f << 21)
   { 0x1f, 21, NULL, NULL, 0 },
 
-  /* The U field in an X form instruction.  */
-#define U TO + 1
-  { 0xf, 12, NULL, NULL, 0 },
-
   /* The UI field in a D form instruction.  */
-#define UI U + 1
+#define UI TO + 1
   { 0xffff, 0, NULL, NULL, 0 },
 
   /* The VA field in a VA, VX or VXR form instruction.  */
 #define VA UI + 1
-#define VA_MASK	(0x1f << 16)
   { 0x1f, 16, NULL, NULL, PPC_OPERAND_VR },
 
   /* The VB field in a VA, VX or VXR form instruction.  */
 #define VB VA + 1
-#define VB_MASK (0x1f << 11)
   { 0x1f, 11, NULL, NULL, PPC_OPERAND_VR },
 
   /* The VC field in a VA form instruction.  */
 #define VC VB + 1
-#define VC_MASK (0x1f << 6)
   { 0x1f, 6, NULL, NULL, PPC_OPERAND_VR },
 
   /* The VD or VS field in a VA, VX, VXR or X form instruction.  */
 #define VD VC + 1
 #define VS VD
-#define VD_MASK (0x1f << 21)
   { 0x1f, 21, NULL, NULL, PPC_OPERAND_VR },
 
   /* The SIMM field in a VX form instruction.  */
@@ -518,12 +499,8 @@ const struct powerpc_operand powerpc_ope
 #define SHB UIMM + 1
   { 0xf, 6, NULL, NULL, 0 },
 
-  /* The other UIMM field in a EVX form instruction.  */
-#define EVUIMM SHB + 1
-  { 0x1f, 11, NULL, NULL, 0 },
-
   /* The other UIMM field in a half word EVX form instruction.  */
-#define EVUIMM_2 EVUIMM + 1
+#define EVUIMM_2 SHB + 1
   { 0x3e, 10, NULL, NULL, PPC_OPERAND_PARENS },
 
   /* The other UIMM field in a word EVX form instruction.  */
@@ -536,12 +513,10 @@ const struct powerpc_operand powerpc_ope
 
   /* The WS field.  */
 #define WS EVUIMM_8 + 1
-#define WS_MASK (0x7 << 11)
   { 0x7, 11, NULL, NULL, 0 },
 
   /* The L field in an mtmsrd or A form instruction.  */
-#define MTMSRD_L WS + 1
-#define A_L MTMSRD_L
+#define A_L WS + 1
   { 0x1, 16, NULL, NULL, PPC_OPERAND_OPTIONAL },
 
 #define RMC A_L + 1
@@ -563,12 +538,8 @@ const struct powerpc_operand powerpc_ope
 #define DGM DCM
   { 0x3f, 10, NULL, NULL, 0 },
 
-  /* The L field in an X form with the RT field fixed instruction.  */
-#define XRT_L SH16 + 1
-  { 0x1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
-
   /* The EH field in larx instruction.  */
-#define EH XRT_L + 1
+#define EH SH16 + 1
   { 0x1, 0, NULL, NULL, PPC_OPERAND_OPTIONAL },
 };
 
@@ -3236,7 +3207,7 @@ const struct powerpc_opcode powerpc_opco
 { "ldarx",   X(31,84),	XEH_MASK,	PPC64,		{ RT, RA0, RB, EH } },
 
 { "dcbfl",   XOPL(31,86,1), XRT_MASK,	POWER5,		{ RA, RB } },
-{ "dcbf",    X(31,86),	XLRT_MASK,	PPC,		{ RA, RB, XRT_L } },
+{ "dcbf",    X(31,86),	XLRT_MASK,	PPC,		{ RA, RB, L } },
 
 { "lbzx",    X(31,87),	X_MASK,		COM,		{ RT, RA0, RB } },
 
@@ -3325,7 +3296,7 @@ const struct powerpc_opcode powerpc_opco
 { "dcbtls",  X(31,166),	X_MASK,		PPCCHLK,	{ CT, RA, RB }},
 { "dcbtlse", X(31,174),	X_MASK,		PPCCHLK64,	{ CT, RA, RB }},
 
-{ "mtmsrd",  X(31,178),	XRLARB_MASK,	PPC64,		{ RS, MTMSRD_L } },
+{ "mtmsrd",  X(31,178),	XRLARB_MASK,	PPC64,		{ RS, A_L } },
 
 { "stdux",   X(31,181),	X_MASK,		PPC64,		{ RS, RAS, RB } },
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: --enable-checking for gas
  2007-04-21  6:50 --enable-checking for gas Alan Modra
@ 2007-04-21  7:32 ` Alan Modra
  2007-04-21 13:32   ` Alan Modra
  2007-04-21 12:50 ` Fallout for VAX (was: --enable-checking for gas) Jan-Benedict Glaw
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Modra @ 2007-04-21  7:32 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Fallout for VAX (was: --enable-checking for gas)
  2007-04-21  6:50 --enable-checking for gas Alan Modra
  2007-04-21  7:32 ` Alan Modra
@ 2007-04-21 12:50 ` Jan-Benedict Glaw
  2007-04-21 13:39   ` Alan Modra
  1 sibling, 1 reply; 6+ messages in thread
From: Jan-Benedict Glaw @ 2007-04-21 12:50 UTC (permalink / raw)
  To: binutils, Matt Thomas; +Cc: Alan Modra

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

On Sat, 2007-04-21 14:46:32 +0930, Alan Modra <amodra@bigpond.net.au> wrote:
> gas/
> 	* as.h (ENABLE_CHECKING): Default define to 0.
> 	(know): Assert if ENABLE_CHECKING.
> 	(struct relax_type): Remove superfluous declaration.
> 	* configure.in (--enable-checking): New.
> 	* configure: Regenerate.
> 	* config.in: Regenerate.
> 	* config/tc-ppc.c (ppc_setup_opcodes): Do checks when ENABLE_CHECKING.
> 	Check for duplicate powerpc_operands entries.

Now where know() really does do its work for CVS builds, we see some
fallout for eg. vax-linux-uclibc:

gcc -DHAVE_CONFIG_H -I. -I/tmp/build-temp-vax-linux-uclibc/src/binutils/gas -I. -D_GNU_SOURCE -I. -I/tmp/build-temp-vax-linux-uclibc/src/binutils/gas -I../bfd -I/tmp/build-temp-vax-linux-uclibc/src/binutils/gas/config -I/tmp/build-temp-vax-linux-uclibc/src/binutils/gas/../include -I/tmp/build-temp-vax-linux-uclibc/src/binutils/gas/.. -I/tmp/build-temp-vax-linux-uclibc/src/binutils/gas/../bfd -DLOCALEDIR="\"/tmp/build-temp-vax-linux-uclibc/install/usr/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c /tmp/build-temp-vax-linux-uclibc/src/binutils/gas/config/atof-vax.c
cc1: warnings being treated as errors
/tmp/build-temp-vax-linux-uclibc/src/binutils/gas/config/atof-vax.c: In function #md_atof#:
/tmp/build-temp-vax-linux-uclibc/src/binutils/gas/config/atof-vax.c:438: warning: comparison between signed and unsigned
make[3]: *** [atof-vax.o] Error 1
make[3]: Leaving directory `/tmp/build-temp-vax-linux-uclibc/build/binutils/gas'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/build-temp-vax-linux-uclibc/build/binutils/gas'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/build-temp-vax-linux-uclibc/build/binutils/gas'
make: *** [all-gas] Error 2

If Matt doesn't object, I'd like to install this patch to fix it:

2007-04-21	Jan-Benedict Glaw <jbglaw@lug-owl.de>

gas/
	* config/atof-vax.c: Update copyright year.
	(atof_vax_sizeof): Return unsigned int instead of int.
	(md_atof): Make number_of_chars unsigned int, too.
	(MAXIMUM_NUMBER_OF_LITTLENUMS): Remove single space.

--- src-binutils-fresh/gas/config/atof-vax.c	2005-05-05 11:12:52.000000000 +0200
+++ src-binutils-hacked/gas/config/atof-vax.c	2007-04-21 14:34:51.000000000 +0200
@@ -1,5 +1,5 @@
 /* atof_vax.c - turn a Flonum into a VAX floating point number
-   Copyright 1987, 1992, 1993, 1995, 1997, 1999, 2000, 2005
+   Copyright 1987, 1992, 1993, 1995, 1997, 1999, 2000, 2005, 2007
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -35,7 +35,7 @@ int flonum_gen2vax (int, FLONUM_TYPE *, 
 
 /* Number of chars in flonum type 'letter'.  */
 
-static int
+static unsigned int
 atof_vax_sizeof (int letter)
 {
   int return_value;
@@ -386,7 +386,7 @@ flonum_gen2vax (int format_letter,	/* On
   	Floating point literal.
   	Number of chars we used for the literal.  */
 
-#define MAXIMUM_NUMBER_OF_LITTLENUMS  8 	/* For .hfloats.  */
+#define MAXIMUM_NUMBER_OF_LITTLENUMS  8		/* For .hfloats.  */
 
 char *
 md_atof (int what_statement_type,
@@ -395,7 +395,7 @@ md_atof (int what_statement_type,
 {
   LITTLENUM_TYPE words[MAXIMUM_NUMBER_OF_LITTLENUMS];
   char kind_of_float;
-  int number_of_chars;
+  unsigned int number_of_chars;
   LITTLENUM_TYPE *littlenumP;
 
   switch (what_statement_type)


MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of: 23:53 <@jbglaw> So, ich kletter' jetzt mal ins Bett.
the second  : 23:57 <@jever2> .oO( kletter ..., hat er noch Gitter vorm Bett, wie früher meine Kinder?)
              00:00 <@jbglaw> jever2: *patsch*
              00:01 <@jever2> *aua*, wofür, Gedanken sind frei!
              00:02 <@jbglaw> Nee, freie Gedanken, die sind seit 1984 doch aus!
              00:03 <@jever2> 1984? ich bin erst seit 1985 verheiratet!

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: --enable-checking for gas
  2007-04-21  7:32 ` Alan Modra
@ 2007-04-21 13:32   ` Alan Modra
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Modra @ 2007-04-21 13:32 UTC (permalink / raw)
  To: binutils

More fixes.

	* config/atof-vax.c (atof_vax_sizeof): Change return type to unsigned.
	(md_atof): Make number_of_chars unsigned.
	* config/tc-ia64.c (emit_one_bundle): Warning fix.
	* config/tc-or32.c (md_apply_fix): Delete bogus assertions.
	* config/tc-sh.c (sh_optimize_expr): Only define for OBJ_ELF.
	* config/tc-sh.h (md_optimize_expr): Likewise.
	* config/tc-sh64.c (shmedia_md_pcrel_from_section): Delete bogus
	assertion.
	* config/tc-xtensa.c (convert_frag_immed_finish_loop): Likewise.

Index: gas/config/atof-vax.c
===================================================================
RCS file: /cvs/src/src/gas/config/atof-vax.c,v
retrieving revision 1.8
diff -u -p -r1.8 atof-vax.c
--- gas/config/atof-vax.c	5 May 2005 09:12:52 -0000	1.8
+++ gas/config/atof-vax.c	21 Apr 2007 11:59:37 -0000
@@ -35,7 +35,7 @@ int flonum_gen2vax (int, FLONUM_TYPE *, 
 
 /* Number of chars in flonum type 'letter'.  */
 
-static int
+static unsigned int
 atof_vax_sizeof (int letter)
 {
   int return_value;
@@ -395,7 +395,7 @@ md_atof (int what_statement_type,
 {
   LITTLENUM_TYPE words[MAXIMUM_NUMBER_OF_LITTLENUMS];
   char kind_of_float;
-  int number_of_chars;
+  unsigned int number_of_chars;
   LITTLENUM_TYPE *littlenumP;
 
   switch (what_statement_type)
Index: gas/config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.190
diff -u -p -r1.190 tc-ia64.c
--- gas/config/tc-ia64.c	1 Feb 2007 14:12:18 -0000	1.190
+++ gas/config/tc-ia64.c	21 Apr 2007 11:59:43 -0000
@@ -6691,7 +6691,7 @@ emit_one_bundle ()
   int addr_mod;
 
   first = (md.curr_slot + NUM_SLOTS - md.num_slots_in_use) % NUM_SLOTS;
-  know (first >= 0 & first < NUM_SLOTS);
+  know (first >= 0 && first < NUM_SLOTS);
   n = MIN (3, md.num_slots_in_use);
 
   /* Determine template: user user_template if specified, best match
Index: gas/config/tc-or32.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-or32.c,v
retrieving revision 1.11
diff -u -p -r1.11 tc-or32.c
--- gas/config/tc-or32.c	11 Aug 2005 01:25:28 -0000	1.11
+++ gas/config/tc-or32.c	21 Apr 2007 11:59:44 -0000
@@ -616,9 +617,6 @@ md_apply_fix (fixS * fixP, valueT * val,
 
   fixP->fx_addnumber = t_val; /* Remember value for emit_reloc.  */
 
-  know (fixP->fx_size == 4);
-  know (fixP->fx_r_type < BFD_RELOC_NONE);
-
   switch (fixP->fx_r_type)
     {
     case BFD_RELOC_32:      /* XXXXXXXX pattern in a word.  */
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.125
diff -u -p -r1.125 tc-sh.c
--- gas/config/tc-sh.c	16 Apr 2007 13:05:30 -0000	1.125
+++ gas/config/tc-sh.c	21 Apr 2007 11:59:47 -0000
@@ -886,7 +886,6 @@ align_test_frag_offset_fixed_p (const fr
 
   return FALSE;
 }
-#endif /* OBJ_ELF */
 
 /* Optimize a difference of symbols which have rs_align_test frag if
    possible.  */
@@ -894,7 +893,6 @@ align_test_frag_offset_fixed_p (const fr
 int
 sh_optimize_expr (expressionS *l, operatorT op, expressionS *r)
 {
-#ifdef OBJ_ELF
   bfd_vma frag_off;
 
   if (op == O_subtract
@@ -915,9 +913,9 @@ sh_optimize_expr (expressionS *l, operat
       l->X_add_symbol = 0;
       return 1;
     }
-#endif /* OBJ_ELF */
   return 0;
 }
+#endif /* OBJ_ELF */
 \f
 /* This function is called once, at assembler startup time.  This should
    set up all the tables, etc that the MD part of the assembler needs.  */
Index: gas/config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.47
diff -u -p -r1.47 tc-sh.h
--- gas/config/tc-sh.h	14 Apr 2007 14:21:11 -0000	1.47
+++ gas/config/tc-sh.h	21 Apr 2007 11:59:48 -0000
@@ -47,8 +47,10 @@ extern void sh_cons_align (int);
 /* We need to optimize expr with taking account of rs_align_test
    frags.  */
 
+#ifdef OBJ_ELF
 #define md_optimize_expr(l,o,r) sh_optimize_expr (l, o, r)
 extern int sh_optimize_expr (expressionS *, operatorT, expressionS *);
+#endif
 
 /* When relaxing, we need to generate relocations for alignment
    directives.  */
Index: gas/config/tc-sh64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh64.c,v
retrieving revision 1.22
diff -u -p -r1.22 tc-sh64.c
--- gas/config/tc-sh64.c	29 Aug 2006 01:31:56 -0000	1.22
+++ gas/config/tc-sh64.c	21 Apr 2007 11:59:49 -0000
@@ -3035,8 +3035,6 @@ sh64_target_mach (void)
 valueT
 shmedia_md_pcrel_from_section (struct fix *fixP, segT sec ATTRIBUTE_UNUSED)
 {
-  know (fixP->fx_frag->fr_type == rs_machine_dependent);
-
   /* Use the ISA for the instruction to decide which offset to use.  We
      can glean it from the fisup type.  */
   switch (fixP->fx_r_type)
Index: gas/config/tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.80
diff -u -p -r1.80 tc-xtensa.c
--- gas/config/tc-xtensa.c	2 Apr 2007 20:05:47 -0000	1.80
+++ gas/config/tc-xtensa.c	21 Apr 2007 11:59:55 -0000
@@ -9513,11 +9513,6 @@ convert_frag_immed_finish_loop (segT seg
       target = 0;
     }
 
-  know (symbolP);
-  know (symbolP->sy_frag);
-  know (!(S_GET_SEGMENT (symbolP) == absolute_section)
-	|| symbol_get_frag (symbolP) == &zero_address_frag);
-
   loop_length = target - (fragP->fr_address + fragP->fr_fix);
   loop_length_hi = loop_length & ~0x0ff;
   loop_length_lo = loop_length & 0x0ff;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fallout for VAX (was: --enable-checking for gas)
  2007-04-21 12:50 ` Fallout for VAX (was: --enable-checking for gas) Jan-Benedict Glaw
@ 2007-04-21 13:39   ` Alan Modra
  2007-04-21 17:23     ` Jan-Benedict Glaw
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2007-04-21 13:39 UTC (permalink / raw)
  To: binutils

On Sat, Apr 21, 2007 at 02:42:36PM +0200, Jan-Benedict Glaw wrote:
> 	* config/atof-vax.c: Update copyright year.
> 	(atof_vax_sizeof): Return unsigned int instead of int.
> 	(md_atof): Make number_of_chars unsigned int, too.
> 	(MAXIMUM_NUMBER_OF_LITTLENUMS): Remove single space.

I just committed a very similar patch, reverting Nick's fix (to avoid
a cast).  I was waiting for testsuite runs to finish..

The only fallout I have now is for mmix, which triggers the assertion
at read.c:709 due to the hack at tc-mmix.c:2991.  I'm inclined to
make the following change, but I'm waiting for another testsuite
run.

	* read.c (read_a_source_file): Skip multiple spaces to
	cover hack in mmix md_start_line_hook which overwrites a
	colon with a space.  Delete sermon and needless assertion.

Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.125
diff -u -p -r1.125 read.c
--- gas/read.c	21 Apr 2007 06:54:56 -0000	1.125
+++ gas/read.c	21 Apr 2007 13:26:01 -0000
@@ -695,18 +695,11 @@ read_a_source_file (char *name)
 
 	     Depending on what compiler is used, the order of these tests
 	     may vary to catch most common case 1st.
-	     Each test is independent of all other tests at the (top) level.
-	     PLEASE make a compiler that doesn't use this assembler.
-	     It is crufty to waste a compiler's time encoding things for this
-	     assembler, which then wastes more time decoding it.
-	     (And communicating via (linear) files is silly!
-	     If you must pass stuff, please pass a tree!)  */
-	  if ((c = *input_line_pointer++) == '\t'
-	      || c == ' '
-	      || c == '\f')
+	     Each test is independent of all other tests at the (top)
+	     level.  */
+	  do
 	    c = *input_line_pointer++;
-
-	  know (c != ' ');	/* No further leading whitespace.  */
+	  while (c == '\t' || c == ' ' || c == '\f');
 
 #ifndef NO_LISTING
 	  /* If listing is on, and we are expanding a macro, then give

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fallout for VAX (was: --enable-checking for gas)
  2007-04-21 13:39   ` Alan Modra
@ 2007-04-21 17:23     ` Jan-Benedict Glaw
  0 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2007-04-21 17:23 UTC (permalink / raw)
  To: binutils

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

On Sat, 2007-04-21 23:02:44 +0930, Alan Modra <amodra@bigpond.net.au> wrote:
> On Sat, Apr 21, 2007 at 02:42:36PM +0200, Jan-Benedict Glaw wrote:
> > 	* config/atof-vax.c: Update copyright year.
> > 	(atof_vax_sizeof): Return unsigned int instead of int.
> > 	(md_atof): Make number_of_chars unsigned int, too.
> > 	(MAXIMUM_NUMBER_OF_LITTLENUMS): Remove single space.
> 
> I just committed a very similar patch, reverting Nick's fix (to avoid
> a cast).  I was waiting for testsuite runs to finish..

Thanks.

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:               The real problem with C++ for kernel modules is:
the second  :                                 the language just sucks.
                                                   -- Linus Torvalds

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-04-21 16:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-21  6:50 --enable-checking for gas Alan Modra
2007-04-21  7:32 ` Alan Modra
2007-04-21 13:32   ` Alan Modra
2007-04-21 12:50 ` Fallout for VAX (was: --enable-checking for gas) Jan-Benedict Glaw
2007-04-21 13:39   ` Alan Modra
2007-04-21 17:23     ` Jan-Benedict Glaw

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).