2010-07-11 22:05:00 +00:00
|
|
|
//===-- llvm/MC/WinCOFFStreamer.cpp -----------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains an implementation of a Win32 COFF object file streamer.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "WinCOFFStreamer"
|
|
|
|
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
|
|
|
#include "llvm/MC/MCAsmBackend.h"
|
|
|
|
#include "llvm/MC/MCAsmLayout.h"
|
|
|
|
#include "llvm/MC/MCAssembler.h"
|
|
|
|
#include "llvm/MC/MCCodeEmitter.h"
|
2010-07-11 22:05:00 +00:00
|
|
|
#include "llvm/MC/MCContext.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
|
|
|
#include "llvm/MC/MCObjectStreamer.h"
|
2010-07-11 22:05:00 +00:00
|
|
|
#include "llvm/MC/MCSection.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/MC/MCSectionCOFF.h"
|
2010-07-11 22:05:00 +00:00
|
|
|
#include "llvm/MC/MCSymbol.h"
|
2010-07-19 06:13:10 +00:00
|
|
|
#include "llvm/MC/MCValue.h"
|
2011-05-22 03:01:05 +00:00
|
|
|
#include "llvm/MC/MCWin64EH.h"
|
2010-07-11 22:05:00 +00:00
|
|
|
#include "llvm/Support/COFF.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
#include "llvm/Support/ErrorHandling.h"
|
2011-08-24 18:08:43 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2010-07-11 22:05:00 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2011-12-17 01:14:52 +00:00
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class WinCOFFStreamer : public MCObjectStreamer {
|
|
|
|
public:
|
2010-07-19 06:13:10 +00:00
|
|
|
MCSymbol const *CurSymbol;
|
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
WinCOFFStreamer(MCContext &Context,
|
2011-07-25 23:24:55 +00:00
|
|
|
MCAsmBackend &MAB,
|
2010-07-11 22:05:00 +00:00
|
|
|
MCCodeEmitter &CE,
|
|
|
|
raw_ostream &OS);
|
|
|
|
|
2010-07-19 06:13:10 +00:00
|
|
|
void AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|
|
|
unsigned ByteAlignment, bool External);
|
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
// MCStreamer interface
|
|
|
|
|
2010-09-15 21:48:40 +00:00
|
|
|
virtual void InitSections();
|
2010-11-28 16:22:59 +00:00
|
|
|
virtual void EmitLabel(MCSymbol *Symbol);
|
2010-07-11 22:05:00 +00:00
|
|
|
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
|
2010-11-05 22:08:08 +00:00
|
|
|
virtual void EmitThumbFunc(MCSymbol *Func);
|
2010-07-11 22:05:00 +00:00
|
|
|
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
|
|
|
|
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
|
|
|
|
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
|
|
|
|
virtual void BeginCOFFSymbolDef(MCSymbol const *Symbol);
|
|
|
|
virtual void EmitCOFFSymbolStorageClass(int StorageClass);
|
|
|
|
virtual void EmitCOFFSymbolType(int Type);
|
|
|
|
virtual void EndCOFFSymbolDef();
|
2011-12-17 01:14:52 +00:00
|
|
|
virtual void EmitCOFFSecRel32(MCSymbol const *Symbol);
|
2010-07-11 22:05:00 +00:00
|
|
|
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value);
|
|
|
|
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2010-07-19 06:13:10 +00:00
|
|
|
unsigned ByteAlignment);
|
2011-09-01 23:04:27 +00:00
|
|
|
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|
|
|
unsigned ByteAlignment);
|
2010-07-11 22:05:00 +00:00
|
|
|
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
2012-06-22 20:14:46 +00:00
|
|
|
uint64_t Size,unsigned ByteAlignment);
|
2010-07-11 22:05:00 +00:00
|
|
|
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
2010-07-19 06:13:10 +00:00
|
|
|
uint64_t Size, unsigned ByteAlignment);
|
2010-07-11 22:05:00 +00:00
|
|
|
virtual void EmitFileDirective(StringRef Filename);
|
|
|
|
virtual void EmitInstruction(const MCInst &Instruction);
|
2011-05-22 03:01:05 +00:00
|
|
|
virtual void EmitWin64EHHandlerData();
|
2012-01-07 03:13:18 +00:00
|
|
|
virtual void FinishImpl();
|
2010-10-09 15:44:27 +00:00
|
|
|
|
|
|
|
private:
|
2010-11-01 16:27:31 +00:00
|
|
|
virtual void EmitInstToFragment(const MCInst &Inst) {
|
|
|
|
llvm_unreachable("Not used by WinCOFF.");
|
|
|
|
}
|
|
|
|
virtual void EmitInstToData(const MCInst &Inst) {
|
|
|
|
llvm_unreachable("Not used by WinCOFF.");
|
|
|
|
}
|
|
|
|
|
2010-10-09 15:44:27 +00:00
|
|
|
void SetSection(StringRef Section,
|
|
|
|
unsigned Characteristics,
|
|
|
|
SectionKind Kind) {
|
|
|
|
SwitchSection(getContext().getCOFFSection(Section, Characteristics, Kind));
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetSectionText() {
|
|
|
|
SetSection(".text",
|
|
|
|
COFF::IMAGE_SCN_CNT_CODE
|
|
|
|
| COFF::IMAGE_SCN_MEM_EXECUTE
|
|
|
|
| COFF::IMAGE_SCN_MEM_READ,
|
|
|
|
SectionKind::getText());
|
|
|
|
EmitCodeAlignment(4, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetSectionData() {
|
|
|
|
SetSection(".data",
|
|
|
|
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
|
|
|
|
| COFF::IMAGE_SCN_MEM_READ
|
|
|
|
| COFF::IMAGE_SCN_MEM_WRITE,
|
|
|
|
SectionKind::getDataRel());
|
|
|
|
EmitCodeAlignment(4, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetSectionBSS() {
|
|
|
|
SetSection(".bss",
|
|
|
|
COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
|
|
|
|
| COFF::IMAGE_SCN_MEM_READ
|
|
|
|
| COFF::IMAGE_SCN_MEM_WRITE,
|
|
|
|
SectionKind::getBSS());
|
|
|
|
EmitCodeAlignment(4, 0);
|
|
|
|
}
|
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
};
|
|
|
|
} // end anonymous namespace.
|
|
|
|
|
|
|
|
WinCOFFStreamer::WinCOFFStreamer(MCContext &Context,
|
2011-07-25 23:24:55 +00:00
|
|
|
MCAsmBackend &MAB,
|
2010-07-11 22:05:00 +00:00
|
|
|
MCCodeEmitter &CE,
|
|
|
|
raw_ostream &OS)
|
2011-07-25 23:24:55 +00:00
|
|
|
: MCObjectStreamer(Context, MAB, OS, &CE)
|
2010-07-19 06:13:10 +00:00
|
|
|
, CurSymbol(NULL) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|
|
|
unsigned ByteAlignment, bool External) {
|
|
|
|
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
|
|
|
|
|
|
|
|
std::string SectionName(".bss$linkonce");
|
|
|
|
SectionName.append(Symbol->getName().begin(), Symbol->getName().end());
|
|
|
|
|
|
|
|
MCSymbolData &SymbolData = getAssembler().getOrCreateSymbolData(*Symbol);
|
|
|
|
|
|
|
|
unsigned Characteristics =
|
|
|
|
COFF::IMAGE_SCN_LNK_COMDAT |
|
|
|
|
COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
|
|
|
|
COFF::IMAGE_SCN_MEM_READ |
|
|
|
|
COFF::IMAGE_SCN_MEM_WRITE;
|
|
|
|
|
|
|
|
int Selection = COFF::IMAGE_COMDAT_SELECT_LARGEST;
|
|
|
|
|
|
|
|
const MCSection *Section = MCStreamer::getContext().getCOFFSection(
|
|
|
|
SectionName, Characteristics, Selection, SectionKind::getBSS());
|
|
|
|
|
|
|
|
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
|
|
|
|
|
|
|
|
if (SectionData.getAlignment() < ByteAlignment)
|
|
|
|
SectionData.setAlignment(ByteAlignment);
|
|
|
|
|
|
|
|
SymbolData.setExternal(External);
|
|
|
|
|
|
|
|
Symbol->setSection(*Section);
|
|
|
|
|
|
|
|
if (ByteAlignment != 1)
|
|
|
|
new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, &SectionData);
|
|
|
|
|
|
|
|
SymbolData.setFragment(new MCFillFragment(0, 0, Size, &SectionData));
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MCStreamer interface
|
|
|
|
|
2010-09-15 21:48:40 +00:00
|
|
|
void WinCOFFStreamer::InitSections() {
|
2010-10-09 15:44:27 +00:00
|
|
|
SetSectionText();
|
|
|
|
SetSectionData();
|
|
|
|
SetSectionBSS();
|
|
|
|
SetSectionText();
|
2010-09-15 21:48:40 +00:00
|
|
|
}
|
|
|
|
|
2010-11-28 16:22:59 +00:00
|
|
|
void WinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {
|
|
|
|
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
2010-11-28 17:18:55 +00:00
|
|
|
MCObjectStreamer::EmitLabel(Symbol);
|
2010-11-28 16:22:59 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
void WinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
|
2010-07-19 06:13:10 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2010-11-05 22:08:08 +00:00
|
|
|
void WinCOFFStreamer::EmitThumbFunc(MCSymbol *Func) {
|
|
|
|
llvm_unreachable("not implemented");
|
|
|
|
}
|
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
void WinCOFFStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
|
2010-10-09 11:00:37 +00:00
|
|
|
assert((Symbol->isInSection()
|
|
|
|
? Symbol->getSection().getVariant() == MCSection::SV_COFF
|
|
|
|
: true) && "Got non COFF section in the COFF backend!");
|
2010-10-07 06:29:33 +00:00
|
|
|
// FIXME: This is all very ugly and depressing. What needs to happen here
|
|
|
|
// depends on quite a few things that are all part of relaxation, which we
|
|
|
|
// don't really even do.
|
|
|
|
|
|
|
|
if (Value->getKind() != MCExpr::SymbolRef) {
|
2012-12-07 17:55:28 +00:00
|
|
|
MCObjectStreamer::EmitAssignment(Symbol, Value);
|
2010-10-07 06:29:33 +00:00
|
|
|
} else {
|
|
|
|
// FIXME: This is a horrible way to do this :(. This should really be
|
|
|
|
// handled after we are done with the MC* objects and immediately before
|
|
|
|
// writing out the object file when we know exactly what the symbol should
|
|
|
|
// look like in the coff symbol table. I'm not doing that now because the
|
|
|
|
// COFF object writer doesn't have a clearly defined separation between MC
|
|
|
|
// data structures, the object writers data structures, and the raw, POD,
|
|
|
|
// data structures that get written to disk.
|
|
|
|
|
|
|
|
// Copy over the aliased data.
|
|
|
|
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
|
|
|
|
const MCSymbolData &RealSD = getAssembler().getOrCreateSymbolData(
|
|
|
|
dyn_cast<const MCSymbolRefExpr>(Value)->getSymbol());
|
|
|
|
|
|
|
|
// FIXME: This is particularly nasty because it breaks as soon as any data
|
|
|
|
// members of MCSymbolData change.
|
|
|
|
SD.CommonAlign = RealSD.CommonAlign;
|
|
|
|
SD.CommonSize = RealSD.CommonSize;
|
|
|
|
SD.Flags = RealSD.Flags;
|
|
|
|
SD.Fragment = RealSD.Fragment;
|
|
|
|
SD.Index = RealSD.Index;
|
|
|
|
SD.IsExternal = RealSD.IsExternal;
|
|
|
|
SD.IsPrivateExtern = RealSD.IsPrivateExtern;
|
|
|
|
SD.Offset = RealSD.Offset;
|
|
|
|
SD.SymbolSize = RealSD.SymbolSize;
|
|
|
|
}
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|
|
|
MCSymbolAttr Attribute) {
|
2010-10-09 11:00:37 +00:00
|
|
|
assert(Symbol && "Symbol must be non-null!");
|
|
|
|
assert((Symbol->isInSection()
|
|
|
|
? Symbol->getSection().getVariant() == MCSection::SV_COFF
|
|
|
|
: true) && "Got non COFF section in the COFF backend!");
|
2010-07-19 06:13:10 +00:00
|
|
|
switch (Attribute) {
|
|
|
|
case MCSA_WeakReference:
|
2010-10-16 08:25:57 +00:00
|
|
|
case MCSA_Weak: {
|
|
|
|
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
|
|
|
|
SD.modifyFlags(COFF::SF_WeakExternal, COFF::SF_WeakExternal);
|
|
|
|
SD.setExternal(true);
|
|
|
|
}
|
2010-07-19 06:13:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MCSA_Global:
|
|
|
|
getAssembler().getOrCreateSymbolData(*Symbol).setExternal(true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
llvm_unreachable("unsupported attribute");
|
|
|
|
}
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
|
2010-07-19 06:13:10 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) {
|
2010-10-09 11:00:37 +00:00
|
|
|
assert((Symbol->isInSection()
|
|
|
|
? Symbol->getSection().getVariant() == MCSection::SV_COFF
|
|
|
|
: true) && "Got non COFF section in the COFF backend!");
|
2010-07-19 06:13:10 +00:00
|
|
|
assert(CurSymbol == NULL && "EndCOFFSymbolDef must be called between calls "
|
|
|
|
"to BeginCOFFSymbolDef!");
|
|
|
|
CurSymbol = Symbol;
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
|
2010-07-19 06:13:10 +00:00
|
|
|
assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
|
|
|
|
assert((StorageClass & ~0xFF) == 0 && "StorageClass must only have data in "
|
|
|
|
"the first byte!");
|
|
|
|
|
|
|
|
getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
|
|
|
|
StorageClass << COFF::SF_ClassShift,
|
|
|
|
COFF::SF_ClassMask);
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitCOFFSymbolType(int Type) {
|
2010-07-19 06:13:10 +00:00
|
|
|
assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
|
|
|
|
assert((Type & ~0xFFFF) == 0 && "Type must only have data in the first 2 "
|
|
|
|
"bytes");
|
|
|
|
|
|
|
|
getAssembler().getOrCreateSymbolData(*CurSymbol).modifyFlags(
|
|
|
|
Type << COFF::SF_TypeShift,
|
|
|
|
COFF::SF_TypeMask);
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EndCOFFSymbolDef() {
|
2010-07-19 06:13:10 +00:00
|
|
|
assert(CurSymbol != NULL && "BeginCOFFSymbolDef must be called first!");
|
|
|
|
CurSymbol = NULL;
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2011-12-17 01:14:52 +00:00
|
|
|
void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol)
|
|
|
|
{
|
|
|
|
MCDataFragment *DF = getOrCreateDataFragment();
|
|
|
|
|
2012-12-07 19:13:57 +00:00
|
|
|
DF->getFixups().push_back(
|
|
|
|
MCFixup::Create(DF->getContents().size(),
|
|
|
|
MCSymbolRefExpr::Create (Symbol, getContext ()),
|
|
|
|
FK_SecRel_4));
|
2011-12-17 01:14:52 +00:00
|
|
|
DF->getContents().resize(DF->getContents().size() + 4, 0);
|
|
|
|
}
|
|
|
|
|
2010-07-11 22:05:00 +00:00
|
|
|
void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
|
2010-07-19 06:13:10 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
2010-07-19 06:13:10 +00:00
|
|
|
unsigned ByteAlignment) {
|
2010-10-09 11:00:37 +00:00
|
|
|
assert((Symbol->isInSection()
|
|
|
|
? Symbol->getSection().getVariant() == MCSection::SV_COFF
|
|
|
|
: true) && "Got non COFF section in the COFF backend!");
|
2010-07-19 06:13:10 +00:00
|
|
|
AddCommonSymbol(Symbol, Size, ByteAlignment, true);
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2011-09-01 23:04:27 +00:00
|
|
|
void WinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|
|
|
unsigned ByteAlignment) {
|
2010-10-09 11:00:37 +00:00
|
|
|
assert((Symbol->isInSection()
|
|
|
|
? Symbol->getSection().getVariant() == MCSection::SV_COFF
|
|
|
|
: true) && "Got non COFF section in the COFF backend!");
|
2011-09-01 23:04:27 +00:00
|
|
|
AddCommonSymbol(Symbol, Size, ByteAlignment, false);
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
2012-06-22 20:14:46 +00:00
|
|
|
uint64_t Size,unsigned ByteAlignment) {
|
2010-07-19 06:13:10 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
|
|
|
uint64_t Size, unsigned ByteAlignment) {
|
2010-07-19 06:13:10 +00:00
|
|
|
llvm_unreachable("not implemented");
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {
|
|
|
|
// Ignore for now, linkers don't care, and proper debug
|
|
|
|
// info will be a much large effort.
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinCOFFStreamer::EmitInstruction(const MCInst &Instruction) {
|
2010-07-19 06:13:10 +00:00
|
|
|
for (unsigned i = 0, e = Instruction.getNumOperands(); i != e; ++i)
|
|
|
|
if (Instruction.getOperand(i).isExpr())
|
|
|
|
AddValueSymbols(Instruction.getOperand(i).getExpr());
|
|
|
|
|
|
|
|
getCurrentSectionData()->setHasInstructions(true);
|
|
|
|
|
|
|
|
MCInstFragment *Fragment =
|
|
|
|
new MCInstFragment(Instruction, getCurrentSectionData());
|
|
|
|
|
2012-12-07 19:13:57 +00:00
|
|
|
raw_svector_ostream VecOS(Fragment->getContents());
|
2010-07-19 06:13:10 +00:00
|
|
|
|
|
|
|
getAssembler().getEmitter().EncodeInstruction(Instruction, VecOS,
|
|
|
|
Fragment->getFixups());
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2011-05-22 03:01:05 +00:00
|
|
|
void WinCOFFStreamer::EmitWin64EHHandlerData() {
|
|
|
|
MCStreamer::EmitWin64EHHandlerData();
|
|
|
|
|
|
|
|
// We have to emit the unwind info now, because this directive
|
|
|
|
// actually switches to the .xdata section!
|
|
|
|
MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentW64UnwindInfo());
|
|
|
|
}
|
|
|
|
|
2012-01-07 03:13:18 +00:00
|
|
|
void WinCOFFStreamer::FinishImpl() {
|
2011-05-22 04:15:07 +00:00
|
|
|
EmitW64Tables();
|
2012-01-07 03:13:18 +00:00
|
|
|
MCObjectStreamer::FinishImpl();
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace llvm
|
|
|
|
{
|
|
|
|
MCStreamer *createWinCOFFStreamer(MCContext &Context,
|
2011-07-25 23:24:55 +00:00
|
|
|
MCAsmBackend &MAB,
|
2010-07-11 22:05:00 +00:00
|
|
|
MCCodeEmitter &CE,
|
2010-07-31 06:22:29 +00:00
|
|
|
raw_ostream &OS,
|
|
|
|
bool RelaxAll) {
|
2011-07-25 23:24:55 +00:00
|
|
|
WinCOFFStreamer *S = new WinCOFFStreamer(Context, MAB, CE, OS);
|
2010-07-31 06:22:29 +00:00
|
|
|
S->getAssembler().setRelaxAll(RelaxAll);
|
|
|
|
return S;
|
2010-07-11 22:05:00 +00:00
|
|
|
}
|
|
|
|
}
|