From 614be596926564664f1e01cfd33372bdbc69c5d8 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 13 Mar 2016 05:23:40 +0000 Subject: [PATCH] Simplify. NFC. llvm-svn: 263373 --- lld/ELF/OutputSections.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 1f72e12..d237f33 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -261,19 +261,12 @@ typename ELFFile::uintX_t DynamicReloc::getOffset() const { template void RelocationSection::writeTo(uint8_t *Buf) { for (const DynamicReloc &Rel : Relocs) { - auto *P = reinterpret_cast(Buf); + auto *P = reinterpret_cast(Buf); Buf += IsRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel); SymbolBody *Sym = Rel.Sym; - if (IsRela) { - uintX_t VA; - if (Rel.UseSymVA) - VA = Sym->getVA(Rel.Addend); - else - VA = Rel.Addend; - reinterpret_cast(P)->r_addend = VA; - } - + if (IsRela) + P->r_addend = Rel.UseSymVA ? Sym->getVA(Rel.Addend) : Rel.Addend; P->r_offset = Rel.getOffset(); uint32_t SymIdx = (!Rel.UseSymVA && Sym) ? Sym->DynsymIndex : 0; P->setSymbolAndType(SymIdx, Rel.Type, Config->Mips64EL); -- 2.7.4