1//===- X86GOT.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_TARGET_X86_GOT_H 10#define MCLD_TARGET_X86_GOT_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14 15#include "X86PLT.h" 16 17#include <mcld/Target/GOT.h> 18#include <mcld/LD/SectionData.h> 19 20namespace mcld 21{ 22class LDSection; 23 24/** \class X86GOT 25 * \brief X86 Global Offset Table. 26 */ 27 28class X86GOT : public GOT 29{ 30 typedef llvm::DenseMap<const ResolveInfo*, GOTEntry*> SymbolIndexMapType; 31 32public: 33 typedef SectionData::iterator iterator; 34 typedef SectionData::const_iterator const_iterator; 35 36public: 37 X86GOT(LDSection& pSection, SectionData& pSectionData); 38 39 ~X86GOT(); 40 41 //Reserve general GOT entries. 42 void reserveEntry(size_t pNum = 1); 43 44 GOTEntry* getEntry(const ResolveInfo& pSymbol, bool& pExist); 45 46 iterator begin(); 47 48 const_iterator begin() const; 49 50 iterator end(); 51 52 const_iterator end() const; 53 54private: 55 /// m_GOTIterator - point to the first valid entry in GOT list 56 iterator m_GOTIterator; 57 58 /// m_fIsVisit - first time visit the function getEntry() or not 59 bool m_fIsVisit; 60 61 SymbolIndexMapType m_GOTMap; 62}; 63 64} // namespace of mcld 65 66#endif 67 68