[lld][X86] Restore gotEntrySize.
D62727 removed GotEntrySize and GotPltEntrySize with a comment that they
are always equal to wordsize(), but that is not entirely true: X32 has a
word size of 4, but needs 8-byte GOT entries. This restores gotEntrySize
for both, adjusted for current naming conventions, but defaults it to
config->wordsize to keep things simple for architectures other than
x86_64.
This partially reverts D62727.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D102509
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 3ce6a98..39ff36a 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -160,7 +160,9 @@
return in.got->getVA() + getGotOffset();
}
-uint64_t Symbol::getGotOffset() const { return gotIndex * config->wordsize; }
+uint64_t Symbol::getGotOffset() const {
+ return gotIndex * target->gotEntrySize;
+}
uint64_t Symbol::getGotPltVA() const {
if (isInIplt)
@@ -170,8 +172,8 @@
uint64_t Symbol::getGotPltOffset() const {
if (isInIplt)
- return pltIndex * config->wordsize;
- return (pltIndex + target->gotPltHeaderEntriesNum) * config->wordsize;
+ return pltIndex * target->gotEntrySize;
+ return (pltIndex + target->gotPltHeaderEntriesNum) * target->gotEntrySize;
}
uint64_t Symbol::getPltVA() const {