[llvm] r257803 - Handle offsets larger than 32 bits.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 14 13:03:07 PST 2016
Author: rafael
Date: Thu Jan 14 15:03:06 2016
New Revision: 257803
URL: http://llvm.org/viewvc/llvm-project?rev=257803&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=257803&r1=257802&r2=257803&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Thu Jan 14 15:03:06 2016
@@ -332,8 +332,10 @@ static void setMatch(MipsRelocationEntry
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;
}
More information about the llvm-commits
mailing list