This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: patch to optionally relax paren expression handling
- To: mrg at cygnus dot com
- Subject: Re: patch to optionally relax paren expression handling
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 23 Jun 2000 08:29:27 -0700
- CC: binutils at sourceware dot cygnus dot com
- References: <24181.961747491@cygnus.com>
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