[4/5] gas: introduce deferred expression evaluation mode latching dot
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
Deferring expression evaluation is often necessary. However, the value
current_location() records typically is intended to represent the
location at the point of use of the expression, with the main exception
being .eqv (or its == equivalent).
Introduce a predicate to cover both "deferred" modes, and use it
everywhere except in current_location().
@@ -2335,13 +2335,13 @@ m32r_parse_name (char const *name,
/* If we have an absolute symbol or a
reg, then we know its value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
- if (mode != expr_defer && segment == absolute_section)
+ if (!expr_defer_p (mode) && 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 (mode != expr_defer && segment == reg_section)
+ else if (!expr_defer_p (mode) && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
@@ -6908,13 +6908,13 @@ metag_parse_name (char const * name, exp
/* If we have an absolute symbol or a
reg, then we know its value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
- if (mode != expr_defer && segment == absolute_section)
+ if (!expr_defer_p (mode) && 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 (mode != expr_defer && segment == reg_section)
+ else if (!expr_defer_p (mode) && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
@@ -2478,13 +2478,13 @@ mn10300_parse_name (char const *name,
/* If we have an absolute symbol or a reg,
then we know its value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
- if (mode != expr_defer && segment == absolute_section)
+ if (!expr_defer_p (mode) && 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 (mode != expr_defer && segment == reg_section)
+ else if (!expr_defer_p (mode) && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
@@ -902,7 +902,7 @@ ppc_parse_name (const char *name, expres
/* If we have an absolute symbol or a reg, then we know its value
now. Copy the symbol value expression to propagate X_md. */
bool done = false;
- if (mode != expr_defer
+ if (!expr_defer_p (mode)
&& !S_FORCE_RELOC (sym, 0))
{
segT segment = S_GET_SEGMENT (sym);
@@ -3933,13 +3933,13 @@ sh_parse_name (char const *name,
/* If we have an absolute symbol or a reg, then we know its
value now. */
segment = S_GET_SEGMENT (exprP->X_add_symbol);
- if (mode != expr_defer && segment == absolute_section)
+ if (!expr_defer_p (mode) && 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 (mode != expr_defer && segment == reg_section)
+ else if (!expr_defer_p (mode) && segment == reg_section)
{
exprP->X_op = O_register;
exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
@@ -1387,14 +1387,14 @@ operand (expressionS *expressionP, enum
/* If we have an absolute symbol or a reg, then we know its
value now. */
segment = S_GET_SEGMENT (symbolP);
- if (mode != expr_defer
+ if (!expr_defer_p (mode)
&& segment == absolute_section
&& !S_FORCE_RELOC (symbolP, 0))
{
expressionP->X_op = O_constant;
expressionP->X_add_number = S_GET_VALUE (symbolP);
}
- else if (mode != expr_defer && segment == reg_section)
+ else if (!expr_defer_p (mode) && segment == reg_section)
{
expressionP->X_op = O_register;
expressionP->X_add_number = S_GET_VALUE (symbolP);
@@ -1438,7 +1438,7 @@ operand (expressionS *expressionP, enum
if (expressionP->X_add_symbol)
symbol_mark_used (expressionP->X_add_symbol);
- if (mode != expr_defer)
+ if (!expr_defer_p (mode))
{
expressionP->X_add_symbol
= symbol_clone_if_forward_ref (expressionP->X_add_symbol);
@@ -1933,7 +1933,7 @@ expr (int rankarg, /* Larger # is highe
is_unsigned = resultP->X_unsigned && right.X_unsigned;
- if (mode == expr_defer
+ if (expr_defer_p (mode)
&& ((resultP->X_add_symbol != NULL
&& S_IS_FORWARD_REF (resultP->X_add_symbol))
|| (right.X_add_symbol != NULL
@@ -153,9 +153,12 @@ enum expr_mode
{
expr_evaluate,
expr_normal,
- expr_defer
+ expr_defer,
+ expr_defer_latch_dot,
};
+#define expr_defer_p(m) ((m) >= expr_defer)
+
/* "result" should be type (expressionS *). */
#define expression(result) expr (0, result, expr_normal)
#define expression_and_evaluate(result) expr (0, result, expr_evaluate)