[PATCH] ARM gas: handle {...} operands in macros

Richard Earnshaw rearnsha@arm.com
Mon Jun 3 15:50:00 GMT 2013


On 28/05/13 20:18, Roland McGrath wrote:
> Here's another case where the presumptions about whitespace stripping don't
> mesh with macros quite right.  There may be more cases affected; I didn't
> try to add test cases for all of them.
>
> OK for trunk and 2.23?
>
>

This seems all wrong to me.  If you're having to pretend that all these 
special characters are symbol characters, then something else must be 
fundamentally wrong.  That makes this patch a crutch for something else 
that's broken.

I think you need to dig further into why macros aren't working properly. 
  Is it the implementation of macros, the documentation, or your 
expectations that are wrong?

R.

> Thanks,
> Roland
>
>
> gas/
> 2013-05-28  Roland McGrath  <mcgrathr@google.com>
>
> 	* config/tc-arm.c (arm_symbol_chars): Include '{' and '}'.
> 	(arm_reg_parse_multi): Skip whitespace first.
>
> gas/testsuite/
> 2013-05-28  Roland McGrath  <mcgrathr@google.com>
>
> 	* gas/arm/macro-pld.s: Add a 'push {r0}' case.
> 	* gas/arm/macro-pld.d: Update expected output.
> 	* gas/arm/macro-vld1.s: New file.
> 	* gas/arm/macro-vld1.d: New file.
>
> --- a/gas/config/tc-arm.c
> +++ b/gas/config/tc-arm.c
> @@ -323,8 +323,9 @@ static bfd_boolean unified_syntax = FALSE;
>
>   /* An immediate operand can start with #, and ld*, st*, pld operands
>      can contain [ and ].  We need to tell APP not to elide whitespace
> -   before a [, which can appear as the first operand for pld.  */
> -const char arm_symbol_chars[] = "#[]";
> +   before a [, which can appear as the first operand for pld.
> +   Likewise, a { can appear as the first operand for push, pop, vld*, etc.  */
> +const char arm_symbol_chars[] = "#[]{}";
>
>   enum neon_el_type
>   {
> @@ -1158,6 +1159,8 @@ arm_reg_parse_multi (char **ccp)
>     char *p;
>     struct reg_entry *reg;
>
> +  skip_whitespace (start);
> +
>   #ifdef REGISTER_PREFIX
>     if (*start != REGISTER_PREFIX)
>       return NULL;
> --- a/gas/testsuite/gas/arm/macro-pld.d
> +++ b/gas/testsuite/gas/arm/macro-pld.d
> @@ -6,3 +6,4 @@ Disassembly of section \.text:
>
>   0+ <.*>:
>   \s*0:\s+f5d0f000\s+pld\s+\[r0\]
> +\s*4:\s+e52d0004\s+push\s+{r0}\s*.*
> --- a/gas/testsuite/gas/arm/macro-pld.s
> +++ b/gas/testsuite/gas/arm/macro-pld.s
> @@ -2,3 +2,4 @@
>   	\rest
>   .endm
>   	foo r0, pld [r0]
> +	foo r0, push {r0}
> --- /dev/null
> +++ b/gas/testsuite/gas/arm/macro-vld1.d
> @@ -0,0 +1,8 @@
> +#objdump: -dr
> +
> +.*:     file format .*
> +
> +Disassembly of section \.text:
> +
> +0+ <.*>:
> +\s*0:\s+f420070f\s+vld1.8\s+{d0},\s*\[r0\]
> --- /dev/null
> +++ b/gas/testsuite/gas/arm/macro-vld1.s
> @@ -0,0 +1,9 @@
> +	.fpu neon
> +        .macro sfi_breg basereg, insn, operands:vararg
> +                .macro _sfi_breg_doit B
> +                \insn \operands
> +                .endm
> +                _sfi_breg_doit \basereg
> +                .purgem _sfi_breg_doit
> +        .endm
> +	sfi_breg r0, vld1.8 {d0}, [\B]
>
>
>




More information about the Binutils mailing list