[lld] r263373 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 12 21:23:40 PST 2016
Author: ruiu
Date: Sat Mar 12 23:23:40 2016
New Revision: 263373
URL: http://llvm.org/viewvc/llvm-project?rev=263373&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/OutputSections.cpp
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=263373&r1=263372&r2=263373&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Sat Mar 12 23:23:40 2016
@@ -261,19 +261,12 @@ typename ELFFile<ELFT>::uintX_t DynamicR
template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
for (const DynamicReloc<ELFT> &Rel : Relocs) {
- auto *P = reinterpret_cast<Elf_Rel *>(Buf);
+ auto *P = reinterpret_cast<Elf_Rela *>(Buf);
Buf += IsRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel);
SymbolBody *Sym = Rel.Sym;
- if (IsRela) {
- uintX_t VA;
- if (Rel.UseSymVA)
- VA = Sym->getVA<ELFT>(Rel.Addend);
- else
- VA = Rel.Addend;
- reinterpret_cast<Elf_Rela *>(P)->r_addend = VA;
- }
-
+ if (IsRela)
+ P->r_addend = Rel.UseSymVA ? Sym->getVA<ELFT>(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);
More information about the llvm-commits
mailing list