patch to optionally relax paren expression handling
Ian Lance Taylor
ian@zembu.com
Fri Jun 23 09:48:00 GMT 2000
Date: Fri, 23 Jun 2000 18:04:51 +1000
From: matthew green <mrg@cygnus.com>
i need the following patch (plus the relevant #define in tc-foo.h) for
a new target i am working on. the instruction i am trying to assemble
looks like this:
insn (a5), d2
the problem is that while assembling an instruction, the parser tests
several wrong instructions before finding the correct instruction.
unfortunately, some of the wrong instructions expect a value as the
first operand on this insn, so when parsing the `(a5)' above, it attempts
to evaluate this as a math grouping, but this fails, and a call to
as_bad() is taken, causing the assemble to fail. with the following
patch, when RELAX_PAREN_GROUPING is defined, a mis-matched '()' will
not call as_bad(). this fixes my problem and allows the assembler to
find the correct instruction and generate the right output. i also
have reworked the increment of input_line_pointer and corrected the
as_bad() error message in the '[' case.
For something like this, I think it makes a lot more sense to use a
run time switch rather than a compile time switch. After all, you
probably do want the error for something like
.long (1
Pass the appropriate parameter when trying to parse the expression
from your tc-foo.c file, and arrange for a return value indicating an
unparseable expression.
Ian
More information about the Binutils
mailing list