diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-01-14 21:03:06 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-01-14 21:03:06 +0000 |
commit | c897cdde701011b83d5cfe0151a367cba7db6f63 (patch) | |
tree | 43f94b4062b43543783cc704439c0ea80efc1837 | |
parent | 83aa97941f75421901c90e7fdb95d45f0f14a3e7 (diff) | |
download | bcm5719-llvm-c897cdde701011b83d5cfe0151a367cba7db6f63.tar.gz bcm5719-llvm-c897cdde701011b83d5cfe0151a367cba7db6f63.zip |
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
-rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 8e6603c5559..8967d8414db 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/llvm/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; } |