diff options
| author | Igor Kudrin <ikudrin.dev@gmail.com> | 2015-11-16 17:44:08 +0000 |
|---|---|---|
| committer | Igor Kudrin <ikudrin.dev@gmail.com> | 2015-11-16 17:44:08 +0000 |
| commit | 351b41de4e73b060562f81c8fef0f83a480f9b57 (patch) | |
| tree | ab129ea3c38c6fedcf539af7981cf40a816c8a59 /lld/ELF/OutputSections.cpp | |
| parent | 7378e7a333d16755104fa4c3f1f6cc50a5b78c0d (diff) | |
| download | bcm5719-llvm-351b41de4e73b060562f81c8fef0f83a480f9b57.tar.gz bcm5719-llvm-351b41de4e73b060562f81c8fef0f83a480f9b57.zip | |
[ELF2] Remove target specific code from GotPltSection.
The content of reserved entries of the .got.plt section is target specific.
In particular, on x86_64 the zero entry holds the address of the .dynamic section,
but on AArch64 the same info is stored in the zero entry of the .got section.
Differential revision: http://reviews.llvm.org/D14703
llvm-svn: 253239
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 70d458b0829..fbdbce8cb43 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -35,17 +35,15 @@ GotPltSection<ELFT>::GotPltSection() : OutputSectionBase<ELFT>(".got.plt", llvm::ELF::SHT_PROGBITS, llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE) { this->Header.sh_addralign = sizeof(uintX_t); - // .got.plt has 3 reserved entry - Entries.resize(3); } template <class ELFT> void GotPltSection<ELFT>::addEntry(SymbolBody *Sym) { - Sym->GotPltIndex = Entries.size(); + Sym->GotPltIndex = Target->getGotPltHeaderEntriesNum() + Entries.size(); Entries.push_back(Sym); } template <class ELFT> bool GotPltSection<ELFT>::empty() const { - return Entries.size() == 3; + return Entries.empty(); } template <class ELFT> @@ -55,15 +53,15 @@ GotPltSection<ELFT>::getEntryAddr(const SymbolBody &B) const { } template <class ELFT> void GotPltSection<ELFT>::finalize() { - this->Header.sh_size = Entries.size() * sizeof(uintX_t); + this->Header.sh_size = + (Target->getGotPltHeaderEntriesNum() + Entries.size()) * sizeof(uintX_t); } template <class ELFT> void GotPltSection<ELFT>::writeTo(uint8_t *Buf) { - write<uintX_t, ELFT::TargetEndianness, sizeof(uintX_t)>( - Buf, Out<ELFT>::Dynamic->getVA()); + Target->writeGotPltHeaderEntries(Buf); + Buf += Target->getGotPltHeaderEntriesNum() * sizeof(uintX_t); for (const SymbolBody *B : Entries) { - if (B) - Target->writeGotPltEntry(Buf, Out<ELFT>::Plt->getEntryAddr(*B)); + Target->writeGotPltEntry(Buf, Out<ELFT>::Plt->getEntryAddr(*B)); Buf += sizeof(uintX_t); } } |

