diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp --- a/lld/MachO/MapFile.cpp +++ b/lld/MachO/MapFile.cpp @@ -126,7 +126,10 @@ // Collect symbol info that we want to print out. std::vector syms = getSymbols(); - SymbolMapTy sectionSyms = getSectionSyms(syms); + parallelSort(syms.begin(), syms.end(), [](Defined *a, Defined *b) { + return a->getVA() != b->getVA() ? a->getVA() < b->getVA() + : a->getName() < b->getName(); + }); DenseMap symStr = getSymbolStrings(syms); // Dump table of sections @@ -145,11 +148,7 @@ os << "# Symbols:\n"; os << "# Address\t File Name\n"; for (InputSection *isec : inputSections) { - auto symsIt = sectionSyms.find(isec); - assert(!shouldOmitFromOutput(isec) || (symsIt == sectionSyms.end())); - if (symsIt == sectionSyms.end()) - continue; - for (Symbol *sym : symsIt->second) { + for (Symbol *sym : syms) { os << format("0x%08llX\t[%3u] %s\n", sym->getVA(), readerToFileOrdinal[sym->getFile()], symStr[sym].c_str()); }