aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-04-21 05:15:41 +0000
committerAlan Modra <amodra@gmail.com>2007-04-21 05:15:41 +0000
commitc43a438d5eb0a2e19397a4c0fb51ce3a68ed1503 (patch)
tree3dd24ccc5105a905d362369120b9c118e42752a0 /gas
parent717bbdf18106a202656b1f34c03b02f52b84a849 (diff)
downloadgdb-c43a438d5eb0a2e19397a4c0fb51ce3a68ed1503.zip
gdb-c43a438d5eb0a2e19397a4c0fb51ce3a68ed1503.tar.gz
gdb-c43a438d5eb0a2e19397a4c0fb51ce3a68ed1503.tar.bz2
* 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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/as.h7
-rw-r--r--gas/config.in3
-rw-r--r--gas/config/tc-ppc.c96
-rwxr-xr-xgas/configure25
-rw-r--r--gas/configure.in15
6 files changed, 113 insertions, 44 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 59df563..9c2f7f1 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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>
* config/tc-m68k.c (mcf5253_ctrl): New.
diff --git a/gas/as.h b/gas/as.h
index e73180b..4ea63ab 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -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 */
diff --git a/gas/config.in b/gas/config.in
index 5bccb79..940e1f8 100644
--- a/gas/config.in
+++ b/gas/config.in
@@ -29,6 +29,9 @@
/* Supported 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
language is requested. */
#undef ENABLE_NLS
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 5a5cb38..1755363 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -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)
+ if (ENABLE_CHECKING)
{
- unsigned long mask = powerpc_operands[i].bitm;
- unsigned long right_bit;
+ unsigned int i;
- right_bit = mask & -mask;
- mask += right_bit;
- right_bit = mask & -mask;
- if (mask != right_bit)
+ /* 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)
{
- as_bad (_("powerpc_operands[%d].bitm invalid"), i);
- bad_insn = TRUE;
+ 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)
{
- unsigned long mask = operand->bitm << operand->shift;
- if (omask & mask)
+ 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)
{
- 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
diff --git a/gas/configure b/gas/configure
index 9743cf6..f2ca0be 100755
--- a/gas/configure
+++ b/gas/configure
@@ -858,6 +858,7 @@ Optional Features:
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-targets alternative target configurations besides the primary
--enable-commonbfdlib build shared BFD/opcodes/libiberty library
+ --enable-checking enable run-time checks
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
--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
*-*-irix6*)
# 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
(eval $ac_compile) 2>&5
ac_status=$?
@@ -4164,7 +4165,8 @@ echo "$as_me: error: enable-targets option must specify target names or 'all'" >
no) enable_targets= ;;
*) enable_targets=$enableval ;;
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
enableval="$enable_commonbfdlib"
case "${enableval}" in
@@ -4175,6 +4177,25 @@ echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
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
diff --git a/gas/configure.in b/gas/configure.in
index af242e2..02e8e53 100644
--- a/gas/configure.in
+++ b/gas/configure.in
@@ -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