Document .req directive

Improve error message when unrecognised register name is encountered.
This commit is contained in:
Nick Clifton
1998-08-12 17:32:39 +00:00
parent 78a1a4f74e
commit 80522b7d5b
2 changed files with 59 additions and 49 deletions

View File

@ -4,6 +4,14 @@ Wed Aug 12 13:25:03 1998 Alan Modra <alan@spri.levels.unisa.edu.au>
prefixes. prefixes.
(i386_operand): Fix an error message. (i386_operand): Fix an error message.
Tue Aug 11 14:44:32 1998 Nick Clifton <nickc@cygnus.com>
* doc/c-arm.texi (ARM Directives): Document .req directive.
* config/tc-arm.c (reg_required_here): Display erroneous string if
the register name could not be decoded.
Do not set inst.instruction if the sift is -1.
Mon Aug 10 15:39:56 1998 Richard Henderson <rth@cygnus.com> Mon Aug 10 15:39:56 1998 Richard Henderson <rth@cygnus.com>
* config/tc-alpha.c (tc_gen_reloc): Bias WEAK symbols just as * config/tc-alpha.c (tc_gen_reloc): Bias WEAK symbols just as

View File

@ -1338,21 +1338,25 @@ reg_required_here (str, shift)
char **str; char **str;
int shift; int shift;
{ {
static char buff [128]; /* XXX */
int reg; int reg;
char *start = *str; char *start = *str;
if ((reg = arm_reg_parse (str)) != FAIL && int_register (reg)) if ((reg = arm_reg_parse (str)) != FAIL && int_register (reg))
{ {
inst.instruction |= reg << shift; if (shift >= 0)
inst.instruction |= reg << shift;
return reg; return reg;
} }
/* In the few cases where we might be able to accept something else
this error can be overridden */
inst.error = _("Register expected");
/* Restore the start point, we may have got a reg of the wrong class. */ /* Restore the start point, we may have got a reg of the wrong class. */
*str = start; *str = start;
/* In the few cases where we might be able to accept something else
this error can be overridden */
sprintf (buff, _("Register expected, not '%.100s'"), start);
inst.error = buff;
return FAIL; return FAIL;
} }
@ -1564,10 +1568,7 @@ cp_address_required_here (str)
p++; p++;
if ((reg = reg_required_here (&p, 16)) == FAIL) if ((reg = reg_required_here (&p, 16)) == FAIL)
{ return FAIL;
inst.error = _("Register required");
return FAIL;
}
while (*p == ' ') while (*p == ' ')
p++; p++;
@ -2588,10 +2589,7 @@ ldst_extend (str, hwse)
(*str)++; /* and fall through */ (*str)++; /* and fall through */
default: default:
if (reg_required_here (str, 0) == FAIL) if (reg_required_here (str, 0) == FAIL)
{ return FAIL;
inst.error = _("Register expected");
return FAIL;
}
if (hwse) if (hwse)
inst.instruction |= add; inst.instruction |= add;
@ -2640,11 +2638,7 @@ do_ldst (str, flags)
str++; str++;
if ((conflict_reg = reg_required_here (&str, 12)) == FAIL) if ((conflict_reg = reg_required_here (&str, 12)) == FAIL)
{ return;
if (!inst.error)
inst.error = bad_args;
return;
}
if (skip_past_comma (&str) == FAIL) if (skip_past_comma (&str) == FAIL)
{ {
@ -2661,10 +2655,7 @@ do_ldst (str, flags)
str++; str++;
if ((reg = reg_required_here (&str, 16)) == FAIL) if ((reg = reg_required_here (&str, 16)) == FAIL)
{ return;
inst.error = _("Register required");
return;
}
conflict_reg = (((conflict_reg == reg) conflict_reg = (((conflict_reg == reg)
&& (inst.instruction & LOAD_BIT)) && (inst.instruction & LOAD_BIT))
@ -2843,12 +2834,9 @@ reg_list (strp)
while (*str == ' ') while (*str == ' ')
str++; str++;
if ((reg = arm_reg_parse (&str)) == FAIL || !int_register (reg)) if ((reg = reg_required_here (& str, -1)) == FAIL)
{ return FAIL;
inst.error = _("Register expected");
return FAIL;
}
if (in_range) if (in_range)
{ {
int i; int i;
@ -2960,11 +2948,7 @@ do_ldmstm (str, flags)
str++; str++;
if ((base_reg = reg_required_here (&str, 16)) == FAIL) if ((base_reg = reg_required_here (&str, 16)) == FAIL)
{ return;
if (!inst.error)
inst.error = bad_args;
return;
}
if (base_reg == REG_PC) if (base_reg == REG_PC)
{ {
@ -3430,10 +3414,7 @@ do_fp_ldmstm (str, flags)
str++; str++;
if ((reg = reg_required_here (&str, 16)) == FAIL) if ((reg = reg_required_here (&str, 16)) == FAIL)
{ return;
inst.error = _("Register required");
return;
}
while (*str == ' ') while (*str == ' ')
str++; str++;
@ -3666,11 +3647,7 @@ do_fp_to_reg (str, flags)
str++; str++;
if (reg_required_here (&str, 12) == FAIL) if (reg_required_here (&str, 12) == FAIL)
{ return;
if (! inst.error)
inst.error = bad_args;
return;
}
if (skip_past_comma (&str) == FAIL if (skip_past_comma (&str) == FAIL
|| fp_reg_required_here (&str, 0) == FAIL) || fp_reg_required_here (&str, 0) == FAIL)
@ -3699,11 +3676,8 @@ thumb_reg (strp, hi_lo)
{ {
int reg; int reg;
if ((reg = arm_reg_parse (strp)) == FAIL || ! int_register (reg)) if ((reg = reg_required_here (strp, -1)) == FAIL)
{ return FAIL;
inst.error = _("Register expected");
return FAIL;
}
switch (hi_lo) switch (hi_lo)
{ {
@ -6334,10 +6308,14 @@ arm_frob_label (sym)
/* Adjust the symbol table. This marks Thumb symbols as distinct from /* Adjust the symbol table. This marks Thumb symbols as distinct from
ARM ones. */ ARM ones. */
#ifdef OBJ_ELF
#define S_GET_STORAGE_CLASS(S) (elf_symbol ((S)->bsym)->internal_elf_sym.st_other)
#define S_SET_STORAGE_CLASS(S,V) (elf_symbol ((S)->bsym)->internal_elf_sym.st_other = (V))
#endif
void void
arm_adjust_symtab () arm_adjust_symtab ()
{ {
#if defined OBJ_COFF #if defined OBJ_COFF || defined OBJ_ELF
symbolS * sym; symbolS * sym;
for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym))
@ -6370,13 +6348,37 @@ arm_adjust_symtab ()
break; break;
} }
} }
#ifdef OBJ_COFF
if (ARM_IS_INTERWORK (sym)) if (ARM_IS_INTERWORK (sym))
coffsymbol(sym->bsym)->native->u.syment.n_flags = 0xFF; coffsymbol(sym->bsym)->native->u.syment.n_flags = 0xFF;
#endif
} }
#endif #endif
} }
#ifdef OBJ_ELF
void
armelf_frob_symbol (symp, puntp)
symbolS *symp;
int *puntp;
{
elf_frob_symbol (symp, puntp);
if (S_IS_EXTERNAL (symp))
S_SET_STORAGE_CLASS(symp, C_EXT);
if (S_GET_STORAGE_CLASS (symp) == C_NULL)
{
if (S_GET_SEGMENT (symp) == text_section
&& symp != seg_info (text_section)->sym)
S_SET_STORAGE_CLASS (symp, C_LABEL);
else
S_SET_STORAGE_CLASS (symp, C_STAT);
}
}
#endif
int int
arm_data_in_code () arm_data_in_code ()
{ {