summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86GOT.h
blob: 91647b9eeb03b1bd1940515c6dc5053a459960fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//===- X86GOT.h -----------------------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef TARGET_X86_X86GOT_H
#define TARGET_X86_X86GOT_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif

#include <mcld/Target/GOT.h>

namespace mcld {

class LDSection;
class SectionData;

/** \class X86_32GOTEntry
 *  \brief GOT Entry with size of 4 bytes
 */
class X86_32GOTEntry : public GOT::Entry<4>
{
public:
  X86_32GOTEntry(uint64_t pContent, SectionData* pParent)
   : GOT::Entry<4>(pContent, pParent)
  {}
};

/** \class X86_32GOT
 *  \brief X86_32 Global Offset Table.
 */

class X86_32GOT : public GOT
{
public:
  X86_32GOT(LDSection& pSection);

  ~X86_32GOT();

  X86_32GOTEntry* create();
};

/** \class X86_64GOTEntry
 *  \brief GOT Entry with size of 8 bytes
 */
class X86_64GOTEntry : public GOT::Entry<8>
{
public:
  X86_64GOTEntry(uint64_t pContent, SectionData* pParent)
   : GOT::Entry<8>(pContent, pParent)
  {}
};

/** \class X86_64GOT
 *  \brief X86_64 Global Offset Table.
 */

class X86_64GOT : public GOT
{
public:
  X86_64GOT(LDSection& pSection);

  ~X86_64GOT();

  X86_64GOTEntry* create();

private:
  X86_64GOTEntry* m_pLast; ///< the last consumed entry
};

} // namespace of mcld

#endif