This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Treatment of \@ on ARM
- From: Mark Shinwell <shinwell at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Sat, 05 May 2007 13:10:22 +0100
- Subject: [PATCH] Treatment of \@ on ARM
When assembling for ARM targets, @ is the comment character. This
currently causes \@ to fail to be handled correctly; the problem is
fixed by this evil little patch. As far as I can see, this is the most
straightforward and least ugly way of treating this expansion correctly.
Tested with cross to arm-none-linux-gnueabi. OK to apply?
Mark
--
2007-05-05 Mark Shinwell <shinwell@codesourcery.com>
gas/
* app.c (do_scrub_chars): Don't damage \@ pseudo-variables.
gas/testsuite/
* gas/arm/backslash-at.d: New.
* gas/arm/backslash-at.s: New.
Index: gas/app.c
===================================================================
RCS file: /cvs/src/src/gas/app.c,v
retrieving revision 1.39
diff -U3 -p -r1.39 app.c
--- gas/app.c 15 Mar 2007 14:58:05 -0000 1.39
+++ gas/app.c 5 May 2007 12:06:23 -0000
@@ -1219,6 +1219,15 @@ do_scrub_chars (int (*get) (char *, int)
if ((symver_state != NULL) && (*symver_state == 0))
goto de_fault;
#endif
+
+#ifdef TC_ARM
+ /* For the ARM, care is needed not to damage occurrences of \@
+ by stripping the @ onwards. Yuck. */
+ if (to > tostart && *(to - 1) == '\\')
+ /* Do not treat the @ as a start-of-comment. */
+ goto de_fault;
+#endif
+
#ifdef WARN_COMMENTS
if (!found_comment)
as_where (&found_comment_file, &found_comment);
Index: gas/testsuite/gas/arm/backslash-at.d
===================================================================
RCS file: gas/testsuite/gas/arm/backslash-at.d
diff -N gas/testsuite/gas/arm/backslash-at.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/backslash-at.d 5 May 2007 12:06:23 -0000
@@ -0,0 +1,16 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: Backslash-at for ARM
+
+.*: file format .*arm.*
+
+Disassembly of section .text:
+00000000 <.text> 615c .short 0x615c
+00000002 <foo> e3a00000 mov r0, #0 ; 0x0
+00000006 <foo\+0x4> e3a00000 mov r0, #0 ; 0x0
+0000000a <foo\+0x8> e3a00000 mov r0, #0 ; 0x0
+0000000e <foo\+0xc> e3a00001 mov r0, #1 ; 0x1
+00000012 <foo\+0x10> e3a00001 mov r0, #1 ; 0x1
+00000016 <foo\+0x14> e3a00001 mov r0, #1 ; 0x1
+0000001a <foo\+0x18> e3a00002 mov r0, #2 ; 0x2
+0000001e <foo\+0x1c> e3a00002 mov r0, #2 ; 0x2
+00000022 <foo\+0x20> e3a00002 mov r0, #2 ; 0x2
Index: gas/testsuite/gas/arm/backslash-at.s
===================================================================
RCS file: gas/testsuite/gas/arm/backslash-at.s
diff -N gas/testsuite/gas/arm/backslash-at.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/arm/backslash-at.s 5 May 2007 12:06:23 -0000
@@ -0,0 +1,16 @@
+@ Check that \@ is not destroyed when assembling for the ARM.
+
+.macro bar
+ mov r0, #\@
+ mov r0, #\@@comment
+ mov r0, #\@ @comment
+.endm
+
+.byte '\\
+.byte '\a
+
+foo:
+ bar
+ bar
+ bar
+