diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index dc544fac40c9..e19680440cc6 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -465,7 +465,7 @@ void InputSection::copyRelocations(uint8_t *buf, ArrayRef rels) { if (!RelTy::IsRela) addend = target->getImplicitAddend(bufLoc, type); - if (config->emachine == EM_MIPS && config->relocatable && + if (config->emachine == EM_MIPS && target->getRelExpr(type, sym, bufLoc) == R_MIPS_GOTREL) { // Some MIPS relocations depend on "gp" value. By default, // this value has 0x7ff0 offset from a .got section. But