From 9497f5ac6bc10bdd65ea471787619bde1edca77d Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 11 Oct 2005 11:16:17 +0000 Subject: 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. --- gas/config/tc-arc.c | 2 +- gas/config/tc-ia64.h | 2 +- gas/config/tc-m32r.c | 9 ++++++--- gas/config/tc-m32r.h | 6 +++--- gas/config/tc-mips.c | 3 +-- gas/config/tc-mmix.h | 2 +- gas/config/tc-mn10300.c | 7 ++++--- gas/config/tc-mn10300.h | 7 ++++--- gas/config/tc-ppc.h | 2 +- gas/config/tc-sh.c | 9 ++++++--- gas/config/tc-sh.h | 7 ++++--- gas/config/tc-sh64.c | 9 +++++---- gas/config/tc-sh64.h | 9 +++++---- gas/config/tc-tic54x.h | 2 +- 14 files changed, 43 insertions(+), 33 deletions(-) (limited to 'gas/config') diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 0dd0ac7..b33256f 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -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); diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h index f322fbf..c17494b 100644 --- a/gas/config/tc-ia64.h +++ b/gas/config/tc-ia64.h @@ -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) diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index 54452c5..51b160a 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -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); diff --git a/gas/config/tc-m32r.h b/gas/config/tc-m32r.h index eb03495..69fe945 100644 --- a/gas/config/tc-m32r.h +++ b/gas/config/tc-m32r.h @@ -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. */ diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 2ce3415..6e06105 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -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; diff --git a/gas/config/tc-mmix.h b/gas/config/tc-mmix.h index f755995..61bc881 100644 --- a/gas/config/tc-mmix.h +++ b/gas/config/tc-mmix.h @@ -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]) \ diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 8849d1c..963b1b6 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -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); diff --git a/gas/config/tc-mn10300.h b/gas/config/tc-mn10300.h index ad41df4..dff663d 100644 --- a/gas/config/tc-mn10300.h +++ b/gas/config/tc-mn10300.h @@ -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)) diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index 7b6126a..f7c2da6 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -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) diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 0b294e0..acf62ae 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -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); diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h index 69b82b2..a812036 100644 --- a/gas/config/tc-sh.h +++ b/gas/config/tc-sh.h @@ -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)) diff --git a/gas/config/tc-sh64.c b/gas/config/tc-sh64.c index 7964579..7433061 100644 --- a/gas/config/tc-sh64.c +++ b/gas/config/tc-sh64.c @@ -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 diff --git a/gas/config/tc-sh64.h b/gas/config/tc-sh64.h index 8af9b95..21f5d59 100644 --- a/gas/config/tc-sh64.h +++ b/gas/config/tc-sh64.h @@ -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 diff --git a/gas/config/tc-tic54x.h b/gas/config/tc-tic54x.h index 4d9b2c8..7476500 100644 --- a/gas/config/tc-tic54x.h +++ b/gas/config/tc-tic54x.h @@ -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); -- cgit v1.1