ARMToARMStub.h revision 0dea6bc96bb52346737966839ac68644f7939f58
1//===- ARMToARMStub.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_ARMTOARMSTUB_H
11#define TARGET_ARM_ARMTOARMSTUB_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 ARMToARMStub
25 *  \brief ARM stub for long call from ARM source to ARM target
26 *
27 */
28class ARMToARMStub : public Stub
29{
30public:
31  ARMToARMStub(bool pIsOutputPIC);
32
33  ~ARMToARMStub();
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  ARMToARMStub(const ARMToARMStub&);
51
52  ARMToARMStub& operator=(const ARMToARMStub&);
53
54  /// for doClone
55  ARMToARMStub(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  static const uint32_t PIC_TEMPLATE[];
65  static const uint32_t TEMPLATE[];
66  const uint32_t* m_pData;
67  std::string m_Name;
68  size_t m_Size;
69};
70
71} // namespace of mcld
72
73#endif
74