[ELF] - implemented @indntpoff (x86) relocation and its optimization.

@indntpoff is similar to @gotntpoff, but for use in position dependent code. While @gotntpoff resolves to GOT slot address relative to the
start of the GOT in the movl or addl instructions, @indntpoff resolves to the
absolute GOT slot address. ("ELF Handling For Thread-Local Storage", Ulrich Drepper).

Differential revision: http://reviews.llvm.org/D15494

llvm-svn: 255884
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 522eb62..0c56bb1 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -236,9 +236,16 @@
         continue;
     }
 
-    if (Body && Body->isTls() && !Target->isTlsDynReloc(Type))
+    if (Body && Body->isTls() && !Target->isTlsDynReloc(Type, *Body))
       continue;
 
+    if (Target->relocNeedsDynRelative(Type)) {
+      RelType *Rel = new (Alloc) RelType;
+      Rel->setSymbolAndType(0, Target->getRelativeReloc(), Config->Mips64EL);
+      Rel->r_offset = RI.r_offset;
+      Out<ELFT>::RelaDyn->addReloc({&C, Rel});
+    }
+
     bool NeedsGot = false;
     bool NeedsPlt = false;
     if (Body) {