This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
problem processing \@ expression in arm/thumb assembler macros
- To: binutils at sourceware dot cygnus dot com
- Subject: problem processing \@ expression in arm/thumb assembler macros
- From: Thomas de Lellis <tdel at windriver dot com>
- Date: Fri, 10 Mar 2000 14:28:38 -0800
Hi,
Found a problem where \@ was not being processed correctly with
arm/thumb assemblers. Attached is a change for gas/app.c that fixes the
problem.
tom
Here's a proposed fix for a problem seen with arm/thumb assemblers.
The .macro usage count expression "\@" as described in the manual
failed I think becase @ is also the ARM's comment-character.
======================================================================
2000-03-10 Thomas de Lellis <tdel@windriver.com>
* app.c (do_scrub_chars): Fixed processing of
.macro "\@" expression for ARM/THUMB. @ was being
ignored since @ is also the ARM's comment
character.
======================================================================
*** app.c@@/main/3 Mon Oct 4 13:05:54 1999
--- app.c Fri Mar 10 13:53:33 2000
*************** do_scrub_chars (get, tostart, tolen)
*** 642,649 ****
--- 642,664 ----
/* OK, we are somewhere in states 0 through 4 or 9 through 11 */
+ #if defined TC_ARM && defined OBJ_ELF
+ /* Save current ch for \@ test below. Gets ARM to
+ interpret a possbile \@ macro count expression. */
+ ch2 = ch;
+ #endif /* TC_ARM && OBJ_ELF */
+
/* flushchar: */
ch = GET ();
+
+ #if defined TC_ARM && defined OBJ_ELF
+ /* If \@ combo seen don't treat @ after \ as comment character. */
+ if ((ch2 == '\\') && (ch == '@'))
+ {
+ PUT (ch);
+ ch = GET ();
+ }
+ #endif /* TC_ARM && OBJ_ELF */
recycle:
TESTCASE ==================================================================
.macro xxx
x\@:
nop
x\@y:
.long \@
.long \@ @asdsdf
.long x\@@sdasdsadsada
.long x\@y
.string "\@"
.string "x\@"
.string "\@y"
.string "x\@y"
.long 1\@
.long \@2
.long 1\@2
.endm
xxx
xxx
xxx
FAIL ======================================================================
./test
+ asarm -a -am -o a.o a.s
a.s: Assembler messages:
a.s:17: Error: bad instruction `x\'
a.s:17: Error: bad instruction `x\'
a.s:17: Error: Bad expression
a.s:17: Error: Bad expression
a.s:17: Error: Rest of line ignored. First ignored character is `\'.
a.s:17: Error: Rest of line ignored. First ignored character is `\'.
a.s:17: Error: Rest of line ignored. First ignored character is `\'.
a.s:17: Error: Bad expression
a.s:17: Error: Rest of line ignored. First ignored character is `\'.
a.s:18: Error: bad instruction `x\'
a.s:18: Error: bad instruction `x\'
a.s:18: Error: Bad expression
a.s:18: Error: Bad expression
a.s:18: Error: Rest of line ignored. First ignored character is `\'.
a.s:18: Error: Rest of line ignored. First ignored character is `\'.
a.s:18: Error: Rest of line ignored. First ignored character is `\'.
a.s:18: Error: Bad expression
a.s:18: Error: Rest of line ignored. First ignored character is `\'.
a.s:19: Error: bad instruction `x\'
a.s:19: Error: bad instruction `x\'
a.s:19: Error: Bad expression
a.s:19: Error: Bad expression
a.s:19: Error: Rest of line ignored. First ignored character is `\'.
a.s:19: Error: Rest of line ignored. First ignored character is `\'.
a.s:19: Error: Rest of line ignored. First ignored character is `\'.
a.s:19: Error: Bad expression
a.s:19: Error: Rest of line ignored. First ignored character is `\'.
ARM GAS a.s page 1
1 .macro xxx
2 x\@:
3 nop
4 x\@y:
5 .long \@
6 .long \@ @asdsdf
7 .long x\@@sdasdsadsada
8 .long x\@y
9 .string "\@"
10 .string "x\@"
11 .string "\@y"
12 .string "x\@y"
13 .long 1\@
14 .long \@2
15 .long 1\@2
16 .endm
17 xxx
17 > x\
17 ???? 0000A0E1 > nop
17 > x\
17 ???? 00000000 > .long \
**** Error:Bad expression
17 ???? 00000000 > .long \
**** Error:Bad expression
17 ???? 00000000 > .long x\
**** Error:Rest of line ignored. First ignored character is `\'.
17 ???? 00000000 > .long x\
**** Error:Rest of line ignored. First ignored character is `\'.
17 ???? 30303030 > .string "00000"
17 3000
17 ???? 78303030 > .string "x00000"
17 303000
17 ???? 30303030 > .string "00000y"
17 307900
17 ???? 78303030 > .string "x00000y"
17 30307900
17 ???? 01000000 > .long 1\
**** Error:Rest of line ignored. First ignored character is `\'.
17 ???? 00000000 > .long \
**** Error:Bad expression
17 ???? 01000000 > .long 1\
**** Error:Rest of line ignored. First ignored character is `\'.
18 xxx
18 > x\
18 ???? 0000A0E1 > nop
18 > x\
18 ???? 00000000 > .long \
**** Error:Bad expression
18 ???? 00000000 > .long \
**** Error:Bad expression
18 ???? 00000000 > .long x\
**** Error:Rest of line ignored. First ignored character is `\'.
18 ???? 00000000 > .long x\
**** Error:Rest of line ignored. First ignored character is `\'.
18 ???? 30303030 > .string "00001"
18 3100
18 ???? 78303030 > .string "x00001"
ARM GAS a.s page 2
18 303100
18 ???? 30303030 > .string "00001y"
18 317900
18 ???? 78303030 > .string "x00001y"
18 30317900
18 ???? 01000000 > .long 1\
**** Error:Rest of line ignored. First ignored character is `\'.
18 ???? 00000000 > .long \
**** Error:Bad expression
18 ???? 01000000 > .long 1\
**** Error:Rest of line ignored. First ignored character is `\'.
19 xxx
19 > x\
19 ???? 0000A0E1 > nop
19 > x\
19 ???? 00000000 > .long \
**** Error:Bad expression
19 ???? 00000000 > .long \
**** Error:Bad expression
19 ???? 00000000 > .long x\
**** Error:Rest of line ignored. First ignored character is `\'.
19 ???? 00000000 > .long x\
**** Error:Rest of line ignored. First ignored character is `\'.
19 ???? 30303030 > .string "00002"
19 3200
19 ???? 78303030 > .string "x00002"
19 303200
19 ???? 30303030 > .string "00002y"
19 327900
19 ???? 78303030 > .string "x00002y"
19 30327900
19 ???? 01000000 > .long 1\
**** Error:Rest of line ignored. First ignored character is `\'.
19 ???? 00000000 > .long \
**** Error:Bad expression
19 ???? 01000000 > .long 1\
**** Error:Rest of line ignored. First ignored character is `\'.
ARM GAS a.s page 3
NO DEFINED SYMBOLS
UNDEFINED SYMBOLS
x
PASS ======================================================================
./test
+ asarm -a -am -o a.o a.s
ARM GAS a.s page 1
1 .macro xxx
2 x\@:
3 nop
4 x\@y:
5 .long \@
6 .long \@ @asdsdf
7 .long x\@@sdasdsadsada
8 .long x\@y
9 .string "\@"
10 .string "x\@"
11 .string "\@y"
12 .string "x\@y"
13 .long 1\@
14 .long \@2
15 .long 1\@2
16 .endm
17 xxx
17 > x00000:
17 >
17 0000 0000A0E1 > nop
17 > x00000y:
17 >
17 0004 00000000 > .long 00000
17 0008 00000000 > .long 00000
17 000c 00000000 > .long x00000
17 0010 04000000 > .long x00000y
17 0014 30303030 > .string "00000"
17 3000
17 001a 78303030 > .string "x00000"
17 303000
17 0021 30303030 > .string "00000y"
17 307900
17 0028 78303030 > .string "x00000y"
17 30307900
17 0030 A0860100 > .long 100000
17 0034 02000000 > .long 000002
17 0038 42420F00 > .long 1000002
18 xxx
18 > x00001:
18 >
18 003c 0000A0E1 > nop
18 > x00001y:
18 >
18 0040 01000000 > .long 00001
18 0044 01000000 > .long 00001
18 0048 3C000000 > .long x00001
18 004c 40000000 > .long x00001y
18 0050 30303030 > .string "00001"
18 3100
18 0056 78303030 > .string "x00001"
18 303100
18 005d 30303030 > .string "00001y"
18 317900
18 0064 78303030 > .string "x00001y"
18 30317900
18 006c A1860100 > .long 100001
18 0070 0A000000 > .long 000012
ARM GAS a.s page 2
18 0074 4C420F00 > .long 1000012
19 xxx
19 > x00002:
19 >
19 0078 0000A0E1 > nop
19 > x00002y:
19 >
19 007c 02000000 > .long 00002
19 0080 02000000 > .long 00002
19 0084 78000000 > .long x00002
19 0088 7C000000 > .long x00002y
19 008c 30303030 > .string "00002"
19 3200
19 0092 78303030 > .string "x00002"
19 303200
19 0099 30303030 > .string "00002y"
19 327900
19 00a0 78303030 > .string "x00002y"
19 30327900
19 00a8 A2860100 > .long 100002
19 00ac 12000000 > .long 000022
19 00b0 56420F00 > .long 1000022
ARM GAS a.s page 3
DEFINED SYMBOLS
a.s:17 .text:00000000 x00000
a.s:17 .text:00000004 x00000y
a.s:18 .text:0000003c x00001
a.s:18 .text:00000040 x00001y
a.s:19 .text:00000078 x00002
a.s:19 .text:0000007c x00002y
NO UNDEFINED SYMBOLS