This is the mail archive of the binutils@sourceware.org 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]

[PATCH] Disallow SYM = EXPR in bfin gas


Since Blackfin assembly uses equal sign '=' in almost all
instructions, without disabling SYM = EXPR, we cannot easily give good
diagnostic information if user has a typo in register name at the left
of '='. For example, user may want to write:

r0.l = 0x8000;

But write

r0.1 = 0x8000;

which would be a legal symbol assignment without this patch. Thus it
will be silently accepted without any error.

I have installed this patch to disable SYM = EXPR in bfin gas. So if
you want to set value to symbol, you have to use .set directive in
Blackfin assembly file.

Jie

	* config/bfin-defs.h (bfin_equals): Remove declaration.
	* config/bfin-parse.y (asm_1): Remove "expr ASSIGN expr".
	* config/tc-bfin.c (bfin_name_is_register): Remove.
	(bfin_equals): Remove.
	* config/tc-bfin.h (TC_EQUAL_IN_INSN): Redefine as 1.
	(bfin_name_is_register): Remove declaration.


Index: config/bfin-defs.h
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-defs.h,v
retrieving revision 1.3
diff -u -p -r1.3 bfin-defs.h
--- config/bfin-defs.h	26 Mar 2006 01:12:07 -0000	1.3
+++ config/bfin-defs.h	23 May 2006 04:20:09 -0000
@@ -374,7 +374,6 @@ void semantic_error_2 (char *syntax);
 
 EXPR_T mkexpr (int, SYMBOL_T);
 
-extern void bfin_equals (Expr_Node *sym);
 /* Defined in bfin-lex.l.  */
 void set_start_state (void);
 
Index: config/bfin-parse.y
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-parse.y,v
retrieving revision 1.5
diff -u -p -r1.5 bfin-parse.y
--- config/bfin-parse.y	26 Mar 2006 01:12:07 -0000	1.5
+++ config/bfin-parse.y	23 May 2006 04:20:09 -0000
@@ -3223,16 +3223,6 @@ asm_1:   
 	}
 
 
-
-/* Expression Assignment.  */
-
-	| expr ASSIGN expr
-	{
-	  bfin_equals ($1);
-	  $$ = 0;
-	}
-
-
 /*  PushPopMultiple.  */
 	| reg_with_predec ASSIGN LPAREN REG COLON expr COMMA REG COLON expr RPAREN
 	{
Index: config/tc-bfin.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-bfin.c,v
retrieving revision 1.6
diff -u -p -r1.6 tc-bfin.c
--- config/tc-bfin.c	23 Apr 2006 22:12:43 -0000	1.6
+++ config/tc-bfin.c	23 May 2006 04:20:10 -0000
@@ -1969,42 +1969,6 @@ bfin_eol_in_insn (char *line)
 }
 
 bfd_boolean
-bfin_name_is_register (char *name)
-{
-  int i;
-
-  if (*name == '[' || *name == '(')
-    return TRUE;
-
-  if ((name[0] == 'W' || name[0] == 'w') && name[1] == '[')
-    return TRUE;
-
-  if ((name[0] == 'B' || name[0] == 'b') && name[1] == '[')
-    return TRUE;
-
-  for (i=0; bfin_reg_info[i].name != 0; i++)
-   {
-     if (!strcasecmp (bfin_reg_info[i].name, name))
-       return TRUE;
-   }
-  return FALSE;
-}
-
-void
-bfin_equals (Expr_Node *sym)
-{
-  char *c;
-
-  c = input_line_pointer;
-  while (*c != '=')
-   c--;
-
-  input_line_pointer = c;
-
-  equals ((char *) sym->value.s_value, 1);
-}
-
-bfd_boolean
 bfin_start_label (char *ptr)
 {
   ptr--;

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