This adjusts equate handling by

- allowing true forward references (which will always assume the referenced
  symbols have at the point of use) through the new .eqv pseudo-op and the
  new == operator
- disallowing changing .equiv-generated equates (so that the protection this
  provides is both forward and backward)
- snapshotting equates when their value gets changed so that previous uses
  don't get affected by the new value.
- allowing expressions in places where absolute expressions (or register
  names) are needed which were not completely resolvable at the point of
  their definition but which are fully resolvable at the point of use

In addition it fixes PR/288.
This commit is contained in:
Nick Clifton
2005-10-11 11:16:17 +00:00
parent 1334d4d50c
commit 9497f5ac6b
43 changed files with 834 additions and 66 deletions

View File

@ -1214,7 +1214,7 @@ arc_parse_cons_expression (expressionS *exp,
code_symbol_fix = 1;
strcpy (p, "; ");
}
expr (0, exp);
expression_and_evaluate (exp);
if (code_symbol_fix)
{
arc_code_symbol (exp);

View File

@ -129,7 +129,7 @@ extern void ia64_convert_frag (fragS *);
#define tc_frob_symbol(s,p) p |= ia64_frob_symbol (s)
#endif /* TE_HPUX */
#define md_flush_pending_output() ia64_flush_pending_output ()
#define md_parse_name(s,e,c) ia64_parse_name (s, e, c)
#define md_parse_name(s,e,m,c) ia64_parse_name (s, e, c)
#define tc_canonicalize_symbol_name(s) ia64_canonicalize_symbol_name (s)
#define tc_canonicalize_section_name(s) ia64_canonicalize_symbol_name (s)
#define md_optimize_expr(l,o,r) ia64_optimize_expr (l, o, r)

View File

@ -2370,7 +2370,10 @@ m32r_end_of_match (char *cont, char *what)
}
int
m32r_parse_name (char const *name, expressionS *exprP, char *nextcharP)
m32r_parse_name (char const *name,
expressionS *exprP,
enum expr_mode mode,
char *nextcharP)
{
char *next = input_line_pointer;
char *next_end;
@ -2391,13 +2394,13 @@ m32r_parse_name (char const *name, expressionS *exprP, char *nextcharP)
/* If we have an absolute symbol or a
reg, then we know its value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
if (segment == absolute_section)
if (mode != expr_defer && segment == absolute_section)
{
exprP->X_op = O_constant;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
exprP->X_add_symbol = NULL;
}
else if (segment == reg_section)
else if (mode != expr_defer && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);

View File

@ -121,9 +121,9 @@ extern void m32r_flush_pending_output (void);
#define elf_tc_final_processing m32r_elf_final_processing
extern void m32r_elf_final_processing (void);
#define md_parse_name(name, exprP, nextcharP) \
m32r_parse_name ((name), (exprP), (nextcharP))
extern int m32r_parse_name (char const *, expressionS *, char *);
#define md_parse_name(name, exprP, mode, nextcharP) \
m32r_parse_name ((name), (exprP), (mode), (nextcharP))
extern int m32r_parse_name (char const *, expressionS *, enum expr_mode, char *);
/* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
symbols. The relocation type is stored in X_md. */

View File

@ -2312,7 +2312,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
else if (mips_opts.mips16
&& ! ip->use_extend
&& *reloc_type != BFD_RELOC_MIPS16_JMP)
{
{
if ((pinfo & INSN_UNCOND_BRANCH_DELAY) == 0)
/* Make sure there is enough room to swap this instruction with
a following jump instruction. */
@ -8547,7 +8547,6 @@ do_msbd:
s_reset = s;
if (s[0] == '$')
{
if (ISDIGIT (s[1]))
{
++s;

View File

@ -70,7 +70,7 @@ extern char *mmix_current_prefix;
The [DVWIOUZX]_Handler symbols are provided when-used. */
extern int mmix_gnu_syntax;
#define md_parse_name(name, exp, cpos) \
#define md_parse_name(name, exp, mode, cpos) \
(! mmix_gnu_syntax \
&& (name[0] == '@' \
? (! is_part_of_name (name[1]) \

View File

@ -2743,9 +2743,10 @@ mn10300_end_of_match (cont, what)
}
int
mn10300_parse_name (name, exprP, nextcharP)
mn10300_parse_name (name, exprP, mode, nextcharP)
char const *name;
expressionS *exprP;
enum expr_mode mode;
char *nextcharP;
{
char *next = input_line_pointer;
@ -2765,13 +2766,13 @@ mn10300_parse_name (name, exprP, nextcharP)
/* If we have an absolute symbol or a reg,
then we know its value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
if (segment == absolute_section)
if (mode != expr_defer && segment == absolute_section)
{
exprP->X_op = O_constant;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
exprP->X_add_symbol = NULL;
}
else if (segment == reg_section)
else if (mode != expr_defer && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);

View File

@ -36,9 +36,10 @@
&& S_IS_DEFINED ((FIX)->fx_addsy) \
&& ! S_IS_COMMON ((FIX)->fx_addsy))))
#define md_parse_name(name, exprP, nextcharP) \
mn10300_parse_name ((name), (exprP), (nextcharP))
int mn10300_parse_name PARAMS ((char const *, expressionS *, char *));
#define md_parse_name(name, exprP, mode, nextcharP) \
mn10300_parse_name ((name), (exprP), (mode), (nextcharP))
int mn10300_parse_name PARAMS ((char const *, expressionS *,
enum expr_mode, char *));
#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP) \
mn10300_cons_fix_new ((FRAG), (OFF), (LEN), (EXP))

View File

@ -245,7 +245,7 @@ extern int ppc_force_relocation PARAMS ((struct fix *));
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
#define md_parse_name(name, exp, c) ppc_parse_name (name, exp)
#define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp)
extern int ppc_parse_name PARAMS ((const char *, struct expressionS *));
#define md_operand(x)

View File

@ -4295,7 +4295,10 @@ sh_end_of_match (char *cont, char *what)
}
int
sh_parse_name (char const *name, expressionS *exprP, char *nextcharP)
sh_parse_name (char const *name,
expressionS *exprP,
enum expr_mode mode,
char *nextcharP)
{
char *next = input_line_pointer;
char *next_end;
@ -4314,13 +4317,13 @@ sh_parse_name (char const *name, expressionS *exprP, char *nextcharP)
/* If we have an absolute symbol or a reg, then we know its
value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
if (segment == absolute_section)
if (mode != expr_defer && segment == absolute_section)
{
exprP->X_op = O_constant;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
exprP->X_add_symbol = NULL;
}
else if (segment == reg_section)
else if (mode != expr_defer && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);

View File

@ -206,9 +206,10 @@ extern bfd_boolean sh_fix_adjustable (struct fix *);
((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
|| (sh_relax && SWITCH_TABLE (FIX)))
#define md_parse_name(name, exprP, nextcharP) \
sh_parse_name ((name), (exprP), (nextcharP))
int sh_parse_name (char const *name, expressionS *exprP, char *nextchar);
#define md_parse_name(name, exprP, mode, nextcharP) \
sh_parse_name ((name), (exprP), (mode), (nextcharP))
int sh_parse_name (char const *name, expressionS *exprP,
enum expr_mode mode, char *nextchar);
#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP) \
sh_cons_fix_new ((FRAG), (OFF), (LEN), (EXP))

View File

@ -3244,8 +3244,9 @@ sh64_frob_label (symbolS *symp)
symbol hook. */
int
sh64_consume_datalabel (const char *name, expressionS *exp, char *cp,
segT (*operandf) (expressionS *))
sh64_consume_datalabel (const char *name, expressionS *exp,
enum expr_mode mode, char *cp,
segT (*operandf) (expressionS *, enum expr_mode))
{
static int parsing_datalabel = 0;
@ -3258,7 +3259,7 @@ sh64_consume_datalabel (const char *name, expressionS *exp, char *cp,
*input_line_pointer = *cp;
parsing_datalabel = 1;
(*operandf) (exp);
(*operandf) (exp, expr_normal);
parsing_datalabel = save_parsing_datalabel;
if (exp->X_op == O_symbol || exp->X_op == O_PIC_reloc)
@ -3331,7 +3332,7 @@ sh64_consume_datalabel (const char *name, expressionS *exp, char *cp,
return 1;
}
return sh_parse_name (name, exp, cp);
return sh_parse_name (name, exp, mode, cp);
}
/* This function is called just before symbols are being output. It

View File

@ -124,10 +124,11 @@ extern int sh64_target_mach (void);
expression, since we have handled it ourselves. FIXME: What we really
need is a new GAS infrastructure feature: md_qualifier. */
#undef md_parse_name
#define md_parse_name(NAME, EXP, CP) \
sh64_consume_datalabel (NAME, EXP, CP, operand)
extern int sh64_consume_datalabel (const char *, expressionS *, char *,
segT (*) (expressionS *));
#define md_parse_name(NAME, EXP, MODE, CP) \
sh64_consume_datalabel (NAME, EXP, MODE, CP, operand)
extern int sh64_consume_datalabel (const char *, expressionS *,
enum expr_mode, char *,
segT (*) (expressionS *, enum expr_mode));
/* Saying "$" is the same as saying ".". */
#define DOLLAR_DOT

View File

@ -83,7 +83,7 @@ extern void tic54x_number_to_chars (char *, valueT, int);
extern void tic54x_adjust_symtab (void);
#define tc_unrecognized_line(ch) tic54x_unrecognized_line(ch)
extern int tic54x_unrecognized_line (int ch);
#define md_parse_name(s,e,c) tic54x_parse_name(s,e)
#define md_parse_name(s,e,m,c) tic54x_parse_name(s,e)
extern int tic54x_parse_name (char *name, expressionS *e);
#define md_undefined_symbol(s) tic54x_undefined_symbol(s)
extern symbolS *tic54x_undefined_symbol (char *name);