[lld] r259444 - Always initialize Out<ELFT> members.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 16:35:49 PST 2016
Author: ruiu
Date: Mon Feb 1 18:35:49 2016
New Revision: 259444
URL: http://llvm.org/viewvc/llvm-project?rev=259444&view=rev
Log:
Always initialize Out<ELFT> members.
Instead of leave unused fields as is, set them to nullptr.
Currnetly this is NFC, but if you call writeResults more than
once, you should be able to see the difference.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=259444&r1=259443&r2=259444&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Feb 1 18:35:49 2016
@@ -114,6 +114,8 @@ template <class ELFT> void elf2::writeRe
StringTableSection<ELFT> StrTab(".strtab", false);
if (!Config->StripAll)
Out<ELFT>::StrTab = &StrTab;
+ else
+ Out<ELFT>::StrTab = nullptr;
StringTableSection<ELFT> DynStrTab(".dynstr", true);
Out<ELFT>::DynStrTab = &DynStrTab;
GotSection<ELFT> Got;
@@ -121,27 +123,37 @@ template <class ELFT> void elf2::writeRe
GotPltSection<ELFT> GotPlt;
if (Target->UseLazyBinding)
Out<ELFT>::GotPlt = &GotPlt;
+ else
+ Out<ELFT>::GotPlt = nullptr;
PltSection<ELFT> Plt;
Out<ELFT>::Plt = &Plt;
std::unique_ptr<SymbolTableSection<ELFT>> SymTab;
if (!Config->StripAll) {
SymTab.reset(new SymbolTableSection<ELFT>(*Symtab, *Out<ELFT>::StrTab));
Out<ELFT>::SymTab = SymTab.get();
+ } else {
+ Out<ELFT>::SymTab = nullptr;
}
SymbolTableSection<ELFT> DynSymTab(*Symtab, *Out<ELFT>::DynStrTab);
Out<ELFT>::DynSymTab = &DynSymTab;
HashTableSection<ELFT> HashTab;
if (Config->SysvHash)
Out<ELFT>::HashTab = &HashTab;
+ else
+ Out<ELFT>::HashTab = nullptr;
GnuHashTableSection<ELFT> GnuHashTab;
if (Config->GnuHash)
Out<ELFT>::GnuHashTab = &GnuHashTab;
+ else
+ Out<ELFT>::GnuHashTab = nullptr;
bool IsRela = shouldUseRela<ELFT>();
RelocationSection<ELFT> RelaDyn(IsRela ? ".rela.dyn" : ".rel.dyn", IsRela);
Out<ELFT>::RelaDyn = &RelaDyn;
RelocationSection<ELFT> RelaPlt(IsRela ? ".rela.plt" : ".rel.plt", IsRela);
if (Target->UseLazyBinding)
Out<ELFT>::RelaPlt = &RelaPlt;
+ else
+ Out<ELFT>::RelaPlt = nullptr;
DynamicSection<ELFT> Dynamic(*Symtab);
Out<ELFT>::Dynamic = &Dynamic;
EhFrameHeader<ELFT> EhFrameHdr;
More information about the llvm-commits
mailing list