[lld] r250080 - Instead of computing offset from current and start, use a variable. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 11:56:36 PDT 2015


Author: ruiu
Date: Mon Oct 12 13:56:36 2015
New Revision: 250080

URL: http://llvm.org/viewvc/llvm-project?rev=250080&view=rev
Log:
Instead of computing offset from current and start, use a variable. 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=250080&r1=250079&r2=250080&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Mon Oct 12 13:56:36 2015
@@ -68,12 +68,12 @@ PltSection<ELFT>::PltSection()
 }
 
 template <class ELFT> void PltSection<ELFT>::writeTo(uint8_t *Buf) {
-  uint8_t *Start = Buf;
+  size_t Off = 0;
   for (const SymbolBody *E : Entries) {
     uint64_t Got = Out<ELFT>::Got->getEntryAddr(*E);
-    uint64_t Plt = Buf - Start + this->getVA();
-    Target->writePltEntry(Buf, Got, Plt);
-    Buf += Target->getPltEntrySize();
+    uint64_t Plt = this->getVA() + Off;
+    Target->writePltEntry(Buf + Off, Got, Plt);
+    Off += Target->getPltEntrySize();
   }
 }
 




More information about the llvm-commits mailing list