diff options
author | Nick Clifton <nickc@redhat.com> | 1999-06-17 02:13:18 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 1999-06-17 02:13:18 +0000 |
commit | 0f94f4c86713deaeb50b72807d88c79849a690e1 (patch) | |
tree | 3bd2a98f4ae947deebaf12892b313adff91cf5a2 /gas/config/tc-d10v.c | |
parent | df75f1af9c34ff86ef6b18e9f7b5ed81bd4cb21f (diff) | |
download | gdb-0f94f4c86713deaeb50b72807d88c79849a690e1.zip gdb-0f94f4c86713deaeb50b72807d88c79849a690e1.tar.gz gdb-0f94f4c86713deaeb50b72807d88c79849a690e1.tar.bz2 |
Detect illegal use of hash symbols in assembler mnemonics.
Diffstat (limited to 'gas/config/tc-d10v.c')
-rw-r--r-- | gas/config/tc-d10v.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index bb8ace8..6080258 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -63,6 +63,8 @@ typedef struct _fixups static Fixups FixUps[2]; static Fixups *fixups; +static int do_not_ignore_hash = 0; + /* True if instruction swapping warnings should be inhibited. */ static unsigned char flag_warn_suppress_instructionswap; /* --nowarnswap */ @@ -393,7 +395,8 @@ get_operands (exp) char *p = input_line_pointer; int numops = 0; int post = 0; - + int uses_at = 0; + while (*p) { while (*p == ' ' || *p == '\t' || *p == ',') @@ -403,6 +406,8 @@ get_operands (exp) if (*p == '@') { + uses_at = 1; + p++; exp[numops].X_op = O_absent; if (*p == '(') @@ -437,7 +442,20 @@ get_operands (exp) if (!register_name (&exp[numops])) { /* parse as an expression */ - expression (&exp[numops]); + if (uses_at) + { + /* Any expression that involves the indirect addressing + cannot also involve immediate addressing. Therefore + the use of the hash character is illegal. */ + int save = do_not_ignore_hash; + do_not_ignore_hash = 1; + + expression (&exp[numops]); + + do_not_ignore_hash = save; + } + else + expression (&exp[numops]); } if (strncasecmp (input_line_pointer, "@word", 5) == 0) @@ -1595,7 +1613,7 @@ void md_operand (expressionP) expressionS *expressionP; { - if (*input_line_pointer == '#') + if (*input_line_pointer == '#' && ! do_not_ignore_hash) { input_line_pointer++; expression (expressionP); |