summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp')
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
index 7f92dbc2161..b181d5fe3de 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<ELFT>::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);
OpenPOWER on IntegriCloud