[lld] r247096 - [lld][elf2] Address review comments.
Michael J. Spencer via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 15:51:46 PDT 2015
Author: mspencer
Date: Tue Sep 8 17:51:46 2015
New Revision: 247096
URL: http://llvm.org/viewvc/llvm-project?rev=247096&view=rev
Log:
[lld][elf2] Address review comments.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=247096&r1=247095&r2=247096&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Sep 8 17:51:46 2015
@@ -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_pt
}
template <class ELFT> void SymbolTable::init() {
- if (EntrySym)
- return;
EntrySym = new (Alloc) Undefined<ELFT>("_start", Undefined<ELFT>::Synthetic);
resolve<ELFT>(EntrySym);
}
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=247096&r1=247095&r2=247096&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Tue Sep 8 17:51:46 2015
@@ -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
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=247096&r1=247095&r2=247096&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Sep 8 17:51:46 2015
@@ -577,8 +577,7 @@ template <class ELFT> void Writer<ELFT>:
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);
More information about the llvm-commits
mailing list