MipsRelocator.h revision d0fbbb227051be16931a1aa9b4a7722ac039c698
1//===- MipsRelocator.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 MIPS_RELOCATION_FACTORY_H
10#define MIPS_RELOCATION_FACTORY_H
11#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14
15#include <mcld/LD/Relocator.h>
16#include <mcld/Support/GCFactory.h>
17#include <mcld/Target/SymbolEntryMap.h>
18#include "MipsLDBackend.h"
19
20namespace mcld {
21
22/** \class MipsRelocator
23 *  \brief MipsRelocator creates and destroys the Mips relocations.
24 */
25class MipsRelocator : public Relocator
26{
27public:
28  typedef SymbolEntryMap<MipsGOTEntry> SymGOTMap;
29
30public:
31  MipsRelocator(MipsGNULDBackend& pParent);
32
33  Result applyRelocation(Relocation& pRelocation);
34
35  MipsGNULDBackend& getTarget()
36  { return m_Target; }
37
38  const MipsGNULDBackend& getTarget() const
39  { return m_Target; }
40
41  // Get last calculated AHL.
42  int32_t getAHL() const
43  { return m_AHL; }
44
45  // Set last calculated AHL.
46  void setAHL(int32_t pAHL)
47  { m_AHL = pAHL; }
48
49  const char* getName(Relocation::Type pType) const;
50
51  const SymGOTMap& getSymGOTMap() const { return m_SymGOTMap; }
52  SymGOTMap&       getSymGOTMap()       { return m_SymGOTMap; }
53
54private:
55  MipsGNULDBackend& m_Target;
56  int32_t m_AHL;
57  SymGOTMap m_SymGOTMap;
58};
59
60} // namespace of mcld
61
62#endif
63