Home | History | Annotate | Download | only in ARM
      1 //===- THMToARMStub.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_THMToARMStub_H
     11 #define MCLD_ARM_THMToARMStub_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 THMToARMStub
     28  *  \brief ARM stub for long call from ARM source to ARM target
     29  *
     30  */
     31 class THMToARMStub : public Stub
     32 {
     33 public:
     34   THMToARMStub(bool pIsOutputPIC);
     35 
     36   ~THMToARMStub();
     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   // for T bit of this stub
     53   uint64_t initSymValue() const;
     54 
     55 private:
     56   THMToARMStub(const THMToARMStub&);
     57 
     58   THMToARMStub& operator=(const THMToARMStub&);
     59 
     60   /// for doClone
     61   THMToARMStub(const uint32_t* pData,
     62                size_t pSize,
     63                const_fixup_iterator pBegin,
     64                const_fixup_iterator pEnd);
     65 
     66   /// doClone
     67   Stub* doClone();
     68 
     69 private:
     70   std::string m_Name;
     71   static const uint32_t PIC_TEMPLATE[];
     72   static const uint32_t TEMPLATE[];
     73   const uint32_t* m_pData;
     74   size_t m_Size;
     75 };
     76 
     77 } // namespace of mcld
     78 
     79 #endif
     80