1 //===- llvm/MC/MCWinCOFFObjectWriter.h - Win COFF Object Writer -*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCWINCOFFOBJECTWRITER_H
10 #define LLVM_MC_MCWINCOFFOBJECTWRITER_H
12 #include "llvm/MC/MCObjectWriter.h"
21 class raw_pwrite_stream
;
23 class MCWinCOFFObjectTargetWriter
: public MCObjectTargetWriter
{
24 virtual void anchor();
26 const unsigned Machine
;
29 MCWinCOFFObjectTargetWriter(unsigned Machine_
);
32 virtual ~MCWinCOFFObjectTargetWriter() = default;
34 virtual Triple::ObjectFormatType
getFormat() const { return Triple::COFF
; }
35 static bool classof(const MCObjectTargetWriter
*W
) {
36 return W
->getFormat() == Triple::COFF
;
39 unsigned getMachine() const { return Machine
; }
40 virtual unsigned getRelocType(MCContext
&Ctx
, const MCValue
&Target
,
41 const MCFixup
&Fixup
, bool IsCrossSection
,
42 const MCAsmBackend
&MAB
) const = 0;
43 virtual bool recordRelocation(const MCFixup
&) const { return true; }
46 /// Construct a new Win COFF writer instance.
48 /// \param MOTW - The target specific WinCOFF writer subclass.
49 /// \param OS - The stream to write to.
50 /// \returns The constructed object writer.
51 std::unique_ptr
<MCObjectWriter
>
52 createWinCOFFObjectWriter(std::unique_ptr
<MCWinCOFFObjectTargetWriter
> MOTW
,
53 raw_pwrite_stream
&OS
);
54 } // end namespace llvm
56 #endif // LLVM_MC_MCWINCOFFOBJECTWRITER_H