* 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:
parent
717bbdf181
commit
c43a438d5e
6 changed files with 115 additions and 46 deletions
|
@ -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.
|
||||
|
|
7
gas/as.h
7
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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 %d overlap in %s"),
|
||||
(int) (o - op->operands), op->name);
|
||||
bad_insn = TRUE;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((op->flags & ppc_cpu & ~(PPC_OPCODE_32 | PPC_OPCODE_64)) != 0
|
||||
&& ((op->flags & (PPC_OPCODE_32 | PPC_OPCODE_64)) == 0
|
||||
|
|
25
gas/configure
vendored
25
gas/configure
vendored
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue