blob: 7409daf390858332d8d7ef77895965bccf984bc5 [file] [log] [blame]
Chris Lattnereb72dca2010-07-11 22:05:00 +00001//===-- llvm/MC/WinCOFFStreamer.cpp -----------------------------*- 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// This file contains an implementation of a Win32 COFF object file streamer.
11//
12//===----------------------------------------------------------------------===//
13
14#define DEBUG_TYPE "WinCOFFStreamer"
15
16#include "llvm/MC/MCObjectStreamer.h"
17#include "llvm/MC/MCContext.h"
18#include "llvm/MC/MCSection.h"
19#include "llvm/MC/MCSymbol.h"
20#include "llvm/MC/MCExpr.h"
Michael J. Spencer8067adc2010-07-19 06:13:10 +000021#include "llvm/MC/MCValue.h"
22#include "llvm/MC/MCAssembler.h"
23#include "llvm/MC/MCAsmLayout.h"
Chris Lattnereb72dca2010-07-11 22:05:00 +000024#include "llvm/MC/MCCodeEmitter.h"
25#include "llvm/MC/MCSectionCOFF.h"
Charles Davis3185f5c2011-05-22 03:01:05 +000026#include "llvm/MC/MCWin64EH.h"
Evan Cheng78c10ee2011-07-25 23:24:55 +000027#include "llvm/MC/MCAsmBackend.h"
Michael J. Spencer8067adc2010-07-19 06:13:10 +000028#include "llvm/ADT/StringMap.h"
29
Chris Lattnereb72dca2010-07-11 22:05:00 +000030#include "llvm/Support/COFF.h"
31#include "llvm/Support/Debug.h"
32#include "llvm/Support/ErrorHandling.h"
Evan Cheng3e74d6f2011-08-24 18:08:43 +000033#include "llvm/Support/TargetRegistry.h"
Chris Lattnereb72dca2010-07-11 22:05:00 +000034#include "llvm/Support/raw_ostream.h"
35using namespace llvm;
36
Chris Lattnereb72dca2010-07-11 22:05:00 +000037namespace {
38class WinCOFFStreamer : public MCObjectStreamer {
39public:
Michael J. Spencer8067adc2010-07-19 06:13:10 +000040 MCSymbol const *CurSymbol;
41
Chris Lattnereb72dca2010-07-11 22:05:00 +000042 WinCOFFStreamer(MCContext &Context,
Evan Cheng78c10ee2011-07-25 23:24:55 +000043 MCAsmBackend &MAB,
Chris Lattnereb72dca2010-07-11 22:05:00 +000044 MCCodeEmitter &CE,
45 raw_ostream &OS);
46
Michael J. Spencer8067adc2010-07-19 06:13:10 +000047 void AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
48 unsigned ByteAlignment, bool External);
49
Chris Lattnereb72dca2010-07-11 22:05:00 +000050 // MCStreamer interface
51
Rafael Espindolad80781b2010-09-15 21:48:40 +000052 virtual void InitSections();
Rafael Espindolaba210242010-11-28 16:22:59 +000053 virtual void EmitLabel(MCSymbol *Symbol);
Chris Lattnereb72dca2010-07-11 22:05:00 +000054 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
Jim Grosbachce792992010-11-05 22:08:08 +000055 virtual void EmitThumbFunc(MCSymbol *Func);
Chris Lattnereb72dca2010-07-11 22:05:00 +000056 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
57 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
58 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
59 virtual void BeginCOFFSymbolDef(MCSymbol const *Symbol);
60 virtual void EmitCOFFSymbolStorageClass(int StorageClass);
61 virtual void EmitCOFFSymbolType(int Type);
62 virtual void EndCOFFSymbolDef();
63 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
64 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000065 unsigned ByteAlignment);
Benjamin Kramer36a16012011-09-01 23:04:27 +000066 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
67 unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000068 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000069 unsigned Size,unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000070 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000071 uint64_t Size, unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000072 virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
Chris Lattnereb72dca2010-07-11 22:05:00 +000073 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000074 unsigned ValueSize, unsigned MaxBytesToEmit);
Chris Lattnereb72dca2010-07-11 22:05:00 +000075 virtual void EmitCodeAlignment(unsigned ByteAlignment,
76 unsigned MaxBytesToEmit);
Chris Lattnereb72dca2010-07-11 22:05:00 +000077 virtual void EmitFileDirective(StringRef Filename);
Chris Lattnereb72dca2010-07-11 22:05:00 +000078 virtual void EmitInstruction(const MCInst &Instruction);
Charles Davis3185f5c2011-05-22 03:01:05 +000079 virtual void EmitWin64EHHandlerData();
Chris Lattnereb72dca2010-07-11 22:05:00 +000080 virtual void Finish();
Michael J. Spencer192d1362010-10-09 15:44:27 +000081
82private:
Rafael Espindolaf89671d2010-11-01 16:27:31 +000083 virtual void EmitInstToFragment(const MCInst &Inst) {
84 llvm_unreachable("Not used by WinCOFF.");
85 }
86 virtual void EmitInstToData(const MCInst &Inst) {
87 llvm_unreachable("Not used by WinCOFF.");
88 }
89
Michael J. Spencer192d1362010-10-09 15:44:27 +000090 void SetSection(StringRef Section,
91 unsigned Characteristics,
92 SectionKind Kind) {
93 SwitchSection(getContext().getCOFFSection(Section, Characteristics, Kind));
94 }
95
96 void SetSectionText() {
97 SetSection(".text",
98 COFF::IMAGE_SCN_CNT_CODE
99 | COFF::IMAGE_SCN_MEM_EXECUTE
100 | COFF::IMAGE_SCN_MEM_READ,
101 SectionKind::getText());
102 EmitCodeAlignment(4, 0);
103 }
104
105 void SetSectionData() {
106 SetSection(".data",
107 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
108 | COFF::IMAGE_SCN_MEM_READ
109 | COFF::IMAGE_SCN_MEM_WRITE,
110 SectionKind::getDataRel());
111 EmitCodeAlignment(4, 0);
112 }
113
114 void SetSectionBSS() {
115 SetSection(".bss",
116 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
117 | COFF::IMAGE_SCN_MEM_READ
118 | COFF::IMAGE_SCN_MEM_WRITE,
119 SectionKind::getBSS());
120 EmitCodeAlignment(4, 0);
121 }
122
Chris Lattnereb72dca2010-07-11 22:05:00 +0000123};
124} // end anonymous namespace.
125
126WinCOFFStreamer::WinCOFFStreamer(MCContext &Context,
Evan Cheng78c10ee2011-07-25 23:24:55 +0000127 MCAsmBackend &MAB,
Chris Lattnereb72dca2010-07-11 22:05:00 +0000128 MCCodeEmitter &CE,
129 raw_ostream &OS)
Evan Cheng78c10ee2011-07-25 23:24:55 +0000130 : MCObjectStreamer(Context, MAB, OS, &CE)
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000131 , CurSymbol(NULL) {
132}
133
134void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
135 unsigned ByteAlignment, bool External) {
136 assert(!Symbol->isInSection() && "Symbol must not already have a section!");
137
138 std::string SectionName(".bss$linkonce");
139 SectionName.append(Symbol->getName().begin(), Symbol->getName().end());
140
141 MCSymbolData &SymbolData = getAssembler().getOrCreateSymbolData(*Symbol);
142
143 unsigned Characteristics =
144 COFF::IMAGE_SCN_LNK_COMDAT |
145 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
146 COFF::IMAGE_SCN_MEM_READ |
147 COFF::IMAGE_SCN_MEM_WRITE;
148
149 int Selection = COFF::IMAGE_COMDAT_SELECT_LARGEST;
150
151 const MCSection *Section = MCStreamer::getContext().getCOFFSection(
152 SectionName, Characteristics, Selection, SectionKind::getBSS());
153
154 MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
155
156 if (SectionData.getAlignment() < ByteAlignment)
157 SectionData.setAlignment(ByteAlignment);
158
159 SymbolData.setExternal(External);
160
161 Symbol->setSection(*Section);
162
163 if (ByteAlignment != 1)
164 new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, &SectionData);
165
166 SymbolData.setFragment(new MCFillFragment(0, 0, Size, &SectionData));
Chris Lattnereb72dca2010-07-11 22:05:00 +0000167}
168
169// MCStreamer interface
170
Rafael Espindolad80781b2010-09-15 21:48:40 +0000171void WinCOFFStreamer::InitSections() {
Michael J. Spencer192d1362010-10-09 15:44:27 +0000172 SetSectionText();
173 SetSectionData();
174 SetSectionBSS();
175 SetSectionText();
Rafael Espindolad80781b2010-09-15 21:48:40 +0000176}
177
Rafael Espindolaba210242010-11-28 16:22:59 +0000178void WinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {
Rafael Espindolaba210242010-11-28 16:22:59 +0000179 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
Rafael Espindolaea4afa92010-11-28 17:18:55 +0000180 MCObjectStreamer::EmitLabel(Symbol);
Rafael Espindolaba210242010-11-28 16:22:59 +0000181}
182
Chris Lattnereb72dca2010-07-11 22:05:00 +0000183void WinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000184 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000185}
186
Jim Grosbachce792992010-11-05 22:08:08 +0000187void WinCOFFStreamer::EmitThumbFunc(MCSymbol *Func) {
188 llvm_unreachable("not implemented");
189}
190
Chris Lattnereb72dca2010-07-11 22:05:00 +0000191void WinCOFFStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000192 assert((Symbol->isInSection()
193 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
194 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencerb5814a32010-10-07 06:29:33 +0000195 // FIXME: This is all very ugly and depressing. What needs to happen here
196 // depends on quite a few things that are all part of relaxation, which we
197 // don't really even do.
198
199 if (Value->getKind() != MCExpr::SymbolRef) {
NAKAMURA Takumi86c36472010-10-07 07:21:04 +0000200 // TODO: This is exactly the same as MachOStreamer. Consider merging into
201 // MCObjectStreamer.
202 getAssembler().getOrCreateSymbolData(*Symbol);
203 AddValueSymbols(Value);
Michael J. Spencerb5814a32010-10-07 06:29:33 +0000204 Symbol->setVariableValue(Value);
205 } else {
206 // FIXME: This is a horrible way to do this :(. This should really be
207 // handled after we are done with the MC* objects and immediately before
208 // writing out the object file when we know exactly what the symbol should
209 // look like in the coff symbol table. I'm not doing that now because the
210 // COFF object writer doesn't have a clearly defined separation between MC
211 // data structures, the object writers data structures, and the raw, POD,
212 // data structures that get written to disk.
213
214 // Copy over the aliased data.
215 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
216 const MCSymbolData &RealSD = getAssembler().getOrCreateSymbolData(
217 dyn_cast<const MCSymbolRefExpr>(Value)->getSymbol());
218
219 // FIXME: This is particularly nasty because it breaks as soon as any data
220 // members of MCSymbolData change.
221 SD.CommonAlign = RealSD.CommonAlign;
222 SD.CommonSize = RealSD.CommonSize;
223 SD.Flags = RealSD.Flags;
224 SD.Fragment = RealSD.Fragment;
225 SD.Index = RealSD.Index;
226 SD.IsExternal = RealSD.IsExternal;
227 SD.IsPrivateExtern = RealSD.IsPrivateExtern;
228 SD.Offset = RealSD.Offset;
229 SD.SymbolSize = RealSD.SymbolSize;
230 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000231}
232
233void WinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
234 MCSymbolAttr Attribute) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000235 assert(Symbol && "Symbol must be non-null!");
236 assert((Symbol->isInSection()
237 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
238 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000239 switch (Attribute) {
240 case MCSA_WeakReference:
Michael J. Spencer4cee2892010-10-16 08:25:57 +0000241 case MCSA_Weak: {
242 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
243 SD.modifyFlags(COFF::SF_WeakExternal, COFF::SF_WeakExternal);
244 SD.setExternal(true);
245 }
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000246 break;
247
248 case MCSA_Global:
249 getAssembler().getOrCreateSymbolData(*Symbol).setExternal(true);
250 break;
251
252 default:
253 llvm_unreachable("unsupported attribute");
254 break;
255 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000256}
257
258void WinCOFFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000259 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000260}
261
262void WinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000263 assert((Symbol->isInSection()
264 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
265 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000266 assert(CurSymbol == NULL && "EndCOFFSymbolDef must be called between calls "
267 "to BeginCOFFSymbolDef!");
268 CurSymbol = Symbol;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000269}
270
271void WinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000272 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
273 assert((StorageClass & ~0xFF) == 0 && "StorageClass must only have data in "
274 "the first byte!");
275
276 getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
277 StorageClass << COFF::SF_ClassShift,
278 COFF::SF_ClassMask);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000279}
280
281void WinCOFFStreamer::EmitCOFFSymbolType(int Type) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000282 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
283 assert((Type & ~0xFFFF) == 0 && "Type must only have data in the first 2 "
284 "bytes");
285
286 getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
287 Type << COFF::SF_TypeShift,
288 COFF::SF_TypeMask);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000289}
290
291void WinCOFFStreamer::EndCOFFSymbolDef() {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000292 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
293 CurSymbol = NULL;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000294}
295
296void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000297 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000298}
299
300void WinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000301 unsigned ByteAlignment) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000302 assert((Symbol->isInSection()
303 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
304 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000305 AddCommonSymbol(Symbol, Size, ByteAlignment, true);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000306}
307
Benjamin Kramer36a16012011-09-01 23:04:27 +0000308void WinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
309 unsigned ByteAlignment) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000310 assert((Symbol->isInSection()
311 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
312 : true) && "Got non COFF section in the COFF backend!");
Benjamin Kramer36a16012011-09-01 23:04:27 +0000313 AddCommonSymbol(Symbol, Size, ByteAlignment, false);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000314}
315
316void WinCOFFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000317 unsigned Size,unsigned ByteAlignment) {
318 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000319}
320
321void WinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
322 uint64_t Size, unsigned ByteAlignment) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000323 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000324}
325
326void WinCOFFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000327 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
328 // MCObjectStreamer?
329 getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000330}
331
Chris Lattnereb72dca2010-07-11 22:05:00 +0000332void WinCOFFStreamer::EmitValueToAlignment(unsigned ByteAlignment,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000333 int64_t Value,
334 unsigned ValueSize,
335 unsigned MaxBytesToEmit) {
336 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
337 // MCObjectStreamer?
338 if (MaxBytesToEmit == 0)
339 MaxBytesToEmit = ByteAlignment;
340 new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
341 getCurrentSectionData());
342
343 // Update the maximum alignment on the current section if necessary.
344 if (ByteAlignment > getCurrentSectionData()->getAlignment())
345 getCurrentSectionData()->setAlignment(ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000346}
347
348void WinCOFFStreamer::EmitCodeAlignment(unsigned ByteAlignment,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000349 unsigned MaxBytesToEmit) {
350 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
351 // MCObjectStreamer?
352 if (MaxBytesToEmit == 0)
353 MaxBytesToEmit = ByteAlignment;
354 MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
355 getCurrentSectionData());
356 F->setEmitNops(true);
357
358 // Update the maximum alignment on the current section if necessary.
359 if (ByteAlignment > getCurrentSectionData()->getAlignment())
360 getCurrentSectionData()->setAlignment(ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000361}
362
Chris Lattnereb72dca2010-07-11 22:05:00 +0000363void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {
364 // Ignore for now, linkers don't care, and proper debug
365 // info will be a much large effort.
366}
367
Chris Lattnereb72dca2010-07-11 22:05:00 +0000368void WinCOFFStreamer::EmitInstruction(const MCInst &Instruction) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000369 for (unsigned i = 0, e = Instruction.getNumOperands(); i != e; ++i)
370 if (Instruction.getOperand(i).isExpr())
371 AddValueSymbols(Instruction.getOperand(i).getExpr());
372
373 getCurrentSectionData()->setHasInstructions(true);
374
375 MCInstFragment *Fragment =
376 new MCInstFragment(Instruction, getCurrentSectionData());
377
378 raw_svector_ostream VecOS(Fragment->getCode());
379
380 getAssembler().getEmitter().EncodeInstruction(Instruction, VecOS,
381 Fragment->getFixups());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000382}
383
Charles Davis3185f5c2011-05-22 03:01:05 +0000384void WinCOFFStreamer::EmitWin64EHHandlerData() {
385 MCStreamer::EmitWin64EHHandlerData();
386
387 // We have to emit the unwind info now, because this directive
388 // actually switches to the .xdata section!
389 MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentW64UnwindInfo());
390}
391
Chris Lattnereb72dca2010-07-11 22:05:00 +0000392void WinCOFFStreamer::Finish() {
Charles Davis38ea9ee2011-05-22 04:15:07 +0000393 EmitW64Tables();
Chris Lattnereb72dca2010-07-11 22:05:00 +0000394 MCObjectStreamer::Finish();
395}
396
397namespace llvm
398{
399 MCStreamer *createWinCOFFStreamer(MCContext &Context,
Evan Cheng78c10ee2011-07-25 23:24:55 +0000400 MCAsmBackend &MAB,
Chris Lattnereb72dca2010-07-11 22:05:00 +0000401 MCCodeEmitter &CE,
Michael J. Spencere2195d82010-07-31 06:22:29 +0000402 raw_ostream &OS,
403 bool RelaxAll) {
Evan Cheng78c10ee2011-07-25 23:24:55 +0000404 WinCOFFStreamer *S = new WinCOFFStreamer(Context, MAB, CE, OS);
Michael J. Spencere2195d82010-07-31 06:22:29 +0000405 S->getAssembler().setRelaxAll(RelaxAll);
406 return S;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000407 }
408}