summaryrefslogtreecommitdiff
path: root/lib/Target/Hexagon/HexagonAbsoluteStub.h
blob: 0f863184487fede1021a6d289384ba52b48ae376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//===- HexagonAbsoluteStub.h -----------------------------------------------===//
//
//                     The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef TARGET_HEXAGON_HEXAGONABSOLUTESTUB_H
#define TARGET_HEXAGON_HEXAGONABSOLUTESTUB_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif

#include <llvm/Support/DataTypes.h>
#include <mcld/Fragment/Stub.h>
#include <string>
#include <vector>

namespace mcld
{

class Relocation;
class ResolveInfo;

/** \class HexagonAbsoluteStub
 *  \brief Hexagon stub for abs long call from source to target
 *
 */
class HexagonAbsoluteStub : public Stub
{
public:
  HexagonAbsoluteStub(bool pIsOutputPIC);

  ~HexagonAbsoluteStub();

  // isMyDuty
  bool isMyDuty(const class Relocation& pReloc,
                uint64_t pSource,
                uint64_t pTargetSymValue) const;

  // observers
  const std::string& name() const;

  const uint8_t* getContent() const;

  size_t size() const;

  size_t alignment() const;

private:
  HexagonAbsoluteStub(const HexagonAbsoluteStub&);

  HexagonAbsoluteStub& operator=(const HexagonAbsoluteStub&);

  /// for doClone
  HexagonAbsoluteStub(const uint32_t* pData,
               size_t pSize,
               const_fixup_iterator pBegin,
               const_fixup_iterator pEnd);

  /// doClone
  Stub* doClone();

private:
  std::string m_Name;
  static const uint32_t TEMPLATE[];
  const uint32_t* m_pData;
  size_t m_Size;
};

} // namespace of mcld

#endif