Home | History | Annotate | Download | only in X86
      1 //===-  X86RelocationFactory.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 X86_RELOCATION_FACTORY_H
     10 #define X86_RELOCATION_FACTORY_H
     11 #ifdef ENABLE_UNITTEST
     12 #include <gtest.h>
     13 #endif
     14 
     15 #include <mcld/LD/RelocationFactory.h>
     16 #include <mcld/Target/GOT.h>
     17 #include "X86LDBackend.h"
     18 
     19 namespace mcld
     20 {
     21 
     22 /** \class X86RelocationFactory
     23  *  \brief X86RelocationFactory creates and destroys the X86 relocations.
     24  *
     25  */
     26 class X86RelocationFactory : public RelocationFactory
     27 {
     28 public:
     29   /** \enum Reloc
     30    *  \brief Reloc is the result of applying functions.
     31    */
     32   enum Result
     33   {
     34     OK,
     35     Overflow,
     36     BadReloc
     37   };
     38 
     39 public:
     40   X86RelocationFactory(size_t pNum, X86GNULDBackend& pParent);
     41   ~X86RelocationFactory();
     42 
     43   void applyRelocation(Relocation& pRelocation, const MCLDInfo& pLDInfo);
     44 
     45   X86GNULDBackend& getTarget()
     46   { return m_Target; }
     47 
     48   const X86GNULDBackend& getTarget() const
     49   { return m_Target; }
     50 
     51 private:
     52   X86GNULDBackend& m_Target;
     53 };
     54 
     55 } // namespace of mcld
     56 
     57 #endif
     58