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, 14 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
index 8bd398ba998..16f8af839f1 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
@@ -205,6 +205,7 @@ private:
void handle26(Reference &ref);
void handleGOT(Reference &ref);
void handleGPRel(const MipsELFDefinedAtom<ELFT> &atom, Reference &ref);
+ void handleTLS(const MipsELFDefinedAtom<ELFT> &atom, Reference &ref);
const GOTAtom *getLocalGOTEntry(const Reference &ref);
const GOTAtom *getGlobalGOTEntry(const Atom *a);
@@ -325,6 +326,10 @@ void RelocationPass<ELFT>::handleReference(const MipsELFDefinedAtom<ELFT> &atom,
case R_MIPS_GPREL32:
handleGPRel(atom, ref);
break;
+ case R_MIPS_TLS_TPREL_HI16:
+ case R_MIPS_TLS_TPREL_LO16:
+ handleTLS(atom, ref);
+ break;
}
}
@@ -508,6 +513,15 @@ void RelocationPass<ELFT>::handleGPRel(const MipsELFDefinedAtom<ELFT> &atom,
}
template <typename ELFT>
+void RelocationPass<ELFT>::handleTLS(const MipsELFDefinedAtom<ELFT> &atom,
+ Reference &ref) {
+ assert((ref.kindValue() == R_MIPS_TLS_TPREL_HI16 ||
+ ref.kindValue() == R_MIPS_TLS_TPREL_LO16) &&
+ "Unexpected kind of relocation");
+ ref.setAddend(ref.addend() - atom.file().getTPOffset());
+}
+
+template <typename ELFT>
bool RelocationPass<ELFT>::isLocalCall(const Atom *a) const {
Atom::Scope scope;
if (auto *da = dyn_cast<DefinedAtom>(a))
OpenPOWER on IntegriCloud