diff options
author | Rui Ueyama <ruiu@google.com> | 2018-10-09 20:29:24 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2018-10-09 20:29:24 +0000 |
commit | e3ccd2866047e8f034c67e75fda72537eea0ce7c (patch) | |
tree | 26945011b002216ea9d5b83b16cf4785c2f29c81 | |
parent | fbc629702d69bf7ca8a73106f1df52a0c33b54c5 (diff) | |
download | bcm5719-llvm-e3ccd2866047e8f034c67e75fda72537eea0ce7c.tar.gz bcm5719-llvm-e3ccd2866047e8f034c67e75fda72537eea0ce7c.zip |
Calculate an offset only once. NFC.
llvm-svn: 344076
-rw-r--r-- | lld/ELF/Arch/Hexagon.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp index b5850070612..19bfa3ea338 100644 --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -254,11 +254,12 @@ void Hexagon::writePltHeader(uint8_t *Buf) const { }; 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 { |