[Mips] Move setup of LLD_R_MIPS_STO_PLT relocation to the getPLTEntry() routine

No functional changes.

llvm-svn: 222320
This commit is contained in:
Simon Atanasyan 2014-11-19 05:50:47 +00:00
parent 5106ce7897
commit ff903f385c
1 changed files with 5 additions and 20 deletions

View File

@ -252,9 +252,6 @@ private:
void createPLTHeader();
bool mightBeDynamic(const MipsELFDefinedAtom<ELFT> &atom,
const Reference &ref) const;
static void addSingleReference(SimpleELFDefinedAtom *src, const Atom *tgt,
uint16_t relocType);
};
template <typename ELFT>
@ -483,13 +480,8 @@ bool RelocationPass<ELFT>::requireCopy(Reference &ref) {
template <typename ELFT>
void RelocationPass<ELFT>::configurePLTReference(Reference &ref) {
const Atom *atom = ref.target();
auto *plt = getPLTEntry(atom);
auto *plt = getPLTEntry(ref.target());
ref.setTarget(plt);
if (_hasStaticRelocations.count(atom) && _requiresPtrEquality.count(atom))
addSingleReference(plt, atom, LLD_R_MIPS_STO_PLT);
}
template <typename ELFT>
@ -701,17 +693,6 @@ template <typename ELFT> void RelocationPass<ELFT>::createPLTHeader() {
});
}
template <typename ELFT>
void RelocationPass<ELFT>::addSingleReference(SimpleELFDefinedAtom *src,
const Atom *tgt,
uint16_t relocType) {
for (const auto &r : *src)
if (r->kindNamespace() == lld::Reference::KindNamespace::ELF &&
r->kindValue() == relocType && r->target() == tgt)
break;
src->addReferenceELF_Mips(relocType, 0, tgt, 0);
}
template <typename ELFT>
PLTAtom *RelocationPass<ELFT>::getPLTEntry(const Atom *a) {
auto plt = _pltMap.find(a);
@ -738,6 +719,10 @@ PLTAtom *RelocationPass<ELFT>::getPLTEntry(const Atom *a) {
// 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);
DEBUG_WITH_TYPE("MipsGOT", {
pa->_name = "__plt_";
pa->_name += a->name();