summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86RelocationFactory.h
blob: 6a6c372549f424fac06feec77b648b8211140009 (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
//===-  X86RelocationFactory.h --------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef X86_RELOCATION_FACTORY_H
#define X86_RELOCATION_FACTORY_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif

#include <mcld/LD/RelocationFactory.h>
#include <mcld/Target/GOT.h>
#include "X86LDBackend.h"

namespace mcld
{

/** \class X86RelocationFactory
 *  \brief X86RelocationFactory creates and destroys the X86 relocations.
 *
 */
class X86RelocationFactory : public RelocationFactory
{
public:
  /** \enum Reloc
   *  \brief Reloc is the result of applying functions.
   */
  enum Result
  {
    OK,
    Overflow,
    BadReloc
  };

public:
  X86RelocationFactory(size_t pNum, X86GNULDBackend& pParent);
  ~X86RelocationFactory();

  void applyRelocation(Relocation& pRelocation, const MCLDInfo& pLDInfo);

  X86GNULDBackend& getTarget()
  { return m_Target; }

  const X86GNULDBackend& getTarget() const
  { return m_Target; }

private:
  X86GNULDBackend& m_Target;
};

} // namespace of mcld

#endif