summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2013-05-15 02:16:23 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2013-05-15 02:16:23 +0000
commit1fe14c56f11c76aa90f27da633380548a9ee71a5 (patch)
tree99b59853f195a6c4bf9bf4f6c39902b629c2f6b7
parente3ab7cca3abbc2dc5056695582b7a46abcc245ef (diff)
downloadllvm-1fe14c56f11c76aa90f27da633380548a9ee71a5.tar.gz
llvm-1fe14c56f11c76aa90f27da633380548a9ee71a5.tar.bz2
llvm-1fe14c56f11c76aa90f27da633380548a9ee71a5.tar.xz
ELFRelocationEntry::operator<(): Try to stabilize the order. r_offset was insufficient to sort Relocs.
It should fix llvm/test/CodeGen/ARM/ehabi-mc-compact-pr*.ll on some hosts. RELOCATION RECORDS FOR [.ARM.exidx]: 0 R_ARM_PREL31 .text 0 R_ARM_NONE __aeabi_unwind_cpp_pr0 FIXME: I am not sure of the directions of extra comparators, in Type and Index. For now, they are different from the direction in r_offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181864 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/MC/MCELFObjectWriter.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h
index a59776d5cd..65dd1e8998 100644
--- a/include/llvm/MC/MCELFObjectWriter.h
+++ b/include/llvm/MC/MCELFObjectWriter.h
@@ -45,7 +45,14 @@ struct ELFRelocationEntry {
// Support lexicographic sorting.
bool operator<(const ELFRelocationEntry &RE) const {
- return RE.r_offset < r_offset;
+ if (RE.r_offset != r_offset)
+ return RE.r_offset < r_offset;
+ if (Type != RE.Type)
+ return Type < RE.Type;
+ if (Index != RE.Index)
+ return Index < RE.Index;
+ llvm_unreachable("ELFRelocs might be unstable!");
+ return 0;
}
};