aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/MapFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/MapFile.cpp')
-rw-r--r--lld/ELF/MapFile.cpp49
1 files changed, 6 insertions, 43 deletions
diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp
index c7d8967358ad..893511929a3a 100644
--- a/lld/ELF/MapFile.cpp
+++ b/lld/ELF/MapFile.cpp
@@ -22,12 +22,12 @@
#include "InputFiles.h"
#include "LinkerScript.h"
#include "OutputSections.h"
-#include "SymbolTable.h"
#include "Symbols.h"
#include "SyntheticSections.h"
-#include "lld/Common/Strings.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/raw_ostream.h"
@@ -55,7 +55,7 @@ static void writeHeader(raw_ostream &os, uint64_t vma, uint64_t lma,
// Returns a list of all symbols that we want to print out.
static std::vector<Defined *> getSymbols() {
std::vector<Defined *> v;
- for (ELFFileBase *file : objectFiles)
+ for (ELFFileBase *file : ctx->objectFiles)
for (Symbol *b : file->getSymbols())
if (auto *dr = dyn_cast<Defined>(b))
if (!dr->isSection() && dr->section && dr->section->isLive() &&
@@ -92,7 +92,7 @@ static SymbolMapTy getSectionSyms(ArrayRef<Defined *> syms) {
static DenseMap<Symbol *, std::string>
getSymbolStrings(ArrayRef<Defined *> syms) {
auto strs = std::make_unique<std::string[]>(syms.size());
- parallelForEachN(0, syms.size(), [&](size_t i) {
+ parallelFor(0, syms.size(), [&](size_t i) {
raw_string_ostream os(strs[i]);
OutputSection *osec = syms[i]->getOutputSection();
uint64_t vma = syms[i]->getVA();
@@ -168,7 +168,7 @@ static void writeMapFile(raw_fd_ostream &os) {
continue;
}
- osec = cast<OutputSection>(cmd);
+ osec = &cast<OutputDesc>(cmd)->osec;
writeHeader(os, osec->addr, osec->getLMA(), osec->size, osec->alignment);
os << osec->name << '\n';
@@ -210,25 +210,6 @@ static void writeMapFile(raw_fd_ostream &os) {
}
}
-void elf::writeWhyExtract() {
- if (config->whyExtract.empty())
- return;
-
- std::error_code ec;
- raw_fd_ostream os(config->whyExtract, ec, sys::fs::OF_None);
- if (ec) {
- error("cannot open --why-extract= file " + config->whyExtract + ": " +
- ec.message());
- return;
- }
-
- os << "reference\textracted\tsymbol\n";
- for (auto &entry : whyExtract) {
- os << std::get<0>(entry) << '\t' << toString(std::get<1>(entry)) << '\t'
- << toString(std::get<2>(entry)) << '\n';
- }
-}
-
// Output a cross reference table to stdout. This is for --cref.
//
// For each global symbol, we print out a file that defines the symbol
@@ -243,7 +224,7 @@ void elf::writeWhyExtract() {
static void writeCref(raw_fd_ostream &os) {
// Collect symbols and files.
MapVector<Symbol *, SetVector<InputFile *>> map;
- for (ELFFileBase *file : objectFiles) {
+ for (ELFFileBase *file : ctx->objectFiles) {
for (Symbol *sym : file->getSymbols()) {
if (isa<SharedSymbol>(sym))
map[sym].insert(file);
@@ -293,21 +274,3 @@ void elf::writeMapAndCref() {
if (config->cref)
writeCref(os);
}
-
-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\textracted\tarchive\n";
- for (const ArchiveFile *f : archiveFiles)
- os << f->getMemberCount() << '\t' << f->getExtractedMemberCount() << '\t'
- << f->getName() << '\n';
-}