diff options
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h')
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h index 83633c92699..480c69cf460 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h @@ -31,8 +31,10 @@ public: this->addEntry(DT_MIPS_RLD_VERSION, 1); // The .rld_map section address. - if (this->_ctx.isDynamic() && this->_ctx.getOutputELFType() == ET_EXEC) + if (this->_ctx.getOutputELFType() == ET_EXEC) { _dt_rldmap = this->addEntry(DT_MIPS_RLD_MAP, 0); + _dt_rldmaprel = this->addEntry(DT_MIPS_RLD_MAP_REL, 0); + } // MIPS flags. this->addEntry(DT_MIPS_FLAGS, RHF_NOTPOT); @@ -83,8 +85,13 @@ public: if (const auto *sec = _targetLayout.findOutputSection(".MIPS.options")) this->_entries[_dt_options].d_un.d_ptr = sec->virtualAddr(); - if (const auto *sec = _targetLayout.findOutputSection(".rld_map")) + if (const auto *sec = _targetLayout.findOutputSection(".rld_map")) { this->_entries[_dt_rldmap].d_un.d_ptr = sec->virtualAddr(); + this->_entries[_dt_rldmaprel].d_un.d_ptr = + sec->virtualAddr() - + (this->virtualAddr() + + _dt_rldmaprel * sizeof(typename DynamicTable<ELFT>::Elf_Dyn)); + } } int64_t getGotPltTag() override { return DT_MIPS_PLTGOT; } @@ -107,6 +114,7 @@ private: std::size_t _dt_baseaddr; std::size_t _dt_options; std::size_t _dt_rldmap; + std::size_t _dt_rldmaprel; MipsTargetLayout<ELFT> &_targetLayout; }; |

