diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp --- a/lld/MachO/MapFile.cpp +++ b/lld/MachO/MapFile.cpp @@ -91,6 +91,17 @@ return ret; } +static writeSymbols(const SymbolMapTy §ionSyms) { + os << "# Symbols:\n"; + os << "# Address\t File Name\n"; + for (InputSection *isec : inputSections) { + for (Symbol *sym : syms) { + os << format("0x%08llX\t[%3u] %s\n", sym->getVA(), + readerToFileOrdinal[sym->getFile()], symStr[sym].c_str()); + } + } +} + void macho::writeMapFile() { if (config->mapFile.empty()) return; @@ -145,14 +156,6 @@ } // Dump table of symbols - os << "# Symbols:\n"; - os << "# Address\t File Name\n"; - for (InputSection *isec : inputSections) { - for (Symbol *sym : syms) { - os << format("0x%08llX\t[%3u] %s\n", sym->getVA(), - readerToFileOrdinal[sym->getFile()], symStr[sym].c_str()); - } - } - + writeSymbols(syms) // TODO: when we implement -dead_strip, we should dump dead stripped symbols }