[lld][elf2] Address review comments.

llvm-svn: 247096
This commit is contained in:
Michael J. Spencer 2015-09-08 22:51:46 +00:00
parent 8d24ae9441
commit ac5f048e09
3 changed files with 4 additions and 8 deletions

View File

@ -17,8 +17,7 @@ using namespace llvm::object;
using namespace lld;
using namespace lld::elf2;
SymbolTable::SymbolTable() : EntrySym(nullptr) {
}
SymbolTable::SymbolTable() {}
void SymbolTable::addFile(std::unique_ptr<InputFile> File) {
File->parse();
@ -33,8 +32,6 @@ void SymbolTable::addFile(std::unique_ptr<InputFile> File) {
}
template <class ELFT> void SymbolTable::init() {
if (EntrySym)
return;
EntrySym = new (Alloc) Undefined<ELFT>("_start", Undefined<ELFT>::Synthetic);
resolve<ELFT>(EntrySym);
}

View File

@ -55,7 +55,7 @@ public:
}
SymbolBody *getEntrySym() const {
return EntrySym;
return EntrySym->getReplacement();
}
private:
@ -78,7 +78,7 @@ private:
std::vector<std::unique_ptr<SharedFileBase>> SharedFiles;
SymbolBody *EntrySym;
SymbolBody *EntrySym = nullptr;
};
} // namespace elf2

View File

@ -577,8 +577,7 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
auto &FirstObj = cast<ObjectFile<ELFT>>(*Symtab.getFirstELF());
EHdr->e_machine = FirstObj.getEMachine();
EHdr->e_version = EV_CURRENT;
EHdr->e_entry = getSymVA(
cast<DefinedRegular<ELFT>>(Symtab.getEntrySym()->getReplacement()));
EHdr->e_entry = getSymVA(cast<DefinedRegular<ELFT>>(Symtab.getEntrySym()));
EHdr->e_phoff = sizeof(Elf_Ehdr);
EHdr->e_shoff = SectionHeaderOff;
EHdr->e_ehsize = sizeof(Elf_Ehdr);