aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-11-06 13:23:20 +1030
committerAlan Modra <amodra@gmail.com>2018-11-06 21:17:28 +1030
commit2eac3da184459607a476ebb5dcebd6e0acf9fefa (patch)
tree1c7fc7d3b85104c6273a9bcfee2a461da2db1830 /gas/config/tc-ppc.c
parent4dd4e6394509d58685daea52cc6947c45fd7ee9d (diff)
downloadgdb-2eac3da184459607a476ebb5dcebd6e0acf9fefa.zip
gdb-2eac3da184459607a476ebb5dcebd6e0acf9fefa.tar.gz
gdb-2eac3da184459607a476ebb5dcebd6e0acf9fefa.tar.bz2
PowerPC instruction operand flag validation
This adds another check that might have saved me a little time recently if it had been present. * config/tc-ppc.c (insn_validate): Check that optional operands are not followed by non-optional operands.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index d587a50..694c47a 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1514,6 +1514,7 @@ insn_validate (const struct powerpc_opcode *op)
/* The operands must not overlap the opcode or each other. */
for (o = op->operands; *o; ++o)
{
+ bfd_boolean optional = FALSE;
if (*o >= num_powerpc_operands)
{
as_bad (_("operand index error for %s"), op->name);
@@ -1538,6 +1539,14 @@ insn_validate (const struct powerpc_opcode *op)
}
omask |= mask;
}
+ if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0)
+ optional = TRUE;
+ else if (optional)
+ {
+ as_bad (_("non-optional operand %d follows optional operand in %s"),
+ (int) (o - op->operands), op->name);
+ return TRUE;
+ }
}
}
return FALSE;