Revert r250169: "This patch implements basic variant of lazy loading for x86_x64 and for X86 targets."
With this patch LLD is not able to self-host on x86-64 Linux.
llvm-svn: 250182
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 5458b87..d5b61a6 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -98,8 +98,6 @@
Out<ELFT>::Bss = &Bss;
GotSection<ELFT> Got;
Out<ELFT>::Got = &Got;
- GotPltSection<ELFT> GotPlt;
- Out<ELFT>::GotPlt = &GotPlt;
PltSection<ELFT> Plt;
Out<ELFT>::Plt = &Plt;
SymbolTableSection<ELFT> SymTab(*Symtab, *Out<ELFT>::StrTab);
@@ -108,11 +106,8 @@
Out<ELFT>::DynSymTab = &DynSymTab;
HashTableSection<ELFT> HashTab;
Out<ELFT>::HashTab = &HashTab;
- bool IsRela = Symtab->shouldUseRela();
- RelocationSection<ELFT> RelaDyn(IsRela ? ".rela.dyn" : ".rel.dyn", IsRela);
+ RelocationSection<ELFT> RelaDyn(Symtab->shouldUseRela());
Out<ELFT>::RelaDyn = &RelaDyn;
- RelocationSection<ELFT> RelaPlt(IsRela ? ".rela.plt" : ".rel.plt", IsRela);
- Out<ELFT>::RelaPlt = &RelaPlt;
DynamicSection<ELFT> Dynamic(*Symtab);
Out<ELFT>::Dynamic = &Dynamic;
@@ -192,8 +187,8 @@
if (Body->isInPlt())
continue;
Out<ELFT>::Plt->addEntry(Body);
- Out<ELFT>::GotPlt->addEntry(Body);
- } else if (Target->relocNeedsGot(Type, *Body)) {
+ }
+ if (Target->relocNeedsGot(Type, *Body)) {
if (Body->isInGot())
continue;
Out<ELFT>::Got->addEntry(Body);
@@ -205,10 +200,7 @@
continue;
if (CBP)
Body->setUsedInDynamicReloc();
- if (Body && Target->relocNeedsPlt(Type, *Body))
- Out<ELFT>::RelaPlt->addReloc({ C, RI });
- else
- Out<ELFT>::RelaDyn->addReloc({ C, RI });
+ Out<ELFT>::RelaDyn->addReloc({C, RI});
}
}
@@ -455,13 +447,9 @@
OutputSections.push_back(Out<ELFT>::DynStrTab);
if (Out<ELFT>::RelaDyn->hasRelocs())
OutputSections.push_back(Out<ELFT>::RelaDyn);
- if (Out<ELFT>::RelaPlt->hasRelocs())
- OutputSections.push_back(Out<ELFT>::RelaPlt);
}
if (!Out<ELFT>::Got->empty())
OutputSections.push_back(Out<ELFT>::Got);
- if (!Out<ELFT>::GotPlt->empty())
- OutputSections.push_back(Out<ELFT>::GotPlt);
if (!Out<ELFT>::Plt->empty())
OutputSections.push_back(Out<ELFT>::Plt);