public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: gas macro handling broken in 2.16.91.0.1
@ 2005-06-27 11:09 Jan Beulich
  2005-06-27 11:12 ` Olaf Hering
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-06-27 11:09 UTC (permalink / raw)
  To: Zack Weinberg, Olaf Hering; +Cc: binutils

This is caused by now scrubbing the output of a macro expansion (http://sourceware.org/ml/binutils/2005-05/msg00561.html), which results in macro arguments separated by spaces (rather than commas, and in a macro expansion) where the first argument finishes with a symbol and the second doesn't start with one to be concatenated. In my opinion, the root cause here is the failure of tc-ppc.c to include % in the symbol characters (hence % followed by a register name isn't treated as a symbol, but rather as an operator followed by a symbol); similar i386 code works well because % there specifically is a symbol character.

However (and that's why I included Zack here), it would seem to me that this sort of backward incompatibility shouldn't happen, and hence I would think that the above mentioned patch may need some additional adjustment (perhaps not removing spaces when scrubbing macro results). This space removal (even when applied to original source code) always seemed at least odd to me, especially in macro contexts (and without this change in behavior), where I occasionally saw vital whitespace being eaten (and had to work around that).

Jan

>>> Olaf Hering <olh@suse.de> 25.06.05 00:17:45 >>>

I get syntax errors with current mainline cvs, this worked with
binutils-2.16.90.0.3 

example from rpm4:

as --gdwarf2 -a32 -K PIC -mppc -many -V -Qy -o test.o test.s
GNU assembler version 2.16.91.0.1 (powerpc-suse-linux) using BFD version 2.16.91.0.1 20050622 (SuSE Linux)
test.s: Assembler messages:
test.s:99: Error: bad expression
test.s:99: Error: syntax error; found `



 .file "test.S"

 .text
 .macro sxrk rk src
 lwz %r24, 0(\src)
 .endm

 .macro etfs rk offset
 lwz %r28,\offset+ 0(\rk)
 .endm

 .macro esft rk offset
 .endm

 .macro elr rk
 lwz %r24, 0(\rk)
 .endm

 .macro eblock rk src label
 sxrk \rk \src

 etfs \rk 16
 esft \rk 32
 etfs \rk 48
 esft \rk 64
 etfs \rk 80
 esft \rk 96
 etfs \rk 112
 esft \rk 128
 etfs \rk 144

 lwz %r11,256(\rk)
 cmpwi %r11,10
 beq \label

 esft \rk 160
 etfs \rk 176

 cmpwi %r11,12
 beq \label

 esft \rk 192
 etfs \rk 208

\label:
 slwi %r11,%r11,4
 add \rk,\rk,%r11

 elr \rk
 .endm

 .macro dtfs rk offset
 lwz %r28,\offset+ 0(\rk)
 .endm

 .macro dsft rk offset
 lwz %r24,\offset+ 0(\rk)
 .endm

 .macro dlr rk
 lwz %r24, 0(\rk)
 .endm

 .macro dblock rk src label
 sxrk \rk \src

 dtfs \rk 16
 dsft \rk 32
 dtfs \rk 48
 dsft \rk 64
 dtfs \rk 80
 dsft \rk 96
 dtfs \rk 112
 dsft \rk 128
 dtfs \rk 144

 lwz %r11,256(\rk)
 cmpwi %r11,10
 beq \label

 dsft \rk 160
 dtfs \rk 176

 cmpwi %r11,12
 beq \label

 dsft \rk 192
 dtfs \rk 208

\label:
 slwi %r11,%r11,4
 add \rk,\rk,%r11

 dlr \rk
 .endm

.align 8; .global aesEncrypt
aesEncrypt:
 eblock rk=%r3 src=%r5 label=.L00
.LaesEncrypt_size: .size aesEncrypt, .LaesEncrypt_size - aesEncrypt;


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

* Re: gas macro handling broken in 2.16.91.0.1
  2005-06-27 11:09 gas macro handling broken in 2.16.91.0.1 Jan Beulich
@ 2005-06-27 11:12 ` Olaf Hering
  2005-08-23  6:20   ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2005-06-27 11:12 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Zack Weinberg, binutils

 On Mon, Jun 27, Jan Beulich wrote:

> This is caused by now scrubbing the output of a macro expansion (http://sourceware.org/ml/binutils/2005-05/msg00561.html), which results in macro arguments separated by spaces (rather than commas, and in a macro expansion) where the first argument finishes with a symbol and the second doesn't start with one to be concatenated. In my opinion, the root cause here is the failure of tc-ppc.c to include % in the symbol characters (hence % followed by a register name isn't treated as a symbol, but rather as an operator followed by a symbol); similar i386 code works well because % there specifically is a symbol character.

Thanks for looking.  I filed a bug already.

http://sources.redhat.com/bugzilla/show_bug.cgi?id=1036

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

* Re: gas macro handling broken in 2.16.91.0.1
  2005-06-27 11:12 ` Olaf Hering
@ 2005-08-23  6:20   ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2005-08-23  6:20 UTC (permalink / raw)
  To: Olaf Hering; +Cc: binutils

On Mon, Jun 27, 2005 at 01:12:14PM +0200, Olaf Hering wrote:
>  On Mon, Jun 27, Jan Beulich wrote:
> > This is caused by now scrubbing the output of a macro expansion
> > (http://sourceware.org/ml/binutils/2005-05/msg00561.html), which
> > results in macro arguments separated by spaces (rather than commas,
> > and in a macro expansion) where the first argument finishes with a
> > symbol and the second doesn't start with one to be concatenated. In
> > my opinion, the root cause here is the failure of tc-ppc.c to
> > include % in the symbol characters (hence % followed by a register
> > name isn't treated as a symbol, but rather as an operator followed
> > by a symbol); similar i386 code works well because % there
> > specifically is a symbol character. 

I'd say the root cause is the fact that the scrubber eats white space
completely, but fixing that requires checking that all targets will
strip a single space before each operand..

So for now, use the tc_symbol_chars hack.  I added '[' too, for PE
toc entry parsing.

	PR 1036
	* config/tc-ppc.c (ppc_symbol_chars): Add '%' and '['.

Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.105
diff -u -p -r1.105 tc-ppc.c
--- gas/config/tc-ppc.c	16 Aug 2005 03:17:53 -0000	1.105
+++ gas/config/tc-ppc.c	23 Aug 2005 05:58:02 -0000
@@ -184,8 +184,10 @@ const char EXP_CHARS[] = "eE";
 const char FLT_CHARS[] = "dD";
 
 /* '+' and '-' can be used as postfix predicate predictors for conditional
-   branches.  So they need to be accepted as symbol characters.  */
-const char ppc_symbol_chars[] = "+-";
+   branches.  So they need to be accepted as symbol characters.
+   Also, anything that can start an operand needs to be mentioned here,
+   to stop the input scrubber eating whitespace.  */
+const char ppc_symbol_chars[] = "+-%[";
 
 /* The dwarf2 data alignment, adjusted for 32 or 64 bit.  */
 int ppc_cie_data_alignment;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

* gas macro handling broken in 2.16.91.0.1
@ 2005-06-24 22:17 Olaf Hering
  0 siblings, 0 replies; 4+ messages in thread
From: Olaf Hering @ 2005-06-24 22:17 UTC (permalink / raw)
  To: binutils


I get syntax errors with current mainline cvs, this worked with
binutils-2.16.90.0.3 

example from rpm4:

as --gdwarf2 -a32 -K PIC -mppc -many -V -Qy -o test.o test.s
GNU assembler version 2.16.91.0.1 (powerpc-suse-linux) using BFD version 2.16.91.0.1 20050622 (SuSE Linux)
test.s: Assembler messages:
test.s:99: Error: bad expression
test.s:99: Error: syntax error; found `



 .file "test.S"

 .text
 .macro sxrk rk src
 lwz %r24, 0(\src)
 .endm

 .macro etfs rk offset
 lwz %r28,\offset+ 0(\rk)
 .endm

 .macro esft rk offset
 .endm

 .macro elr rk
 lwz %r24, 0(\rk)
 .endm

 .macro eblock rk src label
 sxrk \rk \src

 etfs \rk 16
 esft \rk 32
 etfs \rk 48
 esft \rk 64
 etfs \rk 80
 esft \rk 96
 etfs \rk 112
 esft \rk 128
 etfs \rk 144

 lwz %r11,256(\rk)
 cmpwi %r11,10
 beq \label

 esft \rk 160
 etfs \rk 176

 cmpwi %r11,12
 beq \label

 esft \rk 192
 etfs \rk 208

\label:
 slwi %r11,%r11,4
 add \rk,\rk,%r11

 elr \rk
 .endm

 .macro dtfs rk offset
 lwz %r28,\offset+ 0(\rk)
 .endm

 .macro dsft rk offset
 lwz %r24,\offset+ 0(\rk)
 .endm

 .macro dlr rk
 lwz %r24, 0(\rk)
 .endm

 .macro dblock rk src label
 sxrk \rk \src

 dtfs \rk 16
 dsft \rk 32
 dtfs \rk 48
 dsft \rk 64
 dtfs \rk 80
 dsft \rk 96
 dtfs \rk 112
 dsft \rk 128
 dtfs \rk 144

 lwz %r11,256(\rk)
 cmpwi %r11,10
 beq \label

 dsft \rk 160
 dtfs \rk 176

 cmpwi %r11,12
 beq \label

 dsft \rk 192
 dtfs \rk 208

\label:
 slwi %r11,%r11,4
 add \rk,\rk,%r11

 dlr \rk
 .endm

.align 8; .global aesEncrypt
aesEncrypt:
 eblock rk=%r3 src=%r5 label=.L00
.LaesEncrypt_size: .size aesEncrypt, .LaesEncrypt_size - aesEncrypt;

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

end of thread, other threads:[~2005-08-23  6:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-27 11:09 gas macro handling broken in 2.16.91.0.1 Jan Beulich
2005-06-27 11:12 ` Olaf Hering
2005-08-23  6:20   ` Alan Modra
  -- strict thread matches above, loose matches on Subject: below --
2005-06-24 22:17 Olaf Hering

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).