summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
diff options
context:
space:
mode:
authorEugene Leviant <eleviant@accesssoftek.com>2016-11-10 09:48:29 +0000
committerEugene Leviant <eleviant@accesssoftek.com>2016-11-10 09:48:29 +0000
commit41ca327b5e8c36156c9a39c4f833a8db3a37d3ec (patch)
treec793cbffa1457a99327c846ee0b5552b2cce9962 /lld/ELF/OutputSections.cpp
parentd0b9173caa30cb29ecbcd047901fbb450e4f0e70 (diff)
downloadbcm5719-llvm-41ca327b5e8c36156c9a39c4f833a8db3a37d3ec.tar.gz
bcm5719-llvm-41ca327b5e8c36156c9a39c4f833a8db3a37d3ec.zip
[ELF] Convert .got.plt section to input section
Differential revision: https://reviews.llvm.org/D26349 llvm-svn: 286443
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r--lld/ELF/OutputSections.cpp40
1 files changed, 5 insertions, 35 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 5e7050ff14f..5402c3a40a5 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -109,35 +109,6 @@ template <class ELFT> void GdbIndexSection<ELFT>::writeTo(uint8_t *Buf) {
}
template <class ELFT>
-GotPltSection<ELFT>::GotPltSection()
- : OutputSectionBase(".got.plt", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE) {
- this->Addralign = Target->GotPltEntrySize;
-}
-
-template <class ELFT> void GotPltSection<ELFT>::addEntry(SymbolBody &Sym) {
- Sym.GotPltIndex = Target->GotPltHeaderEntriesNum + Entries.size();
- Entries.push_back(&Sym);
-}
-
-template <class ELFT> bool GotPltSection<ELFT>::empty() const {
- return Entries.empty();
-}
-
-template <class ELFT> void GotPltSection<ELFT>::finalize() {
- this->Size = (Target->GotPltHeaderEntriesNum + Entries.size()) *
- Target->GotPltEntrySize;
-}
-
-template <class ELFT> void GotPltSection<ELFT>::writeTo(uint8_t *Buf) {
- Target->writeGotPltHeader(Buf);
- Buf += Target->GotPltHeaderEntriesNum * Target->GotPltEntrySize;
- for (const SymbolBody *B : Entries) {
- Target->writeGotPlt(Buf, *B);
- Buf += sizeof(uintX_t);
- }
-}
-
-template <class ELFT>
GotSection<ELFT>::GotSection()
: OutputSectionBase(".got", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE) {
if (Config->EMachine == EM_MIPS)
@@ -775,7 +746,7 @@ template <class ELFT> void DynamicSection<ELFT>::finalize() {
Add({DT_JMPREL, Out<ELFT>::RelaPlt});
Add({DT_PLTRELSZ, Out<ELFT>::RelaPlt->Size});
Add({Config->EMachine == EM_MIPS ? DT_MIPS_PLTGOT : DT_PLTGOT,
- Out<ELFT>::GotPlt});
+ In<ELFT>::GotPlt});
Add({DT_PLTREL, uint64_t(Config->Rela ? DT_RELA : DT_REL)});
}
@@ -846,6 +817,9 @@ template <class ELFT> void DynamicSection<ELFT>::writeTo(uint8_t *Buf) {
case Entry::SecAddr:
P->d_un.d_ptr = E.OutSec->Addr;
break;
+ case Entry::InSecAddr:
+ P->d_un.d_ptr = E.InSec->OutSec->Addr + E.InSec->OutSecOff;
+ break;
case Entry::SecSize:
P->d_un.d_val = E.OutSec->Size;
break;
@@ -1789,6 +1763,7 @@ OutputSectionFactory<ELFT>::create(const SectionKey<ELFT::Is64Bits> &Key,
uint32_t Type = C->Type;
switch (C->kind()) {
case InputSectionBase<ELFT>::Regular:
+ case InputSectionBase<ELFT>::Synthetic:
Sec = make<OutputSection<ELFT>>(Key.Name, Type, Flags);
break;
case InputSectionBase<ELFT>::EHFrame:
@@ -1845,11 +1820,6 @@ template class EhFrameHeader<ELF32BE>;
template class EhFrameHeader<ELF64LE>;
template class EhFrameHeader<ELF64BE>;
-template class GotPltSection<ELF32LE>;
-template class GotPltSection<ELF32BE>;
-template class GotPltSection<ELF64LE>;
-template class GotPltSection<ELF64BE>;
-
template class GotSection<ELF32LE>;
template class GotSection<ELF32BE>;
template class GotSection<ELF64LE>;
OpenPOWER on IntegriCloud