[lld] r344076 - Calculate an offset only once. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 13:29:25 PDT 2018


Author: ruiu
Date: Tue Oct  9 13:29:24 2018
New Revision: 344076

URL: http://llvm.org/viewvc/llvm-project?rev=344076&view=rev
Log:
Calculate an offset only once. NFC.

Modified:
    lld/trunk/ELF/Arch/Hexagon.cpp

Modified: lld/trunk/ELF/Arch/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/Hexagon.cpp?rev=344076&r1=344075&r2=344076&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/Hexagon.cpp (original)
+++ lld/trunk/ELF/Arch/Hexagon.cpp Tue Oct  9 13:29:24 2018
@@ -254,11 +254,12 @@ void Hexagon::writePltHeader(uint8_t *Bu
   };
   memcpy(Buf, PltData, sizeof(PltData));
 
-  // offset from PLT0 to the GOT.
-  relocateOne(Buf, R_HEX_B32_PCREL_X, In.GotPlt->getVA() - In.Plt->getVA());
-  relocateOne(Buf + 4, R_HEX_6_PCREL_X,
-              In.GotPlt->getVA() - In.Plt->getVA());
+  // Offset from PLT0 to the GOT.
+  uint64_t Off = In.GotPlt->getVA() - In.Plt->getVA();
+  relocateOne(Buf, R_HEX_B32_PCREL_X, Off);
+  relocateOne(Buf + 4, R_HEX_6_PCREL_X, Off);
 }
+
 void Hexagon::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
                        uint64_t PltEntryAddr, int32_t Index,
                        unsigned RelOff) const {




More information about the llvm-commits mailing list