diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 | 
| commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
| tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /lld/ELF/MapFile.cpp | |
| parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) | |
Notes
Diffstat (limited to 'lld/ELF/MapFile.cpp')
| -rw-r--r-- | lld/ELF/MapFile.cpp | 29 | 
1 files changed, 22 insertions, 7 deletions
| diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index e5f5c4f4ff23..12cffead1f80 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -26,16 +26,16 @@  #include "Symbols.h"  #include "SyntheticSections.h"  #include "lld/Common/Strings.h" -#include "lld/Common/Threads.h"  #include "llvm/ADT/MapVector.h"  #include "llvm/ADT/SetVector.h" +#include "llvm/Support/Parallel.h"  #include "llvm/Support/raw_ostream.h"  using namespace llvm;  using namespace llvm::object; +using namespace lld; +using namespace lld::elf; -namespace lld { -namespace elf {  using SymbolMapTy = DenseMap<const SectionBase *, SmallVector<Defined *, 4>>;  static constexpr char indent8[] = "        ";          // 8 spaces @@ -138,7 +138,7 @@ static void printEhFrame(raw_ostream &os, const EhFrameSection *sec) {    }  } -void writeMapFile() { +void elf::writeMapFile() {    if (config->mapFile.empty())      return; @@ -227,7 +227,7 @@ static void print(StringRef a, StringRef b) {  //  // In this case, strlen is defined by libc.so.6 and used by other two  // files. -void writeCrossReferenceTable() { +void elf::writeCrossReferenceTable() {    if (!config->cref)      return; @@ -259,5 +259,20 @@ void writeCrossReferenceTable() {    }  } -} // namespace elf -} // namespace lld +void elf::writeArchiveStats() { +  if (config->printArchiveStats.empty()) +    return; + +  std::error_code ec; +  raw_fd_ostream os(config->printArchiveStats, ec, sys::fs::OF_None); +  if (ec) { +    error("--print-archive-stats=: cannot open " + config->printArchiveStats + +          ": " + ec.message()); +    return; +  } + +  os << "members\tfetched\tarchive\n"; +  for (const ArchiveFile *f : archiveFiles) +    os << f->getMemberCount() << '\t' << f->getFetchedMemberCount() << '\t' +       << f->getName() << '\n'; +} | 
