blob: f79ba8e689056eeb2fa84b3f89f80fe388430ad6 [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);
Chris Lattnereb72dca2010-07-11 22:05:00 +000066 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size);
67 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000068 unsigned Size,unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000069 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000070 uint64_t Size, unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000071 virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
Chris Lattnereb72dca2010-07-11 22:05:00 +000072 virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000073 unsigned ValueSize, unsigned MaxBytesToEmit);
Chris Lattnereb72dca2010-07-11 22:05:00 +000074 virtual void EmitCodeAlignment(unsigned ByteAlignment,
75 unsigned MaxBytesToEmit);
Chris Lattnereb72dca2010-07-11 22:05:00 +000076 virtual void EmitFileDirective(StringRef Filename);
Chris Lattnereb72dca2010-07-11 22:05:00 +000077 virtual void EmitInstruction(const MCInst &Instruction);
Charles Davis3185f5c2011-05-22 03:01:05 +000078 virtual void EmitWin64EHHandlerData();
Chris Lattnereb72dca2010-07-11 22:05:00 +000079 virtual void Finish();
Michael J. Spencer192d1362010-10-09 15:44:27 +000080
81private:
Rafael Espindolaf89671d2010-11-01 16:27:31 +000082 virtual void EmitInstToFragment(const MCInst &Inst) {
83 llvm_unreachable("Not used by WinCOFF.");
84 }
85 virtual void EmitInstToData(const MCInst &Inst) {
86 llvm_unreachable("Not used by WinCOFF.");
87 }
88
Michael J. Spencer192d1362010-10-09 15:44:27 +000089 void SetSection(StringRef Section,
90 unsigned Characteristics,
91 SectionKind Kind) {
92 SwitchSection(getContext().getCOFFSection(Section, Characteristics, Kind));
93 }
94
95 void SetSectionText() {
96 SetSection(".text",
97 COFF::IMAGE_SCN_CNT_CODE
98 | COFF::IMAGE_SCN_MEM_EXECUTE
99 | COFF::IMAGE_SCN_MEM_READ,
100 SectionKind::getText());
101 EmitCodeAlignment(4, 0);
102 }
103
104 void SetSectionData() {
105 SetSection(".data",
106 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
107 | COFF::IMAGE_SCN_MEM_READ
108 | COFF::IMAGE_SCN_MEM_WRITE,
109 SectionKind::getDataRel());
110 EmitCodeAlignment(4, 0);
111 }
112
113 void SetSectionBSS() {
114 SetSection(".bss",
115 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
116 | COFF::IMAGE_SCN_MEM_READ
117 | COFF::IMAGE_SCN_MEM_WRITE,
118 SectionKind::getBSS());
119 EmitCodeAlignment(4, 0);
120 }
121
Chris Lattnereb72dca2010-07-11 22:05:00 +0000122};
123} // end anonymous namespace.
124
125WinCOFFStreamer::WinCOFFStreamer(MCContext &Context,
Evan Cheng78c10ee2011-07-25 23:24:55 +0000126 MCAsmBackend &MAB,
Chris Lattnereb72dca2010-07-11 22:05:00 +0000127 MCCodeEmitter &CE,
128 raw_ostream &OS)
Evan Cheng78c10ee2011-07-25 23:24:55 +0000129 : MCObjectStreamer(Context, MAB, OS, &CE)
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000130 , CurSymbol(NULL) {
131}
132
133void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
134 unsigned ByteAlignment, bool External) {
135 assert(!Symbol->isInSection() && "Symbol must not already have a section!");
136
137 std::string SectionName(".bss$linkonce");
138 SectionName.append(Symbol->getName().begin(), Symbol->getName().end());
139
140 MCSymbolData &SymbolData = getAssembler().getOrCreateSymbolData(*Symbol);
141
142 unsigned Characteristics =
143 COFF::IMAGE_SCN_LNK_COMDAT |
144 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
145 COFF::IMAGE_SCN_MEM_READ |
146 COFF::IMAGE_SCN_MEM_WRITE;
147
148 int Selection = COFF::IMAGE_COMDAT_SELECT_LARGEST;
149
150 const MCSection *Section = MCStreamer::getContext().getCOFFSection(
151 SectionName, Characteristics, Selection, SectionKind::getBSS());
152
153 MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
154
155 if (SectionData.getAlignment() < ByteAlignment)
156 SectionData.setAlignment(ByteAlignment);
157
158 SymbolData.setExternal(External);
159
160 Symbol->setSection(*Section);
161
162 if (ByteAlignment != 1)
163 new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, &SectionData);
164
165 SymbolData.setFragment(new MCFillFragment(0, 0, Size, &SectionData));
Chris Lattnereb72dca2010-07-11 22:05:00 +0000166}
167
168// MCStreamer interface
169
Rafael Espindolad80781b2010-09-15 21:48:40 +0000170void WinCOFFStreamer::InitSections() {
Michael J. Spencer192d1362010-10-09 15:44:27 +0000171 SetSectionText();
172 SetSectionData();
173 SetSectionBSS();
174 SetSectionText();
Rafael Espindolad80781b2010-09-15 21:48:40 +0000175}
176
Rafael Espindolaba210242010-11-28 16:22:59 +0000177void WinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {
Rafael Espindolaba210242010-11-28 16:22:59 +0000178 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
Rafael Espindolaea4afa92010-11-28 17:18:55 +0000179 MCObjectStreamer::EmitLabel(Symbol);
Rafael Espindolaba210242010-11-28 16:22:59 +0000180}
181
Chris Lattnereb72dca2010-07-11 22:05:00 +0000182void WinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000183 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000184}
185
Jim Grosbachce792992010-11-05 22:08:08 +0000186void WinCOFFStreamer::EmitThumbFunc(MCSymbol *Func) {
187 llvm_unreachable("not implemented");
188}
189
Chris Lattnereb72dca2010-07-11 22:05:00 +0000190void WinCOFFStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000191 assert((Symbol->isInSection()
192 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
193 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencerb5814a32010-10-07 06:29:33 +0000194 // FIXME: This is all very ugly and depressing. What needs to happen here
195 // depends on quite a few things that are all part of relaxation, which we
196 // don't really even do.
197
198 if (Value->getKind() != MCExpr::SymbolRef) {
NAKAMURA Takumi86c36472010-10-07 07:21:04 +0000199 // TODO: This is exactly the same as MachOStreamer. Consider merging into
200 // MCObjectStreamer.
201 getAssembler().getOrCreateSymbolData(*Symbol);
202 AddValueSymbols(Value);
Michael J. Spencerb5814a32010-10-07 06:29:33 +0000203 Symbol->setVariableValue(Value);
204 } else {
205 // FIXME: This is a horrible way to do this :(. This should really be
206 // handled after we are done with the MC* objects and immediately before
207 // writing out the object file when we know exactly what the symbol should
208 // look like in the coff symbol table. I'm not doing that now because the
209 // COFF object writer doesn't have a clearly defined separation between MC
210 // data structures, the object writers data structures, and the raw, POD,
211 // data structures that get written to disk.
212
213 // Copy over the aliased data.
214 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
215 const MCSymbolData &RealSD = getAssembler().getOrCreateSymbolData(
216 dyn_cast<const MCSymbolRefExpr>(Value)->getSymbol());
217
218 // FIXME: This is particularly nasty because it breaks as soon as any data
219 // members of MCSymbolData change.
220 SD.CommonAlign = RealSD.CommonAlign;
221 SD.CommonSize = RealSD.CommonSize;
222 SD.Flags = RealSD.Flags;
223 SD.Fragment = RealSD.Fragment;
224 SD.Index = RealSD.Index;
225 SD.IsExternal = RealSD.IsExternal;
226 SD.IsPrivateExtern = RealSD.IsPrivateExtern;
227 SD.Offset = RealSD.Offset;
228 SD.SymbolSize = RealSD.SymbolSize;
229 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000230}
231
232void WinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
233 MCSymbolAttr Attribute) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000234 assert(Symbol && "Symbol must be non-null!");
235 assert((Symbol->isInSection()
236 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
237 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000238 switch (Attribute) {
239 case MCSA_WeakReference:
Michael J. Spencer4cee2892010-10-16 08:25:57 +0000240 case MCSA_Weak: {
241 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
242 SD.modifyFlags(COFF::SF_WeakExternal, COFF::SF_WeakExternal);
243 SD.setExternal(true);
244 }
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000245 break;
246
247 case MCSA_Global:
248 getAssembler().getOrCreateSymbolData(*Symbol).setExternal(true);
249 break;
250
251 default:
252 llvm_unreachable("unsupported attribute");
253 break;
254 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000255}
256
257void WinCOFFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000258 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000259}
260
261void WinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000262 assert((Symbol->isInSection()
263 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
264 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000265 assert(CurSymbol == NULL && "EndCOFFSymbolDef must be called between calls "
266 "to BeginCOFFSymbolDef!");
267 CurSymbol = Symbol;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000268}
269
270void WinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000271 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
272 assert((StorageClass & ~0xFF) == 0 && "StorageClass must only have data in "
273 "the first byte!");
274
275 getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
276 StorageClass << COFF::SF_ClassShift,
277 COFF::SF_ClassMask);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000278}
279
280void WinCOFFStreamer::EmitCOFFSymbolType(int Type) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000281 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
282 assert((Type & ~0xFFFF) == 0 && "Type must only have data in the first 2 "
283 "bytes");
284
285 getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
286 Type << COFF::SF_TypeShift,
287 COFF::SF_TypeMask);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000288}
289
290void WinCOFFStreamer::EndCOFFSymbolDef() {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000291 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
292 CurSymbol = NULL;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000293}
294
295void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000296 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000297}
298
299void WinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000300 unsigned ByteAlignment) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000301 assert((Symbol->isInSection()
302 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
303 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000304 AddCommonSymbol(Symbol, Size, ByteAlignment, true);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000305}
306
307void WinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000308 assert((Symbol->isInSection()
309 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
310 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000311 AddCommonSymbol(Symbol, Size, 1, false);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000312}
313
314void WinCOFFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000315 unsigned Size,unsigned ByteAlignment) {
316 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000317}
318
319void WinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
320 uint64_t Size, unsigned ByteAlignment) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000321 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000322}
323
324void WinCOFFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000325 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
326 // MCObjectStreamer?
327 getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000328}
329
Chris Lattnereb72dca2010-07-11 22:05:00 +0000330void WinCOFFStreamer::EmitValueToAlignment(unsigned ByteAlignment,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000331 int64_t Value,
332 unsigned ValueSize,
333 unsigned MaxBytesToEmit) {
334 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
335 // MCObjectStreamer?
336 if (MaxBytesToEmit == 0)
337 MaxBytesToEmit = ByteAlignment;
338 new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
339 getCurrentSectionData());
340
341 // Update the maximum alignment on the current section if necessary.
342 if (ByteAlignment > getCurrentSectionData()->getAlignment())
343 getCurrentSectionData()->setAlignment(ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000344}
345
346void WinCOFFStreamer::EmitCodeAlignment(unsigned ByteAlignment,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000347 unsigned MaxBytesToEmit) {
348 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
349 // MCObjectStreamer?
350 if (MaxBytesToEmit == 0)
351 MaxBytesToEmit = ByteAlignment;
352 MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
353 getCurrentSectionData());
354 F->setEmitNops(true);
355
356 // Update the maximum alignment on the current section if necessary.
357 if (ByteAlignment > getCurrentSectionData()->getAlignment())
358 getCurrentSectionData()->setAlignment(ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000359}
360
Chris Lattnereb72dca2010-07-11 22:05:00 +0000361void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {
362 // Ignore for now, linkers don't care, and proper debug
363 // info will be a much large effort.
364}
365
Chris Lattnereb72dca2010-07-11 22:05:00 +0000366void WinCOFFStreamer::EmitInstruction(const MCInst &Instruction) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000367 for (unsigned i = 0, e = Instruction.getNumOperands(); i != e; ++i)
368 if (Instruction.getOperand(i).isExpr())
369 AddValueSymbols(Instruction.getOperand(i).getExpr());
370
371 getCurrentSectionData()->setHasInstructions(true);
372
373 MCInstFragment *Fragment =
374 new MCInstFragment(Instruction, getCurrentSectionData());
375
376 raw_svector_ostream VecOS(Fragment->getCode());
377
378 getAssembler().getEmitter().EncodeInstruction(Instruction, VecOS,
379 Fragment->getFixups());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000380}
381
Charles Davis3185f5c2011-05-22 03:01:05 +0000382void WinCOFFStreamer::EmitWin64EHHandlerData() {
383 MCStreamer::EmitWin64EHHandlerData();
384
385 // We have to emit the unwind info now, because this directive
386 // actually switches to the .xdata section!
387 MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentW64UnwindInfo());
388}
389
Chris Lattnereb72dca2010-07-11 22:05:00 +0000390void WinCOFFStreamer::Finish() {
Charles Davis38ea9ee2011-05-22 04:15:07 +0000391 EmitW64Tables();
Chris Lattnereb72dca2010-07-11 22:05:00 +0000392 MCObjectStreamer::Finish();
393}
394
395namespace llvm
396{
397 MCStreamer *createWinCOFFStreamer(MCContext &Context,
Evan Cheng78c10ee2011-07-25 23:24:55 +0000398 MCAsmBackend &MAB,
Chris Lattnereb72dca2010-07-11 22:05:00 +0000399 MCCodeEmitter &CE,
Michael J. Spencere2195d82010-07-31 06:22:29 +0000400 raw_ostream &OS,
401 bool RelaxAll) {
Evan Cheng78c10ee2011-07-25 23:24:55 +0000402 WinCOFFStreamer *S = new WinCOFFStreamer(Context, MAB, CE, OS);
Michael J. Spencere2195d82010-07-31 06:22:29 +0000403 S->getAssembler().setRelaxAll(RelaxAll);
404 return S;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000405 }
406}