gas .macro quirks, and an ARM bug

Nick Clifton nickc@cygnus.com
Fri Jun 9 12:13:00 GMT 2000


Hi Ulf,

: Forget my last mail.  I wasn't thinking and things were a bit more
: complicated than I first thought.  This patch can assemble
: 
:         .macro  hello   narg1
:                 .asciiz  "\narg1"
:         .endm
:         hello   " \\\"foo\\\""
: 
: Ulf
: 
: Index: macro.c
: ===================================================================
: RCS file: /cvs/src/src/gas/macro.c,v
: retrieving revision 1.7
: diff -u -p -r1.7 macro.c
: --- macro.c     2000/05/01 14:01:06     1.7
: +++ macro.c     2000/06/08 21:14:23
: @@ -304,13 +304,24 @@ getstring (idx, in, acc)
:        else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'')
:         {
:           char tchar = in->ptr[idx];
: +         int escaped = 0;
:           idx++;
:           while (idx < in->len)
:             {
: +             if (in->ptr[idx-1] == '\\')
: +               escaped ^= 1;
: +             else
: +               escaped = 0;
: +
:               if (macro_alternate && in->ptr[idx] == '!')
:                 {
:                   idx++  ;
:                   sb_add_char (acc, in->ptr[idx++]);
: +               }
: +             else if (escaped && in->ptr[idx] == tchar)
: +               {
: +                 sb_add_char (acc, tchar);
: +                 idx++;
:                 }
:               else
:                 {

OK this looks great.  If you check that in, I will check the following
in to add a test to the testsuite.

Cheers
	Nick

2000-06-09  Nick Clifton  <nickc@cygnus.com>

	* gas/macros/macros.exp: Run new test: strings.
	* gas/macros/strings.s: New test: String expansion inside
	macros.
	* gas/macros/strings.d: New test results.
	

Index: macros.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/testsuite/gas/macros/macros.exp,v
retrieving revision 1.5
diff -p -r1.5 macros.exp
*** macros.exp	2000/04/30 17:48:43	1.5
--- macros.exp	2000/06/09 19:11:25
*************** case $target_triplet in {
*** 38,40 ****
--- 38,42 ----
  	run_dump_test semi
      }
  }
+ 
+ run_dump_test strings


Index: strings.s
===================================================================
RCS file: strings.s
diff -N strings.s
*** /dev/null	Tue May  5 13:32:27 1998
--- strings.s	Fri Jun  9 12:11:25 2000
***************
*** 0 ****
--- 1,17 ----
+ .macro M arg1
+ 	.ascii	"\arg1"
+ .endm
+ 
+ 	.data
+ foo:
+ 	M "\\\"foo\\\""
+ 
+ 	.balign 2
+ 
+ 	M "bar"
+ 
+ 	.balign 2
+ 
+ 	M baz
+ 
+ 

Index: strings.d
===================================================================
RCS file: strings.d
diff -N strings.d
*** /dev/null	Tue May  5 13:32:27 1998
--- strings.d	Fri Jun  9 12:11:25 2000
***************
*** 0 ****
--- 1,8 ----
+ #objdump: -s -j .data
+ #name: strings
+ 
+ .*: .*
+ 
+ Contents of section .data:
+  0000 5c22666f 6f5c2200 62617200 62617a    \\"foo\\".bar.baz 
+ 


More information about the Binutils mailing list