public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [ARM] fix missing expression bug
@ 2009-08-04 13:53 Nathan Sidwell
  2009-08-04 14:49 ` Richard Earnshaw
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Sidwell @ 2009-08-04 13:53 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

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


[-- Attachment #2: expr.patch --]
[-- Type: text/x-patch, Size: 2503 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ARM] fix missing expression bug
  2009-08-04 13:53 [ARM] fix missing expression bug Nathan Sidwell
@ 2009-08-04 14:49 ` Richard Earnshaw
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2009-08-04 14:49 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: binutils


On Tue, 2009-08-04 at 14:53 +0100, Nathan Sidwell wrote:
> 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

OK
R.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-04 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-04 13:53 [ARM] fix missing expression bug Nathan Sidwell
2009-08-04 14:49 ` Richard Earnshaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).