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