[lld] r246793 - Make ObjectFiles private. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 11:56:20 PDT 2015
Author: rafael
Date: Thu Sep 3 13:56:20 2015
New Revision: 246793
URL: http://llvm.org/viewvc/llvm-project?rev=246793&view=rev
Log:
Make ObjectFiles private. NFC.
Just preparation for adding support for shared libraries.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=246793&r1=246792&r2=246793&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Sep 3 13:56:20 2015
@@ -98,7 +98,7 @@ void LinkerDriver::link(ArrayRef<const c
Symtab.reportRemainingUndefines();
// Write the result.
- ObjectFileBase &FirstObj = *Symtab.ObjectFiles[0];
+ ObjectFileBase &FirstObj = *Symtab.getObjectFiles()[0];
switch (FirstObj.getELFKind()) {
case ELF32LEKind:
writeResult<object::ELF32LE>(&Symtab);
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=246793&r1=246792&r2=246793&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Thu Sep 3 13:56:20 2015
@@ -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<std::unique_ptr<ObjectFileBase>> ObjectFiles;
-
const llvm::DenseMap<StringRef, Symbol *> &getSymbols() const {
return Symtab;
}
+ const std::vector<std::unique_ptr<ObjectFileBase>> &getObjectFiles() const {
+ return ObjectFiles;
+ }
+
private:
void addObject(ObjectFileBase *File);
@@ -52,6 +53,9 @@ private:
llvm::DenseMap<StringRef, Symbol *> Symtab;
llvm::BumpPtrAllocator Alloc;
+
+ // The writer needs to infer the machine type from the object files.
+ std::vector<std::unique_ptr<ObjectFileBase>> ObjectFiles;
};
} // namespace elf2
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=246793&r1=246792&r2=246793&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Sep 3 13:56:20 2015
@@ -432,7 +432,7 @@ template <class ELFT> void Writer<ELFT>:
};
const SymbolTable &Symtab = SymTable.getSymTable();
- for (const std::unique_ptr<ObjectFileBase> &FileB : Symtab.ObjectFiles) {
+ for (const std::unique_ptr<ObjectFileBase> &FileB : Symtab.getObjectFiles()) {
auto &File = cast<ObjectFile<ELFT>>(*FileB);
for (SectionChunk<ELFT> *C : File.getChunks()) {
if (!C)
@@ -543,7 +543,7 @@ template <class ELFT> void Writer<ELFT>:
EHdr->e_type = ET_EXEC;
const SymbolTable &Symtab = SymTable.getSymTable();
- auto &FirstObj = cast<ObjectFile<ELFT>>(*Symtab.ObjectFiles[0]);
+ auto &FirstObj = cast<ObjectFile<ELFT>>(*Symtab.getObjectFiles()[0]);
EHdr->e_machine = FirstObj.getObj()->getHeader()->e_machine;
EHdr->e_version = EV_CURRENT;
EHdr->e_entry = 0x401000;
More information about the llvm-commits
mailing list