//===- lib/ReaderWriter/ELF/Mips/MipsTargetLayout.h -----------------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLD_READER_WRITER_ELF_MIPS_MIPS_TARGET_LAYOUT_H #define LLD_READER_WRITER_ELF_MIPS_MIPS_TARGET_LAYOUT_H #include "MipsAbiInfoHandler.h" #include "MipsSectionChunks.h" #include "TargetLayout.h" namespace lld { namespace elf { class MipsLinkingContext; /// \brief TargetLayout for Mips template class MipsTargetLayout final : public TargetLayout { public: enum MipsSectionOrder { ORDER_MIPS_ABI_FLAGS = TargetLayout::ORDER_RO_NOTE + 1, ORDER_MIPS_REGINFO, ORDER_MIPS_OPTIONS, }; MipsTargetLayout(MipsLinkingContext &ctx, MipsAbiInfoHandler &abi); const MipsGOTSection &getGOTSection() const { return *_gotSection; } const MipsPLTSection &getPLTSection() const { return *_pltSection; } AtomSection * createSection(StringRef name, int32_t type, DefinedAtom::ContentPermissions permissions, typename TargetLayout::SectionOrder order) override; typename TargetLayout::SegmentType getSegmentType(const Section *section) const override; /// \brief GP offset relative to .got section. uint64_t getGPOffset() const { return 0x7FF0; } /// \brief Get '_gp' symbol address. uint64_t getGPAddr(); /// \brief Return the section order for a input section typename TargetLayout::SectionOrder getSectionOrder(StringRef name, int32_t contentType, int32_t contentPermissions) override; protected: unique_bump_ptr> createRelocationTable(StringRef name, int32_t order) override; uint64_t getLookupSectionFlags(const OutputSection *os) const override; void sortSegments() override; private: MipsAbiInfoHandler &_abiInfo; MipsGOTSection *_gotSection; MipsPLTSection *_pltSection; uint64_t _gpAddr = 0; std::once_flag _gpOnce; }; } // end namespace elf } // end namespace lld #endif