From 2c175ebc7499ac7cfae6679f7b1ecbf43e822772 Mon Sep 17 00:00:00 2001 From: Doug Kwan Date: Fri, 3 Feb 2012 20:01:01 +0000 Subject: 2012-02-03 Doug Kwan * 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. --- gold/arm.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'gold/arm.cc') 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(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(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(x); - return ((signed_x < -32768 || signed_x > 65536) + return (Bits<16>::has_signed_unsigned_overflow32(x) ? This::STATUS_OVERFLOW : This::STATUS_OKAY); } -- cgit v1.1