From: Jan Beulich Date: Fri, 13 Jun 2025 06:40:01 +0000 (+0200) Subject: gas: switch convert_to_bignum() to taking just an expression X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e284502288b705d1878a0aac29720b6d6e15fb8;p=thirdparty%2Fbinutils-gdb.git gas: switch convert_to_bignum() to taking just an expression 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. --- diff --git a/gas/read.c b/gas/read.c index 1b483d683d5..db9c76270ee 100644 --- a/gas/read.c +++ b/gas/read.c @@ -1437,14 +1437,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++) @@ -1459,6 +1460,8 @@ convert_to_bignum (expressionS *exp, int sign) 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 @@ -4652,8 +4655,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; } @@ -5379,7 +5381,7 @@ emit_leb128_expr (expressionS *exp, int sign) /* 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; }