diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index c80afb46647f..8bdc2b0e5c4f 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -283,17 +283,15 @@ template void RelocationSection::writeTo(uint8_t *Buf) { Reloc = Target->getDynReloc(Type); P->setSymbolAndType(Sym, Reloc, Config->Mips64EL); - if (NeedsGot) { - if (LazyReloc) - P->r_offset = Out::GotPlt->getEntryAddr(*Body); - else - P->r_offset = Out::Got->getEntryAddr(*Body); - } else if (NeedsCopy) { + if (LazyReloc) + P->r_offset = Out::GotPlt->getEntryAddr(*Body); + else if (NeedsGot) + P->r_offset = Out::Got->getEntryAddr(*Body); + else if (NeedsCopy) P->r_offset = Out::Bss->getVA() + dyn_cast>(Body)->OffsetInBSS; - } else { + else P->r_offset = C.getOffset(RI.r_offset) + C.OutSec->getVA(); - } uintX_t OrigAddend = 0; if (IsRela && !NeedsGot)