summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-11-19 05:50:47 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-11-19 05:50:47 +0000
commitff903f385c71b61d37334a584352c929c3007b99 (patch)
tree2bcba266978e7037b23a1b011a950555e25dfefd
parent5106ce789771fafb4e3ea7faa2262fbf276753cd (diff)
downloadbcm5719-llvm-ff903f385c71b61d37334a584352c929c3007b99.tar.gz
bcm5719-llvm-ff903f385c71b61d37334a584352c929c3007b99.zip
[Mips] Move setup of LLD_R_MIPS_STO_PLT relocation to the getPLTEntry() routine
No functional changes. llvm-svn: 222320
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
index 3280b3058a9..3662c027276 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
@@ -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>
@@ -702,17 +694,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);
if (plt != _pltMap.end())
@@ -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();
OpenPOWER on IntegriCloud