This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Check for valid label


On Tue, Apr 22, 2003 at 06:07:42PM +0100, Nick Clifton wrote:
> Hi H.J.
> 
> > On ia64, we can have
> > 
> > (p7) hint @pause
> > 
> > But gas won't take it:
> > 
> > #  as -o f.o f.s  
> > f.s: Assembler messages:
> > f.s:1: Error: Unknown opcode `hint at pause'
> > 
> > The problem is gas first treats "(p7)" as a label and then thinks it is
> > an opcode since it doesn't have a ":'. Later "hint @pause" is taken as
> > an operand and the white space before '@' gets removed. This patch
> > checks if the first char is a valid label char before treating it as
> > the start of a label.
> 
> The patch is OK, (although it could make use of the IS_SYMBOL_COMPONENT
> macro, and it ought to fix up the formatting of the comment as well),
> but it does not really solve the problem.  Try assembling this source
> file:
> 
>  (p7) hint @pause
> ^
> |
>  - note the space before the (p7)
> 

How about this patch?


H.J.
---
gas/

2003-04-22  H.J. Lu <hjl at gnu dot org>

	* app.c (do_scrub_chars): More check for valid label.

gas/testsuite/

2003-04-22  H.J. Lu <hjl at gnu dot org>

	* gas/ia64/opc-i.s: Add testcases for valid label.
	* gas/ia64/opc-i.d: Updated.

--- gas/app.c.label	2003-04-22 11:16:22.000000000 -0700
+++ gas/app.c	2003-04-22 10:55:29.000000000 -0700
@@ -1302,7 +1302,8 @@ do_scrub_chars (get, tostart, tolen)
 	    }
 	  else if (state == 1)
 	    {
-	      state = 2;	/* Ditto */
+	      if (IS_SYMBOL_COMPONENT (ch))
+		state = 2;	/* Ditto */
 	    }
 	  else if (state == 9)
 	    {
--- gas/testsuite/gas/ia64/opc-i.d.label	2002-12-05 09:10:13.000000000 -0800
+++ gas/testsuite/gas/ia64/opc-i.d	2003-04-22 11:14:24.000000000 -0700
@@ -246,6 +246,18 @@ Disassembly of section \.text:
  a70:	00 00 00 80 01 00 	\[MII\]       hint\.m 0x0
  a76:	00 00 00 03 00 00 	            hint\.i 0x0
  a7c:	00 00 06 00       	            hint\.i 0x0
- a80:	0d 00 00 00 01 00 	\[MFI\]       nop\.m 0x0
- a86:	00 00 00 02 00 e0 	            nop\.f 0x0
- a8c:	ff ff 07 08       	            hint\.i 0x1fffff;;
+ a80:	00 00 00 00 01 00 	\[MII\]       nop\.m 0x0
+ a86:	f0 ff ff 03 84 03 	            hint\.i 0x1fffff
+ a8c:	00 00 06 00       	      \(p07\) hint\.i 0x0
+ a90:	00 00 00 00 01 c0 	\[MII\]       nop\.m 0x0
+ a96:	01 00 00 03 80 03 	      \(p07\) hint\.i 0x0
+ a9c:	00 00 06 00       	      \(p07\) hint\.i 0x0
+ aa0:	00 00 00 00 01 c0 	\[MII\]       nop\.m 0x0
+ aa6:	f1 ff ff 03 84 03 	      \(p07\) hint\.i 0x1fffff
+ aac:	00 00 06 00       	      \(p07\) hint\.i 0x0
+ ab0:	00 00 00 00 01 c0 	\[MII\]       nop\.m 0x0
+ ab6:	01 00 00 03 80 03 	      \(p07\) hint\.i 0x0
+ abc:	00 00 06 00       	      \(p07\) hint\.i 0x0
+ ac0:	0d 00 00 00 01 00 	\[MFI\]       nop\.m 0x0
+ ac6:	00 00 00 02 80 e3 	            nop\.f 0x0
+ acc:	ff ff 07 08       	      \(p07\) hint\.i 0x1fffff;;
--- gas/testsuite/gas/ia64/opc-i.s.label	2002-12-05 09:10:13.000000000 -0800
+++ gas/testsuite/gas/ia64/opc-i.s	2003-04-22 10:57:19.000000000 -0700
@@ -212,3 +212,11 @@ _start:
 	hint.i 0
 	hint.i @pause
 	hint.i 0x1fffff
+(p7)	hint @pause
+(p7)	hint.i 0
+(p7)	hint.i @pause
+(p7)	hint.i 0x1fffff
+ (p7)	hint @pause
+ (p7)	hint.i 0
+ (p7)	hint.i @pause
+ (p7)	hint.i 0x1fffff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]