1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

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 b2378417a2
commit 8e0f92e5a1

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;
}