diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp --- a/lld/MachO/MapFile.cpp +++ b/lld/MachO/MapFile.cpp @@ -71,6 +71,15 @@ return ret; } +static writeSymbols(const std::vector &syms) { + os << "# Symbols:\n"; + os << "# Address\t File Name\n"; + 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; @@ -125,12 +134,6 @@ } // Dump table of symbols - os << "# Symbols:\n"; - os << "# Address\t File Name\n"; - 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 }