diff options
-rw-r--r-- | lld/ELF/OutputSections.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/OutputSections.h | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 6b8bd835830..b9af139208a 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -34,7 +34,7 @@ GotSection<ELFT>::GotSection() : OutputSectionBase<ELFT::Is64Bits>(".got", llvm::ELF::SHT_PROGBITS, llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE) { - this->Header.sh_addralign = this->getAddrSize(); + this->Header.sh_addralign = sizeof(uintX_t); } template <class ELFT> void GotSection<ELFT>::addEntry(SymbolBody *Sym) { @@ -45,7 +45,7 @@ template <class ELFT> void GotSection<ELFT>::addEntry(SymbolBody *Sym) { template <class ELFT> typename GotSection<ELFT>::uintX_t GotSection<ELFT>::getEntryAddr(const SymbolBody &B) const { - return this->getVA() + B.GotIndex * this->getAddrSize(); + return this->getVA() + B.GotIndex * sizeof(uintX_t); } template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) { diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index a8c597b03bf..4d23c4b6fb4 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -85,8 +85,6 @@ public: } uint32_t getType() { return Header.sh_type; } - static unsigned getAddrSize() { return Is64Bits ? 8 : 4; } - virtual void finalize() {} virtual void writeTo(uint8_t *Buf) = 0; @@ -105,7 +103,7 @@ class GotSection final : public OutputSectionBase<ELFT::Is64Bits> { public: GotSection(); void finalize() override { - this->Header.sh_size = Entries.size() * this->getAddrSize(); + this->Header.sh_size = Entries.size() * sizeof(uintX_t); } void writeTo(uint8_t *Buf) override; void addEntry(SymbolBody *Sym); |