diff options
Diffstat (limited to 'lib/MC/WinCOFFStreamer.cpp')
-rw-r--r-- | lib/MC/WinCOFFStreamer.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/MC/WinCOFFStreamer.cpp b/lib/MC/WinCOFFStreamer.cpp index 7409daf39085..67dc649d4913 100644 --- a/lib/MC/WinCOFFStreamer.cpp +++ b/lib/MC/WinCOFFStreamer.cpp @@ -25,13 +25,13 @@ #include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCWin64EH.h" #include "llvm/MC/MCAsmBackend.h" -#include "llvm/ADT/StringMap.h" #include "llvm/Support/COFF.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" + using namespace llvm; namespace { @@ -60,6 +60,7 @@ public: virtual void EmitCOFFSymbolStorageClass(int StorageClass); virtual void EmitCOFFSymbolType(int Type); virtual void EndCOFFSymbolDef(); + virtual void EmitCOFFSecRel32(MCSymbol const *Symbol); virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment); @@ -77,7 +78,7 @@ public: virtual void EmitFileDirective(StringRef Filename); virtual void EmitInstruction(const MCInst &Instruction); virtual void EmitWin64EHHandlerData(); - virtual void Finish(); + virtual void FinishImpl(); private: virtual void EmitInstToFragment(const MCInst &Inst) { @@ -251,7 +252,6 @@ void WinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol, default: llvm_unreachable("unsupported attribute"); - break; } } @@ -293,6 +293,16 @@ void WinCOFFStreamer::EndCOFFSymbolDef() { CurSymbol = NULL; } +void WinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) +{ + MCDataFragment *DF = getOrCreateDataFragment(); + + DF->addFixup(MCFixup::Create(DF->getContents().size(), + MCSymbolRefExpr::Create (Symbol, getContext ()), + FK_SecRel_4)); + DF->getContents().resize(DF->getContents().size() + 4, 0); +} + void WinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { llvm_unreachable("not implemented"); } @@ -389,9 +399,9 @@ void WinCOFFStreamer::EmitWin64EHHandlerData() { MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentW64UnwindInfo()); } -void WinCOFFStreamer::Finish() { +void WinCOFFStreamer::FinishImpl() { EmitW64Tables(); - MCObjectStreamer::Finish(); + MCObjectStreamer::FinishImpl(); } namespace llvm |