diff lld/MachO/MapFile.cpp @ 223:5f17cb93ff66 llvm-original

LLVM13 (2021/7/18)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:43:00 +0900
parents 79ff65ed7e25
children c4bab56944e8
line wrap: on
line diff
--- a/lld/MachO/MapFile.cpp	Sun Jul 18 22:10:01 2021 +0900
+++ b/lld/MachO/MapFile.cpp	Sun Jul 18 22:43:00 2021 +0900
@@ -48,13 +48,15 @@
   for (Defined *dr : syms)
     ret[dr->isec].push_back(dr);
 
-  // Sort symbols by address. We want to print out symbols in the
-  // order in the output file rather than the order they appeared
-  // in the input files.
+  // Sort symbols by address. We want to print out symbols in the order they
+  // 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;
 }
 
@@ -63,14 +65,12 @@
   std::vector<Defined *> v;
   for (InputFile *file : inputFiles)
     if (isa<ObjFile>(file))
-      for (Symbol *sym : file->symbols) {
+      for (Symbol *sym : file->symbols)
         if (auto *d = dyn_cast_or_null<Defined>(sym))
           if (d->isLive() && d->isec && d->getFile() == file) {
-            assert(!d->isec->isCoalescedWeak() &&
-                   "file->symbols should store resolved symbols");
+            assert(!shouldOmitFromOutput(d->isec));
             v.push_back(d);
           }
-      }
   return v;
 }
 
@@ -146,7 +146,7 @@
   os << "# Address\t    File  Name\n";
   for (InputSection *isec : inputSections) {
     auto symsIt = sectionSyms.find(isec);
-    assert(!isec->shouldOmitFromOutput() || (symsIt == sectionSyms.end()));
+    assert(!shouldOmitFromOutput(isec) || (symsIt == sectionSyms.end()));
     if (symsIt == sectionSyms.end())
       continue;
     for (Symbol *sym : symsIt->second) {