This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[ARM] fix missing expression bug
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: binutils <binutils at sources dot redhat dot com>
- Date: Tue, 04 Aug 2009 14:53:54 +0100
- Subject: [ARM] fix missing expression bug
This patch fixes a bug in the arm assembler. We were failing to detect a
missing expression, leading to object files with 'strange' relocations. In the
particular testcase, '@r3' had been used as the operand, but @ is arm's comment
character, thus obscuring the syntax error.
Fixed thusly, tested on arm-eabi, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery
2009-08-04 Nathan Sidwell <nathan@codesourcery.com>
* config/tc-arm.c (my_get_expression): Detect missing expressions.
testsuite/
* gas/arm/missing.s: New.
* gas/arm/missing.d: New.
* gas/arm/missing.l: New.
Index: config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.398
diff -c -3 -p -r1.398 tc-arm.c
*** config/tc-arm.c 31 Jul 2009 18:14:07 -0000 1.398
--- config/tc-arm.c 4 Aug 2009 13:48:37 -0000
*************** my_get_expression (expressionS * ep, cha
*** 913,925 ****
seg = expression (ep);
in_my_get_expression = 0;
! if (ep->X_op == O_illegal)
{
! /* We found a bad expression in md_operand(). */
*str = input_line_pointer;
input_line_pointer = save_in;
if (inst.error == NULL)
! inst.error = _("bad expression");
return 1;
}
--- 913,926 ----
seg = expression (ep);
in_my_get_expression = 0;
! if (ep->X_op == O_illegal || ep->X_op == O_absent)
{
! /* We found a bad or missing expression in md_operand(). */
*str = input_line_pointer;
input_line_pointer = save_in;
if (inst.error == NULL)
! inst.error = (ep->X_op == O_absent
! ? _("missing expression") :_("bad expression"));
return 1;
}
Index: testsuite/gas/arm/missing.d
===================================================================
RCS file: testsuite/gas/arm/missing.d
diff -N testsuite/gas/arm/missing.d
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gas/arm/missing.d 4 Aug 2009 13:48:38 -0000
***************
*** 0 ****
--- 1,3 ----
+ #name: missing operands
+ #as: -march=armv5
+ #error-output: missing.l
Index: testsuite/gas/arm/missing.l
===================================================================
RCS file: testsuite/gas/arm/missing.l
diff -N testsuite/gas/arm/missing.l
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gas/arm/missing.l 4 Aug 2009 13:48:38 -0000
***************
*** 0 ****
--- 1,3 ----
+ [^:]*: Assembler messages:
+ [^:]*:1: Error: missing expression -- `bl'
+ [^:]*:2: Error: missing expression -- `blx'
Index: testsuite/gas/arm/missing.s
===================================================================
RCS file: testsuite/gas/arm/missing.s
diff -N testsuite/gas/arm/missing.s
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/gas/arm/missing.s 4 Aug 2009 13:48:38 -0000
***************
*** 0 ****
--- 1,2 ----
+ bl
+ blx