Calculate an offset only once. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@344076 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/ELF/Arch/Hexagon.cpp b/ELF/Arch/Hexagon.cpp
index b585007..19bfa3e 100644
--- a/ELF/Arch/Hexagon.cpp
+++ b/ELF/Arch/Hexagon.cpp
@@ -254,11 +254,12 @@
};
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 {