* 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.
This commit is contained in:
Alan Modra 2007-04-21 05:15:41 +00:00
parent 717bbdf181
commit c43a438d5e
6 changed files with 115 additions and 46 deletions

View file

@ -1,3 +1,14 @@
2007-04-21 Alan Modra <amodra@bigpond.net.au>
* 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.
2007-04-20 Nathan Sidwell <nathan@codesourcery.com> 2007-04-20 Nathan Sidwell <nathan@codesourcery.com>
* config/tc-m68k.c (mcf5253_ctrl): New. * config/tc-m68k.c (mcf5253_ctrl): New.

View file

@ -258,7 +258,11 @@ typedef addressT valueT;
#endif #endif
/* COMMON now defined */ /* COMMON now defined */
#ifdef DEBUG #ifndef ENABLE_CHECKING
#define ENABLE_CHECKING 0
#endif
#if ENABLE_CHECKING || defined (DEBUG)
#ifndef know #ifndef know
#define know(p) assert(p) /* Verify our assumptions! */ #define know(p) assert(p) /* Verify our assumptions! */
#endif /* not yet defined */ #endif /* not yet defined */
@ -566,7 +570,6 @@ segT subseg_get (const char *, int);
struct expressionS; struct expressionS;
struct fix; struct fix;
typedef struct symbol symbolS; typedef struct symbol symbolS;
struct relax_type;
typedef struct frag fragS; typedef struct frag fragS;
/* literal.c */ /* literal.c */

View file

@ -29,6 +29,9 @@
/* Supported emulations. */ /* Supported emulations. */
#undef EMULATIONS #undef EMULATIONS
/* Define if you want run-time sanity checks. */
#undef ENABLE_CHECKING
/* Define to 1 if translation of program messages to the user's native /* Define to 1 if translation of program messages to the user's native
language is requested. */ language is requested. */
#undef ENABLE_NLS #undef ENABLE_NLS

View file

@ -1248,7 +1248,6 @@ ppc_setup_opcodes (void)
const struct powerpc_opcode *op_end; const struct powerpc_opcode *op_end;
const struct powerpc_macro *macro; const struct powerpc_macro *macro;
const struct powerpc_macro *macro_end; const struct powerpc_macro *macro_end;
unsigned int i;
bfd_boolean bad_insn = FALSE; bfd_boolean bad_insn = FALSE;
if (ppc_hash != NULL) if (ppc_hash != NULL)
@ -1259,12 +1258,17 @@ ppc_setup_opcodes (void)
/* Insert the opcodes into a hash table. */ /* Insert the opcodes into a hash table. */
ppc_hash = hash_new (); ppc_hash = hash_new ();
if (ENABLE_CHECKING)
{
unsigned int i;
/* Check operand masks. Code here and in the disassembler assumes /* Check operand masks. Code here and in the disassembler assumes
all the 1's in the mask are contiguous. */ all the 1's in the mask are contiguous. */
for (i = 0; i < num_powerpc_operands; ++i) for (i = 0; i < num_powerpc_operands; ++i)
{ {
unsigned long mask = powerpc_operands[i].bitm; unsigned long mask = powerpc_operands[i].bitm;
unsigned long right_bit; unsigned long right_bit;
unsigned int j;
right_bit = mask & -mask; right_bit = mask & -mask;
mask += right_bit; mask += right_bit;
@ -1274,10 +1278,21 @@ ppc_setup_opcodes (void)
as_bad (_("powerpc_operands[%d].bitm invalid"), i); as_bad (_("powerpc_operands[%d].bitm invalid"), i);
bad_insn = TRUE; 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; op_end = powerpc_opcodes + powerpc_num_opcodes;
for (op = powerpc_opcodes; op < op_end; op++) for (op = powerpc_opcodes; op < op_end; op++)
{
if (ENABLE_CHECKING)
{ {
const unsigned char *o; const unsigned char *o;
unsigned long omask = op->mask; unsigned long omask = op->mask;
@ -1313,6 +1328,7 @@ ppc_setup_opcodes (void)
omask |= mask; omask |= mask;
} }
} }
}
if ((op->flags & ppc_cpu & ~(PPC_OPCODE_32 | PPC_OPCODE_64)) != 0 if ((op->flags & ppc_cpu & ~(PPC_OPCODE_32 | PPC_OPCODE_64)) != 0
&& ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0 && ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0

25
gas/configure vendored
View file

@ -858,6 +858,7 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds) --disable-libtool-lock avoid locking (might break parallel builds)
--enable-targets alternative target configurations besides the primary --enable-targets alternative target configurations besides the primary
--enable-commonbfdlib build shared BFD/opcodes/libiberty library --enable-commonbfdlib build shared BFD/opcodes/libiberty library
--enable-checking enable run-time checks
--enable-werror treat compile warnings as errors --enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings --enable-build-warnings enable build-time compiler warnings
--disable-nls do not use Native Language Support --disable-nls do not use Native Language Support
@ -3866,7 +3867,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in case $host in
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 3869 "configure"' > conftest.$ac_ext echo '#line 3870 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
@ -4164,7 +4165,8 @@ echo "$as_me: error: enable-targets option must specify target names or 'all'" >
no) enable_targets= ;; no) enable_targets= ;;
*) enable_targets=$enableval ;; *) enable_targets=$enableval ;;
esac esac
fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. fi;
# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given.
if test "${enable_commonbfdlib+set}" = set; then if test "${enable_commonbfdlib+set}" = set; then
enableval="$enable_commonbfdlib" enableval="$enable_commonbfdlib"
case "${enableval}" in case "${enableval}" in
@ -4175,6 +4177,25 @@ echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;}
{ (exit 1); exit 1; }; } ;; { (exit 1); exit 1; }; } ;;
esac esac
fi; fi;
ac_checking=yes
if grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then
ac_checking=
fi
# Check whether --enable-checking or --disable-checking was given.
if test "${enable_checking+set}" = set; then
enableval="$enable_checking"
case "${enableval}" in
no|none) ac_checking= ;;
*) ac_checking=yes ;;
esac
fi; if test x$ac_checking != x ; then
cat >>confdefs.h <<\_ACEOF
#define ENABLE_CHECKING 1
_ACEOF
fi
using_cgen=no using_cgen=no

View file

@ -30,6 +30,7 @@ AC_ARG_ENABLE(targets,
no) enable_targets= ;; no) enable_targets= ;;
*) enable_targets=$enableval ;; *) enable_targets=$enableval ;;
esac])dnl esac])dnl
AC_ARG_ENABLE(commonbfdlib, AC_ARG_ENABLE(commonbfdlib,
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
[case "${enableval}" in [case "${enableval}" in
@ -38,6 +39,20 @@ AC_ARG_ENABLE(commonbfdlib,
*) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
esac])dnl 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 using_cgen=no
AM_BINUTILS_WARNINGS AM_BINUTILS_WARNINGS