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