Handle offsets larger than 32 bits.

David Majnemer noticed that it was not obvious what the behavior would
be if B.Offset - A.Offset could not fit in an int.

llvm-svn: 257803
This commit is contained in:
Rafael Espindola 2016-01-14 21:03:06 +00:00
parent 83aa97941f
commit c897cdde70
1 changed files with 4 additions and 2 deletions

View File

@ -332,8 +332,10 @@ static void setMatch(MipsRelocationEntry &Hi, MipsRelocationEntry &Lo) {
static int cmpRel(const ELFRelocationEntry *AP, const ELFRelocationEntry *BP) {
const ELFRelocationEntry &A = *AP;
const ELFRelocationEntry &B = *BP;
if (A.Offset != B.Offset)
return B.Offset - A.Offset;
if (A.Offset < B.Offset)
return 1;
if (A.Offset > B.Offset)
return -1;
assert(B.Type != A.Type && "We don't have a total order");
return A.Type - B.Type;
}