[llvm] 5a955cc - [JITLink] Tighten section sorting criteria to fix a flaky test case.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 23:00:05 PDT 2019
Author: Lang Hames
Date: 2019-10-28T22:56:13-07:00
New Revision: 5a955cc8b95a88fd0489d9b0a36ec86941ba6337
URL: https://github.com/llvm/llvm-project/commit/5a955cc8b95a88fd0489d9b0a36ec86941ba6337
DIFF: https://github.com/llvm/llvm-project/commit/5a955cc8b95a88fd0489d9b0a36ec86941ba6337.diff
LOG: [JITLink] Tighten section sorting criteria to fix a flaky test case.
Sections may have zero size and zero-sized sections may share a start address
with other zero-sized sections. For the section overlap test to function
correctly zero-sized sections must be ordered before any non-zero sized ones.
This should fix the intermittent failures in the
test/ExecutionEngine/JITLink/X86/MachO_zero_fill_alignment.s test case that
have been observed on some builders.
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
index 7366f53ebf36..c1dc138ee702 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
@@ -179,7 +179,9 @@ Error MachOLinkGraphBuilder::createNormalizedSections() {
llvm::sort(Sections,
[](const NormalizedSection *LHS, const NormalizedSection *RHS) {
assert(LHS && RHS && "Null section?");
- return LHS->Address < RHS->Address;
+ if (LHS->Address != RHS->Address)
+ return LHS->Address < RHS->Address;
+ return LHS->Size < RHS->Size;
});
for (unsigned I = 0, E = Sections.size() - 1; I != E; ++I) {
More information about the llvm-commits
mailing list