From eeea5f88aa754b9755ac5af696973221e7e56238 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Thu, 20 Nov 2014 06:34:04 +0000 Subject: [PATCH] [Mips] Configure GOTPLT entries in the corresponding constructor No functional changes. llvm-svn: 222415 --- lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp index 7f92dbc..b181d5f 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp @@ -133,6 +133,13 @@ public: class GOTPLTAtom : public GOTAtom { public: GOTPLTAtom(const File &f) : GOTAtom(f, ".got.plt") {} + GOTPLTAtom(const PLTAtom *plt0, const Atom *a, const File &f) + : GOTAtom(f, ".got.plt") { + // Setup reference to assign initial value to the .got.plt entry. + addReferenceELF_Mips(R_MIPS_32, 0, plt0, 0); + // Create dynamic relocation to adjust the .got.plt entry at runtime. + addReferenceELF_Mips(R_MIPS_JUMP_SLOT, 0, a, 0); + } Alignment alignment() const override { return Alignment(2); } @@ -676,18 +683,13 @@ const PLTAtom *RelocationPass::getPLTEntry(const Atom *a) { if (_pltVector.empty()) createPLTHeader(); - auto ga = new (_file._alloc) GOTPLTAtom(_file); + auto ga = new (_file._alloc) GOTPLTAtom(_pltVector.front(), a, _file); _gotpltVector.push_back(ga); auto pa = new (_file._alloc) PLTAAtom(ga, _file); _pltMap[a] = pa; _pltVector.push_back(pa); - // Setup reference to assign initial value to the .got.plt entry. - ga->addReferenceELF_Mips(R_MIPS_32, 0, _pltVector.front(), 0); - // Create dynamic relocation to adjust the .got.plt entry at runtime. - ga->addReferenceELF_Mips(R_MIPS_JUMP_SLOT, 0, a, 0); - // Check that 'a' dynamic symbol table record should point to the PLT. if (_hasStaticRelocations.count(a) && _requiresPtrEquality.count(a)) pa->addReferenceELF_Mips(LLD_R_MIPS_STO_PLT, 0, a, 0); -- 2.7.4