HexagonAbsoluteStub.h revision f7ac0f19a1c8d0ad14bcf6456ce368b830fea886
1//===- HexagonAbsoluteStub.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_HEXAGON_ABSOLUTE_STUB_H
11#define MCLD_HEXAGON_ABSOLUTE_STUB_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
21namespace mcld
22{
23
24class Relocation;
25class ResolveInfo;
26
27/** \class HexagonAbsoluteStub
28 *  \brief Hexagon stub for abs long call from source to target
29 *
30 */
31class HexagonAbsoluteStub : public Stub
32{
33public:
34  HexagonAbsoluteStub(bool pIsOutputPIC);
35
36  ~HexagonAbsoluteStub();
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
52private:
53  HexagonAbsoluteStub(const HexagonAbsoluteStub&);
54
55  HexagonAbsoluteStub& operator=(const HexagonAbsoluteStub&);
56
57  /// for doClone
58  HexagonAbsoluteStub(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
66private:
67  std::string m_Name;
68  static const uint32_t TEMPLATE[];
69  const uint32_t* m_pData;
70  size_t m_Size;
71};
72
73} // namespace of mcld
74
75#endif
76