ARMToTHMStub.h revision 533eae20118036f425f27bf0536ef0ccbb090b65
1//===- ARMToTHMStub.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
10#ifndef TARGET_ARM_ARMTOTHMSTUB_H
11#define TARGET_ARM_ARMTOTHMSTUB_H
12
13#include <llvm/Support/DataTypes.h>
14#include <mcld/Fragment/Stub.h>
15#include <string>
16#include <vector>
17
18namespace mcld
19{
20
21class Relocation;
22class ResolveInfo;
23
24/** \class ARMToTHMStub
25 *  \brief ARM stub for long call from ARM source to ARM target
26 *
27 */
28class ARMToTHMStub : public Stub
29{
30public:
31  ARMToTHMStub(bool pIsOutputPIC);
32
33  ~ARMToTHMStub();
34
35  // isMyDuty
36  bool isMyDuty(const class Relocation& pReloc,
37                uint64_t pSource,
38                uint64_t pTargetSymValue) const;
39
40  // observers
41  const std::string& name() const;
42
43  const uint8_t* getContent() const;
44
45  size_t size() const;
46
47  size_t alignment() const;
48
49private:
50  ARMToTHMStub(const ARMToTHMStub&);
51
52  ARMToTHMStub& operator=(const ARMToTHMStub&);
53
54  /// for doClone
55  ARMToTHMStub(const uint32_t* pData,
56               size_t pSize,
57               const_fixup_iterator pBegin,
58               const_fixup_iterator pEnd);
59
60  /// doClone
61  Stub* doClone();
62
63private:
64  std::string m_Name;
65  static const uint32_t PIC_TEMPLATE[];
66  static const uint32_t TEMPLATE[];
67  const uint32_t* m_pData;
68  size_t m_Size;
69};
70
71} // namespace of mcld
72
73#endif
74