blob: 9fd80a4f63ce89c429f4f3f57790ae2c690999a9 [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"
Michael J. Spencer8067adc2010-07-19 06:13:10 +000026#include "llvm/Target/TargetRegistry.h"
Chris Lattnereb72dca2010-07-11 22:05:00 +000027#include "llvm/Target/TargetAsmBackend.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"
33#include "llvm/Support/raw_ostream.h"
34using namespace llvm;
35
Chris Lattnereb72dca2010-07-11 22:05:00 +000036namespace {
37class WinCOFFStreamer : public MCObjectStreamer {
38public:
Michael J. Spencer8067adc2010-07-19 06:13:10 +000039 MCSymbol const *CurSymbol;
40
Chris Lattnereb72dca2010-07-11 22:05:00 +000041 WinCOFFStreamer(MCContext &Context,
42 TargetAsmBackend &TAB,
43 MCCodeEmitter &CE,
44 raw_ostream &OS);
45
Michael J. Spencer8067adc2010-07-19 06:13:10 +000046 void AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
47 unsigned ByteAlignment, bool External);
48
Chris Lattnereb72dca2010-07-11 22:05:00 +000049 // MCStreamer interface
50
Rafael Espindolad80781b2010-09-15 21:48:40 +000051 virtual void InitSections();
Chris Lattnereb72dca2010-07-11 22:05:00 +000052 virtual void EmitLabel(MCSymbol *Symbol);
53 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
54 virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
55 virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
56 virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
57 virtual void BeginCOFFSymbolDef(MCSymbol const *Symbol);
58 virtual void EmitCOFFSymbolStorageClass(int StorageClass);
59 virtual void EmitCOFFSymbolType(int Type);
60 virtual void EndCOFFSymbolDef();
61 virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
62 virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000063 unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000064 virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size);
65 virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000066 unsigned Size,unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000067 virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +000068 uint64_t Size, unsigned ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +000069 virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
Michael J. Spencer8067adc2010-07-19 06:13:10 +000070 virtual void EmitValue(const MCExpr *Value, unsigned Size,
Chris Lattnereb72dca2010-07-11 22:05:00 +000071 unsigned AddrSpace);
72 virtual void EmitGPRel32Value(const MCExpr *Value);
73 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);
77 virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value);
78 virtual void EmitFileDirective(StringRef Filename);
79 virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename);
80 virtual void EmitInstruction(const MCInst &Instruction);
81 virtual void Finish();
Michael J. Spencer192d1362010-10-09 15:44:27 +000082
83private:
84 void SetSection(StringRef Section,
85 unsigned Characteristics,
86 SectionKind Kind) {
87 SwitchSection(getContext().getCOFFSection(Section, Characteristics, Kind));
88 }
89
90 void SetSectionText() {
91 SetSection(".text",
92 COFF::IMAGE_SCN_CNT_CODE
93 | COFF::IMAGE_SCN_MEM_EXECUTE
94 | COFF::IMAGE_SCN_MEM_READ,
95 SectionKind::getText());
96 EmitCodeAlignment(4, 0);
97 }
98
99 void SetSectionData() {
100 SetSection(".data",
101 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
102 | COFF::IMAGE_SCN_MEM_READ
103 | COFF::IMAGE_SCN_MEM_WRITE,
104 SectionKind::getDataRel());
105 EmitCodeAlignment(4, 0);
106 }
107
108 void SetSectionBSS() {
109 SetSection(".bss",
110 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
111 | COFF::IMAGE_SCN_MEM_READ
112 | COFF::IMAGE_SCN_MEM_WRITE,
113 SectionKind::getBSS());
114 EmitCodeAlignment(4, 0);
115 }
116
Chris Lattnereb72dca2010-07-11 22:05:00 +0000117};
118} // end anonymous namespace.
119
120WinCOFFStreamer::WinCOFFStreamer(MCContext &Context,
121 TargetAsmBackend &TAB,
122 MCCodeEmitter &CE,
123 raw_ostream &OS)
Rafael Espindola59ff3c92010-09-22 22:27:05 +0000124 : MCObjectStreamer(Context, TAB, OS, &CE, true)
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000125 , CurSymbol(NULL) {
126}
127
128void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
129 unsigned ByteAlignment, bool External) {
130 assert(!Symbol->isInSection() && "Symbol must not already have a section!");
131
132 std::string SectionName(".bss$linkonce");
133 SectionName.append(Symbol->getName().begin(), Symbol->getName().end());
134
135 MCSymbolData &SymbolData = getAssembler().getOrCreateSymbolData(*Symbol);
136
137 unsigned Characteristics =
138 COFF::IMAGE_SCN_LNK_COMDAT |
139 COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
140 COFF::IMAGE_SCN_MEM_READ |
141 COFF::IMAGE_SCN_MEM_WRITE;
142
143 int Selection = COFF::IMAGE_COMDAT_SELECT_LARGEST;
144
145 const MCSection *Section = MCStreamer::getContext().getCOFFSection(
146 SectionName, Characteristics, Selection, SectionKind::getBSS());
147
148 MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
149
150 if (SectionData.getAlignment() < ByteAlignment)
151 SectionData.setAlignment(ByteAlignment);
152
153 SymbolData.setExternal(External);
154
155 Symbol->setSection(*Section);
156
157 if (ByteAlignment != 1)
158 new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, &SectionData);
159
160 SymbolData.setFragment(new MCFillFragment(0, 0, Size, &SectionData));
Chris Lattnereb72dca2010-07-11 22:05:00 +0000161}
162
163// MCStreamer interface
164
Rafael Espindolad80781b2010-09-15 21:48:40 +0000165void WinCOFFStreamer::InitSections() {
Michael J. Spencer192d1362010-10-09 15:44:27 +0000166 SetSectionText();
167 SetSectionData();
168 SetSectionBSS();
169 SetSectionText();
Rafael Espindolad80781b2010-09-15 21:48:40 +0000170}
171
Chris Lattnereb72dca2010-07-11 22:05:00 +0000172void WinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000173 // TODO: This is copied almost exactly from the MachOStreamer. Consider
174 // merging into MCObjectStreamer?
175 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
176 assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
177 assert(CurSection && "Cannot emit before setting section!");
178
179 Symbol->setSection(*CurSection);
180
181 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
182
183 // FIXME: This is wasteful, we don't necessarily need to create a data
184 // fragment. Instead, we should mark the symbol as pointing into the data
185 // fragment if it exists, otherwise we should just queue the label and set its
186 // fragment pointer when we emit the next fragment.
Michael J. Spencerbf252be2010-08-25 19:27:27 +0000187 MCDataFragment *DF = getOrCreateDataFragment();
188
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000189 assert(!SD.getFragment() && "Unexpected fragment on symbol data!");
Michael J. Spencerbf252be2010-08-25 19:27:27 +0000190 SD.setFragment(DF);
191 SD.setOffset(DF->getContents().size());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000192}
193
194void WinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000195 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000196}
197
198void WinCOFFStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000199 assert((Symbol->isInSection()
200 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
201 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencerb5814a32010-10-07 06:29:33 +0000202 // FIXME: This is all very ugly and depressing. What needs to happen here
203 // depends on quite a few things that are all part of relaxation, which we
204 // don't really even do.
205
206 if (Value->getKind() != MCExpr::SymbolRef) {
NAKAMURA Takumi86c36472010-10-07 07:21:04 +0000207 // TODO: This is exactly the same as MachOStreamer. Consider merging into
208 // MCObjectStreamer.
209 getAssembler().getOrCreateSymbolData(*Symbol);
210 AddValueSymbols(Value);
Michael J. Spencerb5814a32010-10-07 06:29:33 +0000211 Symbol->setVariableValue(Value);
212 } else {
213 // FIXME: This is a horrible way to do this :(. This should really be
214 // handled after we are done with the MC* objects and immediately before
215 // writing out the object file when we know exactly what the symbol should
216 // look like in the coff symbol table. I'm not doing that now because the
217 // COFF object writer doesn't have a clearly defined separation between MC
218 // data structures, the object writers data structures, and the raw, POD,
219 // data structures that get written to disk.
220
221 // Copy over the aliased data.
222 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
223 const MCSymbolData &RealSD = getAssembler().getOrCreateSymbolData(
224 dyn_cast<const MCSymbolRefExpr>(Value)->getSymbol());
225
226 // FIXME: This is particularly nasty because it breaks as soon as any data
227 // members of MCSymbolData change.
228 SD.CommonAlign = RealSD.CommonAlign;
229 SD.CommonSize = RealSD.CommonSize;
230 SD.Flags = RealSD.Flags;
231 SD.Fragment = RealSD.Fragment;
232 SD.Index = RealSD.Index;
233 SD.IsExternal = RealSD.IsExternal;
234 SD.IsPrivateExtern = RealSD.IsPrivateExtern;
235 SD.Offset = RealSD.Offset;
236 SD.SymbolSize = RealSD.SymbolSize;
237 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000238}
239
240void WinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
241 MCSymbolAttr Attribute) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000242 assert(Symbol && "Symbol must be non-null!");
243 assert((Symbol->isInSection()
244 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
245 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000246 switch (Attribute) {
247 case MCSA_WeakReference:
248 getAssembler().getOrCreateSymbolData(*Symbol).modifyFlags(
249 COFF::SF_WeakReference,
250 COFF::SF_WeakReference);
251 break;
252
253 case MCSA_Global:
254 getAssembler().getOrCreateSymbolData(*Symbol).setExternal(true);
255 break;
256
257 default:
258 llvm_unreachable("unsupported attribute");
259 break;
260 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000261}
262
263void WinCOFFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000264 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000265}
266
267void WinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000268 assert((Symbol->isInSection()
269 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
270 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000271 assert(CurSymbol == NULL && "EndCOFFSymbolDef must be called between calls "
272 "to BeginCOFFSymbolDef!");
273 CurSymbol = Symbol;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000274}
275
276void WinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000277 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
278 assert((StorageClass & ~0xFF) == 0 && "StorageClass must only have data in "
279 "the first byte!");
280
281 getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
282 StorageClass << COFF::SF_ClassShift,
283 COFF::SF_ClassMask);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000284}
285
286void WinCOFFStreamer::EmitCOFFSymbolType(int Type) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000287 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
288 assert((Type & ~0xFFFF) == 0 && "Type must only have data in the first 2 "
289 "bytes");
290
291 getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
292 Type << COFF::SF_TypeShift,
293 COFF::SF_TypeMask);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000294}
295
296void WinCOFFStreamer::EndCOFFSymbolDef() {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000297 assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
298 CurSymbol = NULL;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000299}
300
301void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000302 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000303}
304
305void WinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000306 unsigned ByteAlignment) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000307 assert((Symbol->isInSection()
308 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
309 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000310 AddCommonSymbol(Symbol, Size, ByteAlignment, true);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000311}
312
313void WinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size) {
Michael J. Spencerd47f4a92010-10-09 11:00:37 +0000314 assert((Symbol->isInSection()
315 ? Symbol->getSection().getVariant() == MCSection::SV_COFF
316 : true) && "Got non COFF section in the COFF backend!");
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000317 AddCommonSymbol(Symbol, Size, 1, false);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000318}
319
320void WinCOFFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000321 unsigned Size,unsigned ByteAlignment) {
322 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000323}
324
325void WinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
326 uint64_t Size, unsigned ByteAlignment) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000327 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000328}
329
330void WinCOFFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000331 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
332 // MCObjectStreamer?
333 getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000334}
335
336void WinCOFFStreamer::EmitValue(const MCExpr *Value, unsigned Size,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000337 unsigned AddrSpace) {
338 assert(AddrSpace == 0 && "Address space must be 0!");
339
340 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
341 // MCObjectStreamer?
342 MCDataFragment *DF = getOrCreateDataFragment();
343
344 // Avoid fixups when possible.
345 int64_t AbsValue;
346 if (AddValueSymbols(Value)->EvaluateAsAbsolute(AbsValue)) {
347 // FIXME: Endianness assumption.
348 for (unsigned i = 0; i != Size; ++i)
349 DF->getContents().push_back(uint8_t(AbsValue >> (i * 8)));
350 } else {
351 DF->addFixup(MCFixup::Create(DF->getContents().size(),
352 AddValueSymbols(Value),
353 MCFixup::getKindForSize(Size)));
354 DF->getContents().resize(DF->getContents().size() + Size, 0);
355 }
Chris Lattnereb72dca2010-07-11 22:05:00 +0000356}
357
358void WinCOFFStreamer::EmitGPRel32Value(const MCExpr *Value) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000359 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000360}
361
362void WinCOFFStreamer::EmitValueToAlignment(unsigned ByteAlignment,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000363 int64_t Value,
364 unsigned ValueSize,
365 unsigned MaxBytesToEmit) {
366 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
367 // MCObjectStreamer?
368 if (MaxBytesToEmit == 0)
369 MaxBytesToEmit = ByteAlignment;
370 new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
371 getCurrentSectionData());
372
373 // Update the maximum alignment on the current section if necessary.
374 if (ByteAlignment > getCurrentSectionData()->getAlignment())
375 getCurrentSectionData()->setAlignment(ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000376}
377
378void WinCOFFStreamer::EmitCodeAlignment(unsigned ByteAlignment,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000379 unsigned MaxBytesToEmit) {
380 // TODO: This is copied exactly from the MachOStreamer. Consider merging into
381 // MCObjectStreamer?
382 if (MaxBytesToEmit == 0)
383 MaxBytesToEmit = ByteAlignment;
384 MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
385 getCurrentSectionData());
386 F->setEmitNops(true);
387
388 // Update the maximum alignment on the current section if necessary.
389 if (ByteAlignment > getCurrentSectionData()->getAlignment())
390 getCurrentSectionData()->setAlignment(ByteAlignment);
Chris Lattnereb72dca2010-07-11 22:05:00 +0000391}
392
393void WinCOFFStreamer::EmitValueToOffset(const MCExpr *Offset,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000394 unsigned char Value) {
395 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000396}
397
398void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {
399 // Ignore for now, linkers don't care, and proper debug
400 // info will be a much large effort.
401}
402
403void WinCOFFStreamer::EmitDwarfFileDirective(unsigned FileNo,
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000404 StringRef Filename) {
405 llvm_unreachable("not implemented");
Chris Lattnereb72dca2010-07-11 22:05:00 +0000406}
407
408void WinCOFFStreamer::EmitInstruction(const MCInst &Instruction) {
Michael J. Spencer8067adc2010-07-19 06:13:10 +0000409 for (unsigned i = 0, e = Instruction.getNumOperands(); i != e; ++i)
410 if (Instruction.getOperand(i).isExpr())
411 AddValueSymbols(Instruction.getOperand(i).getExpr());
412
413 getCurrentSectionData()->setHasInstructions(true);
414
415 MCInstFragment *Fragment =
416 new MCInstFragment(Instruction, getCurrentSectionData());
417
418 raw_svector_ostream VecOS(Fragment->getCode());
419
420 getAssembler().getEmitter().EncodeInstruction(Instruction, VecOS,
421 Fragment->getFixups());
Chris Lattnereb72dca2010-07-11 22:05:00 +0000422}
423
424void WinCOFFStreamer::Finish() {
425 MCObjectStreamer::Finish();
426}
427
428namespace llvm
429{
430 MCStreamer *createWinCOFFStreamer(MCContext &Context,
431 TargetAsmBackend &TAB,
432 MCCodeEmitter &CE,
Michael J. Spencere2195d82010-07-31 06:22:29 +0000433 raw_ostream &OS,
434 bool RelaxAll) {
435 WinCOFFStreamer *S = new WinCOFFStreamer(Context, TAB, CE, OS);
436 S->getAssembler().setRelaxAll(RelaxAll);
437 return S;
Chris Lattnereb72dca2010-07-11 22:05:00 +0000438 }
439}