ARMPLT.h revision affc150dc44fab1911775a49636d0ce85333b634
1//===- ARMPLT.h -----------------------------------------------------===// 2// 3// The MCLinker Project 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9#ifndef MCLD_ARM_PLT_H 10#define MCLD_ARM_PLT_H 11 12#include <mcld/Target/PLT.h> 13 14namespace mcld { 15 16class ARMGOT; 17class GOTEntry; 18class MemoryRegion; 19 20class ARMPLT0 : public PLTEntry { 21public: 22 ARMPLT0(llvm::MCSectionData* pParent); 23}; 24 25class ARMPLT1 : public PLTEntry { 26public: 27 ARMPLT1(llvm::MCSectionData* pParent); 28}; 29 30/** \class ARMPLT 31 * \brief ARM Procedure Linkage Table 32 */ 33class ARMPLT : public PLT 34{ 35 typedef llvm::DenseMap<const ResolveInfo*, ARMPLT1*> SymbolIndexType; 36 37public: 38 typedef llvm::MCSectionData::iterator iterator; 39 typedef llvm::MCSectionData::const_iterator const_iterator; 40 41public: 42 ARMPLT(LDSection& pSection, 43 llvm::MCSectionData& pSectionData, 44 ARMGOT& pGOTPLT); 45 ~ARMPLT(); 46 47// Override virtual function. 48public: 49 50 // reserveEntry is ARMGOT friend function. 51 void reserveEntry(size_t pNum = 1) ; 52 53 PLTEntry* getPLTEntry(const ResolveInfo& pSymbol, bool& pExist) ; 54 55 GOTEntry* getGOTPLTEntry(const ResolveInfo& pSymbol, bool& pExist); 56 57public: 58 iterator begin() { return m_SectionData.begin(); } 59 60 const_iterator begin() const { return m_SectionData.begin(); } 61 62 iterator end() { return m_SectionData.end(); } 63 64 const_iterator end() const { return m_SectionData.end(); } 65 66 ARMPLT0* getPLT0() const; 67 68 void applyPLT0(); 69 70 void applyPLT1(); 71 72 uint64_t emit(MemoryRegion& pRegion); 73 74private: 75 ARMGOT& m_GOT; 76 77 // Used by getEntry() for mapping a ResolveInfo 78 // instance to a PLT1 Entry. 79 iterator m_PLTEntryIterator; 80 81 SymbolIndexType m_PLTEntryMap; 82}; 83 84} // namespace of mcld 85 86#endif 87 88