1 //===- ExecWriter.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_EXECUTABLE_OBJECT_WRITER_H 10 #define MCLD_EXECUTABLE_OBJECT_WRITER_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 #include <mcld/MC/MCLDOutput.h> 15 #include <mcld/LD/LDWriter.h> 16 #include <llvm/Support/system_error.h> 17 18 namespace mcld 19 { 20 21 /** \class ExecWriter 22 * \brief ExecWriter provides an common interface for different object 23 * formats. 24 */ 25 class ExecWriter : public LDWriter 26 { 27 protected: 28 // force to have a TargetLDBackend ExecWriter(TargetLDBackend & pLDBackend)29 ExecWriter(TargetLDBackend& pLDBackend) 30 { } 31 32 public: ~ExecWriter()33 virtual ~ExecWriter() { } 34 35 virtual llvm::error_code writeExecutable(Output& pOutput) = 0; 36 }; 37 38 } // namespace of mcld 39 40 #endif 41 42