diff options
-rw-r--r-- | lld/ELF/OutputSections.cpp | 5 | ||||
-rw-r--r-- | lld/ELF/OutputSections.h | 2 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 621405baee4..10d08c6c50d 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -395,8 +395,9 @@ template <class ELFT> unsigned RelocationSection<ELFT>::getRelocOffset() { } template <class ELFT> void RelocationSection<ELFT>::finalize() { - this->Header.sh_link = Static ? Out<ELFT>::SymTab->SectionIndex - : Out<ELFT>::DynSymTab->SectionIndex; + this->Header.sh_link = isOutputDynamic<ELFT>() + ? Out<ELFT>::DynSymTab->SectionIndex + : Out<ELFT>::SymTab->SectionIndex; this->Header.sh_size = Relocs.size() * this->Header.sh_entsize; } diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 5f5b691a319..bf8936685e2 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -328,8 +328,6 @@ public: void writeTo(uint8_t *Buf) override; bool hasRelocs() const { return !Relocs.empty(); } - bool Static = false; - private: bool Sort; std::vector<DynamicReloc<ELFT>> Relocs; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index bda9c8d2fbb..f078b8a89bb 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -838,10 +838,8 @@ template <class ELFT> void Writer<ELFT>::addPredefinedSections() { // We always need to add rel[a].plt to output if it has entries. // Even during static linking it can contain R_[*]_IRELATIVE relocations. - if (Out<ELFT>::RelaPlt && Out<ELFT>::RelaPlt->hasRelocs()) { + if (Out<ELFT>::RelaPlt && Out<ELFT>::RelaPlt->hasRelocs()) Add(Out<ELFT>::RelaPlt); - Out<ELFT>::RelaPlt->Static = !isOutputDynamic<ELFT>(); - } if (needsGot()) Add(Out<ELFT>::Got); |