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