[ELF] Add ELFTargetRelocationHandler.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 30 Jan 2013 05:25:44 +0000 (05:25 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 30 Jan 2013 05:25:44 +0000 (05:25 +0000)
llvm-svn: 173896

lld/lib/ReaderWriter/ELF/DefaultTargetHandler.h
lld/lib/ReaderWriter/ELF/TargetHandler.h

index 938b80f..d0009fb 100644 (file)
@@ -45,6 +45,10 @@ public:
     llvm_unreachable("Target should provide implementation for function ");
   }
 
+  const TargetRelocationHandler<ELFT> &getRelocationHandler() const {
+    llvm_unreachable("Target should provide implementation for function ");
+  }
+
   /// Create a set of Default target sections that a target might needj
   void createDefaultSections() {}
 
index 45afb94..9e4a63b 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef LLD_READER_WRITER_ELF_TARGET_HANDLER_H
 #define LLD_READER_WRITER_ELF_TARGET_HANDLER_H
 
+#include "Layout.h"
+
 #include "lld/Core/InputFiles.h"
 #include "lld/Core/LinkerOptions.h"
 #include "lld/Core/LLVM.h"
@@ -23,6 +25,7 @@
 #include "lld/ReaderWriter/ELFTargetInfo.h"
 
 #include "llvm/ADT/Hashing.h"
+#include "llvm/Support/FileOutputBuffer.h"
 
 #include <memory>
 #include <vector>
@@ -31,6 +34,7 @@
 namespace lld {
 namespace elf {
 template <class ELFT> class ELFDefinedAtom;
+class ELFWriter;
 template <class ELFT> class Header;
 template <class ELFT> class Section;
 template <class ELFT> class TargetLayout;
@@ -57,6 +61,13 @@ public:
   }
 };
 
+template <class ELFT> class TargetRelocationHandler {
+public:
+  virtual ErrorOr<void> applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
+                                        const AtomLayout &,
+                                        const Reference &)const = 0;
+};
+
 /// \brief An interface to override functions that are provided by the 
 /// the default ELF Layout
 template <class ELFT> class TargetHandler : public TargetHandlerBase {
@@ -102,6 +113,8 @@ public:
   /// TargetAtomHandler
   virtual TargetAtomHandler<ELFT> &targetAtomHandler() = 0;
 
+  virtual const TargetRelocationHandler<ELFT> &getRelocationHandler() const = 0;
+
   /// Create a set of Default target sections that a target might needj
   virtual void createDefaultSections() = 0;