diff --git a/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 8e6603c5559..8967d8414db 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -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; }