This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][GOLD] Fix lower bound for number of bits.


Hi Ian,

    I noticed that you move the Bits class template  from arm.cc to
reloc.h recently.  I found that the minimum number of bits is 0 in
various methods, this is mostly likely my bug.  If bits == 0,
expressions like "1U << (bits - 1)" are undefined.  If changed lower
bound from 0 to 1 in all assertions in the Bits class template.  In
addition, I also change some related code in arm.cc.  This is tested
on both x86_64 and ARM.

-Doug


2012-02-02  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.

Attachment: patch-bits.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]