ELFObjectWriter.h revision d0fbbb227051be16931a1aa9b4a7722ac039c698
1//===- ELFObjectWriter.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_ELF_OBJECT_WRITER_H
10#define MCLD_ELF_OBJECT_WRITER_H
11#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14#include <mcld/LD/ObjectWriter.h>
15#include <mcld/LD/ELFWriter.h>
16
17#include <llvm/Support/system_error.h>
18
19namespace mcld {
20
21class Module;
22class LinkerConfig;
23class MemoryArea;
24class GNULDBackend;
25
26/** \class ELFObjectWriter
27 *  \brief ELFObjectWriter writes the target-independent parts of object files.
28 *  ELFObjectWriter reads a MCLDFile and writes into raw_ostream
29 *
30 */
31class ELFObjectWriter : public ObjectWriter, protected ELFWriter
32{
33public:
34  ELFObjectWriter(GNULDBackend& pBackend,
35                  const LinkerConfig& pConfig);
36
37  ~ELFObjectWriter();
38
39  llvm::error_code writeObject(Module& pModule, MemoryArea& pOutput);
40
41private:
42  const LinkerConfig& m_Config;
43};
44
45} // namespace of mcld
46
47#endif
48
49