[lld] r249793 - Simplify expressions. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 17:50:06 PDT 2015


Author: ruiu
Date: Thu Oct  8 19:50:05 2015
New Revision: 249793

URL: http://llvm.org/viewvc/llvm-project?rev=249793&view=rev
Log:
Simplify expressions. 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=249793&r1=249792&r2=249793&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Oct  8 19:50:05 2015
@@ -113,12 +113,11 @@ PltSection<ELFT>::PltSection()
 }
 
 template <class ELFT> void PltSection<ELFT>::writeTo(uint8_t *Buf) {
-  uintptr_t Start = reinterpret_cast<uintptr_t>(Buf);
+  uint8_t *Start = Buf;
   for (const SymbolBody *E : Entries) {
-    uint64_t GotEntryAddr = Out<ELFT>::Got->getEntryAddr(*E);
-    uintptr_t InstPos = reinterpret_cast<uintptr_t>(Buf);
-    uint64_t PltEntryAddr = (InstPos - Start) + this->getVA();
-    Target->writePltEntry(Buf, GotEntryAddr, PltEntryAddr);
+    uint64_t Got = Out<ELFT>::Got->getEntryAddr(*E);
+    uint64_t Plt = Buf - Start + this->getVA();
+    Target->writePltEntry(Buf, Got, Plt);
     Buf += Target->getPltEntrySize();
   }
 }




More information about the llvm-commits mailing list