[2/2] gas: switch convert_to_bignum() to taking just an expression
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
Both callers, despite spelling things differently, now pass the same
input for its 2nd parameter. Therefore, as was supposed to be the case
anyway, this 2nd parameter isn't needed anymore - the function can
calculate "sign" all by itself from the incoming expression. Instead
make the function return the resulting value, for emit_expr_with_reloc()
to consume for setting its "extra_digit" local variable.
@@ -1456,14 +1456,15 @@ read_a_source_file (const char *name)
#endif
}
-/* Convert O_constant expression EXP into the equivalent O_big representation.
- Take the sign of the number from SIGN rather than X_add_number. */
+/* Convert O_constant expression EXP into the equivalent O_big
+ representation. */
-static void
-convert_to_bignum (expressionS *exp, int sign)
+static bool
+convert_to_bignum (expressionS *exp)
{
valueT value;
unsigned int i;
+ bool sign = !exp->X_unsigned && exp->X_extrabit;
value = exp->X_add_number;
for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++)
@@ -1478,6 +1479,8 @@ convert_to_bignum (expressionS *exp, int
exp->X_op = O_big;
exp->X_add_number = i;
exp->X_unsigned = !sign;
+
+ return sign;
}
/* For most MRI pseudo-ops, the line actually ends at the first
@@ -4647,8 +4650,7 @@ emit_expr_with_reloc (expressionS *exp,
pass to md_number_to_chars, handle it as a bignum. */
if (op == O_constant && nbytes > sizeof (valueT))
{
- extra_digit = exp->X_unsigned ? 0 : -exp->X_extrabit;
- convert_to_bignum (exp, -extra_digit);
+ extra_digit = -convert_to_bignum (exp);
op = O_big;
}
@@ -5374,7 +5376,7 @@ emit_leb128_expr (expressionS *exp, int
/* We're outputting a signed leb128 and the sign of X_add_number
doesn't reflect the sign of the original value. Convert EXP
to a correctly-extended bignum instead. */
- convert_to_bignum (exp, !exp->X_unsigned && exp->X_extrabit);
+ convert_to_bignum (exp);
op = O_big;
}