summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-03-18 21:05:19 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-03-18 21:05:19 +0000
commitc6d288a6bbd3e42cb0fce5241cb636dc826af5df (patch)
treedbd69acbae4aa3f8ee3feb40419a8ef024d53cb2 /gnu
parentbb8422a201456a627f0b4a1ffb03792c86d3df3e (diff)
Backport fix of negative bignums from binutils 2.16:
2004-08-10 Mark Mitchell <mark@codesourcery.com> * expr.c (operand): Handle the "~", "-", and "!" operators applied to bignums. http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/expr.c.diff?cvsroot=src&only\ _with_tag=MAIN&r2=1.52&r1=1.51&f=u Fixes the problem mentioned here: http://llvm.org/bugs/show_bug.cgi?id=6528 ok jsg@, miod@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/binutils/gas/expr.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils/gas/expr.c b/gnu/usr.bin/binutils/gas/expr.c
index 19e3f1c0387..c792a2563f9 100644
--- a/gnu/usr.bin/binutils/gas/expr.c
+++ b/gnu/usr.bin/binutils/gas/expr.c
@@ -1074,6 +1074,35 @@ operand (expressionS *expressionP)
else
generic_floating_point_number.sign = 'N';
}
+ else if (expressionP->X_op == O_big
+ && expressionP->X_add_number > 0)
+ {
+ int i;
+
+ if (c == '~' || c == '-')
+ {
+ for (i = 0; i < expressionP->X_add_number; ++i)
+ generic_bignum[i] = ~generic_bignum[i];
+ if (c == '-')
+ for (i = 0; i < expressionP->X_add_number; ++i)
+ {
+ generic_bignum[i] += 1;
+ if (generic_bignum[i])
+ break;
+ }
+ }
+ else if (c == '!')
+ {
+ int nonzero = 0;
+ for (i = 0; i < expressionP->X_add_number; ++i)
+ {
+ if (generic_bignum[i])
+ nonzero = 1;
+ generic_bignum[i] = 0;
+ }
+ generic_bignum[0] = nonzero;
+ }
+ }
else if (expressionP->X_op != O_illegal
&& expressionP->X_op != O_absent)
{