[lld] 01cb9c5 - [lld][MachO] Sort symbols in parallel in -map
Xuanda Yang via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 16 19:20:33 PDT 2021
Author: Xuanda Yang
Date: 2021-06-17T10:19:59+08:00
New Revision: 01cb9c5fc52bf7978fe8e1b1dba98b0e1d304402
URL: https://github.com/llvm/llvm-project/commit/01cb9c5fc52bf7978fe8e1b1dba98b0e1d304402
DIFF: https://github.com/llvm/llvm-project/commit/01cb9c5fc52bf7978fe8e1b1dba98b0e1d304402.diff
LOG: [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
Added:
Modified:
lld/MachO/MapFile.cpp
Removed:
################################################################################
diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp
index 26db02d1e7a2..79471eecbd52 100644
--- a/lld/MachO/MapFile.cpp
+++ b/lld/MachO/MapFile.cpp
@@ -52,9 +52,11 @@ static SymbolMapTy getSectionSyms(ArrayRef<Defined *> syms) {
// appear in the output file rather than the order they appeared in the input
// files.
for (auto &it : ret)
- llvm::stable_sort(it.second, [](Defined *a, Defined *b) {
- return a->getVA() < b->getVA();
- });
+ parallelSort(
+ it.second.begin(), it.second.end(), [](Defined *a, Defined *b) {
+ return a->getVA() != b->getVA() ? a->getVA() < b->getVA()
+ : a->getName() < b->getName();
+ });
return ret;
}
More information about the llvm-commits
mailing list