Skip to content

Commit 01cb9c5

Browse files
committed
[lld][MachO] Sort symbols in parallel in -map
source: https://bugs.llvm.org/show_bug.cgi?id=50689 When writing a map file, sort symbols in parallel using parallelSort. Use address name to break ties if two symbols have the same address. Reviewed By: thakis, int3 Differential Revision: https://reviews.llvm.org/D104346
1 parent 5a55205 commit 01cb9c5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lld/MachO/MapFile.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ static SymbolMapTy getSectionSyms(ArrayRef<Defined *> syms) {
5252
// appear in the output file rather than the order they appeared in the input
5353
// files.
5454
for (auto &it : ret)
55-
llvm::stable_sort(it.second, [](Defined *a, Defined *b) {
56-
return a->getVA() < b->getVA();
57-
});
55+
parallelSort(
56+
it.second.begin(), it.second.end(), [](Defined *a, Defined *b) {
57+
return a->getVA() != b->getVA() ? a->getVA() < b->getVA()
58+
: a->getName() < b->getName();
59+
});
5860
return ret;
5961
}
6062

0 commit comments

Comments
 (0)