MCELFObjectWriter.h revision bff66a86e6e44dc7424cd2d7719ac80630b3a5f8
1//===-- llvm/MC/MCELFObjectWriter.h - ELF Object Writer ---------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_MC_MCELFOBJECTWRITER_H
11#define LLVM_MC_MCELFOBJECTWRITER_H
12
13#include "llvm/MC/MCObjectWriter.h"
14#include "llvm/Support/DataTypes.h"
15
16namespace llvm {
17class MCELFObjectTargetWriter {
18  const Triple::OSType OSType;
19  const uint16_t EMachine;
20  const unsigned HasRelocationAddend : 1;
21  const unsigned Is64Bit : 1;
22protected:
23  MCELFObjectTargetWriter(bool Is64Bit_, Triple::OSType OSType_,
24                          uint16_t EMachine_,  bool HasRelocationAddend_);
25
26public:
27  virtual ~MCELFObjectTargetWriter();
28
29  /// @name Accessors
30  /// @{
31  Triple::OSType getOSType() { return OSType; }
32  uint16_t getEMachine() { return EMachine; }
33  bool hasRelocationAddend() { return HasRelocationAddend; }
34  bool is64Bit() { return Is64Bit; }
35  /// @}
36};
37
38/// \brief Construct a new ELF writer instance.
39///
40/// \param MOTW - The target specific ELF writer subclass.
41/// \param OS - The stream to write to.
42/// \returns The constructed object writer.
43MCObjectWriter *createELFObjectWriter(MCELFObjectTargetWriter *MOTW,
44                                      raw_ostream &OS, bool IsLittleEndian);
45} // End llvm namespace
46
47#endif
48