forked from OSchip/llvm-project
parent
8d24ae9441
commit
ac5f048e09
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue