MipsLA25Stub.h revision 87f34658dec9097d987d254a990ea7f311bfc95f
1//===- MipsLA25Stub.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#ifndef MCLD_MIPS_LA25_STUB_H
10#define MCLD_MIPS_LA25_STUB_H
11#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14
15#include <mcld/Fragment/Stub.h>
16
17namespace mcld
18{
19
20class MipsGNULDBackend;
21class Relocation;
22
23//===----------------------------------------------------------------------===//
24// MipsLA25Stub
25//===----------------------------------------------------------------------===//
26/** \class MipsLA25Stub
27 *  \brief Mips stub for a non-PIC interface to a PIC function.
28 */
29class MipsLA25Stub : public Stub
30{
31public:
32  MipsLA25Stub(const MipsGNULDBackend& pTarget);
33
34private:
35  // Stub
36  Stub* doClone();
37  bool isMyDuty(const Relocation& pReloc,
38                uint64_t pSource,
39                uint64_t pTargetSymValue) const;
40  const std::string& name() const;
41  const uint8_t* getContent() const;
42  size_t size() const;
43  size_t alignment() const;
44
45private:
46  MipsLA25Stub(const MipsLA25Stub&);
47  MipsLA25Stub& operator=(const MipsLA25Stub&);
48
49  MipsLA25Stub(const MipsGNULDBackend& pTarget,
50               const uint32_t* pData,
51               size_t pSize,
52               const_fixup_iterator pBegin,
53               const_fixup_iterator pEnd);
54
55private:
56  const MipsGNULDBackend& m_Target;
57  const std::string m_Name;
58  const uint32_t* m_pData;
59  const size_t m_Size;
60};
61
62} // namespace of mcld
63
64#endif
65