* [PATCH] Disallow SYM = EXPR in bfin gas
@ 2006-05-23 9:13 Jie Zhang
2006-05-23 9:33 ` Jie Zhang
0 siblings, 1 reply; 2+ messages in thread
From: Jie Zhang @ 2006-05-23 9:13 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
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
[-- Attachment #2: bfin-gas-disallow-assign.diff --]
[-- Type: text/x-patch, Size: 2381 bytes --]
* 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--;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Disallow SYM = EXPR in bfin gas
2006-05-23 9:13 [PATCH] Disallow SYM = EXPR in bfin gas Jie Zhang
@ 2006-05-23 9:33 ` Jie Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Jie Zhang @ 2006-05-23 9:33 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 202 bytes --]
Jie Zhang wrote:
> * config/tc-bfin.h (TC_EQUAL_IN_INSN): Redefine as 1.
> (bfin_name_is_register): Remove declaration.
>
This bit was missed in my patch. Here is the new version contains it.
Jie
[-- Attachment #2: bfin-gas-disallow-assign-2.diff --]
[-- Type: text/x-patch, Size: 3212 bytes --]
* 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: config/tc-bfin.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-bfin.h,v
retrieving revision 1.2
diff -u -p -r1.2 tc-bfin.h
--- config/tc-bfin.h 24 Oct 2005 18:35:59 -0000 1.2
+++ config/tc-bfin.h 23 May 2006 04:55:23 -0000
@@ -52,9 +52,9 @@ extern bfd_boolean bfin_start_label PARA
#define TC_EOL_IN_INSN(PTR) (bfin_eol_in_insn(PTR) ? 1 : 0)
extern bfd_boolean bfin_eol_in_insn PARAMS ((char *));
-/* The instruction is permitted to contain an = character. */
-#define TC_EQUAL_IN_INSN(C, NAME) (bfin_name_is_register (NAME) ? 1 : 0)
-extern bfd_boolean bfin_name_is_register PARAMS ((char *));
+/* Almost all instructions of Blackfin contain an = character. */
+#define TC_EQUAL_IN_INSN(C, NAME) 1
+
#define NOP_OPCODE 0x0000
#define LOCAL_LABELS_FB 1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-23 5:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-23 9:13 [PATCH] Disallow SYM = EXPR in bfin gas Jie Zhang
2006-05-23 9:33 ` Jie Zhang
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).