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 <mcld/Target/GOT.h> 16 17 namespace mcld { 18 19 class LDSection; 20 class SectionData; 21 22 /** \class X86_32GOTEntry 23 * \brief GOT Entry with size of 4 bytes 24 */ 25 class X86_32GOTEntry : public GOT::Entry<4> 26 { 27 public: 28 X86_32GOTEntry(uint64_t pContent, SectionData* pParent) 29 : GOT::Entry<4>(pContent, pParent) 30 {} 31 }; 32 33 /** \class X86_32GOT 34 * \brief X86_32 Global Offset Table. 35 */ 36 37 class X86_32GOT : public GOT 38 { 39 public: 40 X86_32GOT(LDSection& pSection); 41 42 ~X86_32GOT(); 43 44 void reserve(size_t pNum = 1); 45 46 X86_32GOTEntry* consume(); 47 48 private: 49 X86_32GOTEntry* m_pLast; ///< the last consumed entry 50 }; 51 52 /** \class X86_64GOTEntry 53 * \brief GOT Entry with size of 8 bytes 54 */ 55 class X86_64GOTEntry : public GOT::Entry<8> 56 { 57 public: 58 X86_64GOTEntry(uint64_t pContent, SectionData* pParent) 59 : GOT::Entry<8>(pContent, pParent) 60 {} 61 }; 62 63 /** \class X86_64GOT 64 * \brief X86_64 Global Offset Table. 65 */ 66 67 class X86_64GOT : public GOT 68 { 69 public: 70 X86_64GOT(LDSection& pSection); 71 72 ~X86_64GOT(); 73 74 void reserve(size_t pNum = 1); 75 76 X86_64GOTEntry* consume(); 77 78 private: 79 X86_64GOTEntry* m_pLast; ///< the last consumed entry 80 }; 81 82 } // namespace of mcld 83 84 #endif 85 86