X86GOTPLT.h revision abe0db302735bbdf9cd84caee2a36e6c4538fc4d
1//===- X86GOTPLT.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_X86_GOTPLT_H 10#define MCLD_X86_GOTPLT_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14 15#include "mcld/Target/GOT.h" 16 17namespace mcld 18{ 19class LDSection; 20 21/** \class X86GOTPLT 22 * \brief X86 .got.plt section. 23 */ 24 25const unsigned int X86GOT0Num = 3; 26 27class X86GOTPLT : public GOT 28{ 29 typedef llvm::DenseMap<const ResolveInfo*, GOTEntry*> SymbolIndexMapType; 30 31public: 32 typedef llvm::MCSectionData::iterator iterator; 33 typedef llvm::MCSectionData::const_iterator const_iterator; 34 35public: 36 X86GOTPLT(LDSection &pSection, llvm::MCSectionData& pSectionData); 37 38 ~X86GOTPLT(); 39 40 iterator begin(); 41 42 const_iterator begin() const; 43 44 iterator end(); 45 46 const_iterator end() const; 47 48// For GOT0 49public: 50 void applyGOT0(const uint64_t pAddress); 51 52// For GOTPLT 53public: 54 void reserveGOTPLTEntry(); 55 56 void applyAllGOTPLT(const uint64_t pPLTBase); 57 58 GOTEntry*& lookupGOTPLTMap(const ResolveInfo& pSymbol); 59 60 iterator getNextGOTPLTEntry(); 61 62private: 63 iterator m_GOTPLTIterator; 64 SymbolIndexMapType m_GOTPLTMap; 65}; 66 67} // namespace of mcld 68 69#endif 70