Home | History | Annotate | Download | only in ARM
      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 
     18 namespace mcld
     19 {
     20 
     21 class Relocation;
     22 class ResolveInfo;
     23 
     24 /** \class ARMToTHMStub
     25  *  \brief ARM stub for long call from ARM source to ARM target
     26  *
     27  */
     28 class ARMToTHMStub : public Stub
     29 {
     30 public:
     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 
     49 private:
     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 
     63 private:
     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