diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2010-03-13 15:54:21 +0000 |
---|---|---|
committer | Segher Boessenkool <segher@kernel.crashing.org> | 2010-03-13 15:54:21 +0000 |
commit | dc86b458e9455f66a3b8d5220a4566a0c6e84ab4 (patch) | |
tree | 0253ba62d66ed97f7d059e35d423d161f892cda1 /gas | |
parent | 1c809c688364f87ba62a4c590b53d1efe0cff64e (diff) | |
download | gdb-dc86b458e9455f66a3b8d5220a4566a0c6e84ab4.zip gdb-dc86b458e9455f66a3b8d5220a4566a0c6e84ab4.tar.gz gdb-dc86b458e9455f66a3b8d5220a4566a0c6e84ab4.tar.bz2 |
2010-03-13 Segher Boessenkool <segher@kernel.crashing.org>
* config/tc-v850.c (v850_insert_operand): Handle out-of-range
assembler constants on 64-bit hosts.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-v850.c | 19 |
2 files changed, 23 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 4ff6ed3..32b0da6 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2010-03-13 Segher Boessenkool <segher@kernel.crashing.org> + + * config/tc-v850.c (v850_insert_operand): Handle out-of-range + assembler constants on 64-bit hosts. + 2010-03-10 Mike Frysinger <michael.frysinger@analog.com> * bfin-defs.h, bfin-lex.l, bfin-parse.y, tc-bfin.c, tc-bfin.h: diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index c6c3439..e0ac162 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -1536,7 +1536,24 @@ v850_insert_operand (unsigned long insn, min = 0; } - if (val < (offsetT) min || val > (offsetT) max) + /* Some people write constants with the sign extension done by + hand but only up to 32 bits. This shouldn't really be valid, + but, to permit this code to assemble on a 64-bit host, we + sign extend the 32-bit value to 64 bits if so doing makes the + value valid. */ + if (val > max + && (offsetT) (val - 0x80000000 - 0x80000000) >= min + && (offsetT) (val - 0x80000000 - 0x80000000) <= max) + val = val - 0x80000000 - 0x80000000; + + /* Similarly, people write expressions like ~(1<<15), and expect + this to be OK for a 32-bit unsigned value. */ + else if (val < min + && (offsetT) (val + 0x80000000 + 0x80000000) >= min + && (offsetT) (val + 0x80000000 + 0x80000000) <= max) + val = val + 0x80000000 + 0x80000000; + + else if (val < (offsetT) min || val > (offsetT) max) { char buf [128]; |