From 4b5346fa49014d1f4347e126d9c5762798495703 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 29 Dec 2015 16:17:32 +0000 Subject: [PATCH] Reformat of conditions for calculating r_offset in RelocationSection::writeTo(). NFC. llvm-svn: 256563 --- lld/ELF/OutputSections.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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)