From 222edc66d6342034eb456b40b4370dddeed5324f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 3 Sep 2015 18:56:20 +0000 Subject: [PATCH] Make ObjectFiles private. NFC. Just preparation for adding support for shared libraries. llvm-svn: 246793 --- lld/ELF/Driver.cpp | 2 +- lld/ELF/SymbolTable.h | 10 +++++++--- lld/ELF/Writer.cpp | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 843fa65396b8..3f5b00b383b0 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -98,7 +98,7 @@ void LinkerDriver::link(ArrayRef ArgsArr) { Symtab.reportRemainingUndefines(); // Write the result. - ObjectFileBase &FirstObj = *Symtab.ObjectFiles[0]; + ObjectFileBase &FirstObj = *Symtab.getObjectFiles()[0]; switch (FirstObj.getELFKind()) { case ELF32LEKind: writeResult(&Symtab); diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index b6a8e05b276d..b4e50aa6438d 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -37,13 +37,14 @@ public: // Print an error message on undefined symbols. void reportRemainingUndefines(); - // The writer needs to infer the machine type from the object files. - std::vector> ObjectFiles; - const llvm::DenseMap &getSymbols() const { return Symtab; } + const std::vector> &getObjectFiles() const { + return ObjectFiles; + } + private: void addObject(ObjectFileBase *File); @@ -52,6 +53,9 @@ private: llvm::DenseMap Symtab; llvm::BumpPtrAllocator Alloc; + + // The writer needs to infer the machine type from the object files. + std::vector> ObjectFiles; }; } // namespace elf2 diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3145efc206c4..970d6cdb9bcb 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -432,7 +432,7 @@ template void Writer::createSections() { }; const SymbolTable &Symtab = SymTable.getSymTable(); - for (const std::unique_ptr &FileB : Symtab.ObjectFiles) { + for (const std::unique_ptr &FileB : Symtab.getObjectFiles()) { auto &File = cast>(*FileB); for (SectionChunk *C : File.getChunks()) { if (!C) @@ -543,7 +543,7 @@ template void Writer::writeHeader() { EHdr->e_type = ET_EXEC; const SymbolTable &Symtab = SymTable.getSymTable(); - auto &FirstObj = cast>(*Symtab.ObjectFiles[0]); + auto &FirstObj = cast>(*Symtab.getObjectFiles()[0]); EHdr->e_machine = FirstObj.getObj()->getHeader()->e_machine; EHdr->e_version = EV_CURRENT; EHdr->e_entry = 0x401000;