Simplify mips got handling.

This avoids computing the address of a position in the got just to then
subtract got->getva().

llvm-svn: 266831
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 3421eb3..71b2664 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -566,9 +566,12 @@
     }
 
     // If a relocation needs GOT, we create a GOT slot for the symbol.
-    if (Expr == R_GOT || Expr == R_MIPS_GOT || Expr == R_MIPS_GOT_LOCAL ||
-        Expr == R_GOT_PAGE_PC || Expr == R_GOT_PC || Expr == R_GOT_FROM_END) {
+    if (Expr == R_GOT || Expr == R_GOT_OFF || Expr == R_MIPS_GOT ||
+        Expr == R_MIPS_GOT_LOCAL || Expr == R_GOT_PAGE_PC || Expr == R_GOT_PC ||
+        Expr == R_GOT_FROM_END) {
       uint32_t T = Body.isTls() ? Target->getTlsGotRel(Type) : Type;
+      if (Config->EMachine == EM_MIPS && Expr == R_GOT_OFF)
+        Addend -= MipsGPOffset;
       C.Relocations.push_back({Expr, T, Offset, Addend, &Body});
       if (Body.isInGot())
         continue;