aboutsummaryrefslogtreecommitdiff
path: root/gold/arm.cc
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2012-02-03 20:01:01 +0000
committerDoug Kwan <dougkwan@google.com>2012-02-03 20:01:01 +0000
commit2c175ebc7499ac7cfae6679f7b1ecbf43e822772 (patch)
tree2052feca6e60f3402e3348ea9f956ee66a117ac7 /gold/arm.cc
parente009ee7132fd0e378399e2f957078e822c34439a (diff)
downloadgdb-2c175ebc7499ac7cfae6679f7b1ecbf43e822772.zip
gdb-2c175ebc7499ac7cfae6679f7b1ecbf43e822772.tar.gz
gdb-2c175ebc7499ac7cfae6679f7b1ecbf43e822772.tar.bz2
2012-02-03 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relocate_functions::abs8, Arm_relocate_functions::abs16): Use Bits::has_signed_unsigned_overflow32. (Arm_relocate_functions::thm_abs8): Correct range of overflow check. * reloc.h (Bits class): Change minimum number of bits from 0 to 1 in assertions.
Diffstat (limited to 'gold/arm.cc')
-rw-r--r--gold/arm.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/gold/arm.cc b/gold/arm.cc
index ec80d67..bc704cc 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -3183,8 +3183,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
elfcpp::Swap<8, big_endian>::writeval(wv, val);
// R_ARM_ABS8 permits signed or unsigned results.
- int signed_x = static_cast<int32_t>(x);
- return ((signed_x < -128 || signed_x > 255)
+ return (Bits<8>::has_signed_unsigned_overflow32(x)
? This::STATUS_OVERFLOW
: This::STATUS_OKAY);
}
@@ -3203,10 +3202,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
Reltype x = psymval->value(object, addend);
val = Bits<32>::bit_select32(val, x << 6, 0x7e0U);
elfcpp::Swap<16, big_endian>::writeval(wv, val);
-
- // R_ARM_ABS16 permits signed or unsigned results.
- int signed_x = static_cast<int32_t>(x);
- return ((signed_x < -32768 || signed_x > 65535)
+ return (Bits<5>::has_overflow32(x)
? This::STATUS_OVERFLOW
: This::STATUS_OKAY);
}
@@ -3245,8 +3241,7 @@ class Arm_relocate_functions : public Relocate_functions<32, big_endian>
elfcpp::Swap_unaligned<16, big_endian>::writeval(view, val);
// R_ARM_ABS16 permits signed or unsigned results.
- int signed_x = static_cast<int32_t>(x);
- return ((signed_x < -32768 || signed_x > 65536)
+ return (Bits<16>::has_signed_unsigned_overflow32(x)
? This::STATUS_OVERFLOW
: This::STATUS_OKAY);
}