forked from OSchip/llvm-project
Make ObjectFiles private. NFC.
Just preparation for adding support for shared libraries. llvm-svn: 246793
This commit is contained in:
parent
50456fb98e
commit
222edc66d6
|
@ -98,7 +98,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
|||
Symtab.reportRemainingUndefines();
|
||||
|
||||
// Write the result.
|
||||
ObjectFileBase &FirstObj = *Symtab.ObjectFiles[0];
|
||||
ObjectFileBase &FirstObj = *Symtab.getObjectFiles()[0];
|
||||
switch (FirstObj.getELFKind()) {
|
||||
case ELF32LEKind:
|
||||
writeResult<object::ELF32LE>(&Symtab);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -432,7 +432,7 @@ template <class ELFT> void Writer<ELFT>::createSections() {
|
|||
};
|
||||
|
||||
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>::writeHeader() {
|
|||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue