Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 1 | //===-- 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 | // |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 10 | // This file contains an implementation of a Windows COFF object file streamer. |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 14 | #include "llvm/ADT/StringExtras.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 15 | #include "llvm/MC/MCStreamer.h" |
Evan Cheng | 5928e69 | 2011-07-25 23:24:55 +0000 | [diff] [blame] | 16 | #include "llvm/MC/MCAsmBackend.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 17 | #include "llvm/MC/MCAsmLayout.h" |
| 18 | #include "llvm/MC/MCAssembler.h" |
| 19 | #include "llvm/MC/MCCodeEmitter.h" |
| 20 | #include "llvm/MC/MCContext.h" |
| 21 | #include "llvm/MC/MCExpr.h" |
Rafael Espindola | e308c0c | 2014-01-23 22:49:25 +0000 | [diff] [blame] | 22 | #include "llvm/MC/MCObjectFileInfo.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 23 | #include "llvm/MC/MCObjectStreamer.h" |
| 24 | #include "llvm/MC/MCSection.h" |
| 25 | #include "llvm/MC/MCSectionCOFF.h" |
| 26 | #include "llvm/MC/MCSymbol.h" |
| 27 | #include "llvm/MC/MCValue.h" |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 28 | #include "llvm/MC/MCWinCOFFStreamer.h" |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 29 | #include "llvm/Support/COFF.h" |
| 30 | #include "llvm/Support/Debug.h" |
| 31 | #include "llvm/Support/ErrorHandling.h" |
Saleem Abdulrasool | 64d491e | 2014-10-07 19:37:57 +0000 | [diff] [blame] | 32 | #include "llvm/Support/MathExtras.h" |
Evan Cheng | 2bb4035 | 2011-08-24 18:08:43 +0000 | [diff] [blame] | 33 | #include "llvm/Support/TargetRegistry.h" |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 34 | #include "llvm/Support/raw_ostream.h" |
Rafael Espindola | d3df3d3 | 2011-12-17 01:14:52 +0000 | [diff] [blame] | 35 | |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 36 | using namespace llvm; |
| 37 | |
Chandler Carruth | f58e376 | 2014-04-22 03:04:17 +0000 | [diff] [blame] | 38 | #define DEBUG_TYPE "WinCOFFStreamer" |
| 39 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 40 | namespace llvm { |
| 41 | MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context, MCAsmBackend &MAB, |
| 42 | MCCodeEmitter &CE, raw_ostream &OS) |
Craig Topper | bb694de | 2014-04-13 04:57:38 +0000 | [diff] [blame] | 43 | : MCObjectStreamer(Context, MAB, OS, &CE), CurSymbol(nullptr) {} |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 44 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 45 | void MCWinCOFFStreamer::EmitInstToData(const MCInst &Inst, |
| 46 | const MCSubtargetInfo &STI) { |
| 47 | MCDataFragment *DF = getOrCreateDataFragment(); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 48 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 49 | SmallVector<MCFixup, 4> Fixups; |
| 50 | SmallString<256> Code; |
| 51 | raw_svector_ostream VecOS(Code); |
| 52 | getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, Fixups, STI); |
| 53 | VecOS.flush(); |
| 54 | |
| 55 | // Add the fixups and data. |
| 56 | for (unsigned i = 0, e = Fixups.size(); i != e; ++i) { |
| 57 | Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size()); |
| 58 | DF->getFixups().push_back(Fixups[i]); |
| 59 | } |
| 60 | |
| 61 | DF->getContents().append(Code.begin(), Code.end()); |
| 62 | } |
| 63 | |
Rafael Espindola | 7b61ddf | 2014-10-15 16:12:52 +0000 | [diff] [blame] | 64 | void MCWinCOFFStreamer::InitSections(bool NoExecStack) { |
Rafael Espindola | f281253 | 2014-01-24 02:28:11 +0000 | [diff] [blame] | 65 | // FIXME: this is identical to the ELF one. |
| 66 | // This emulates the same behavior of GNU as. This makes it easier |
| 67 | // to compare the output as the major sections are in the same order. |
| 68 | SwitchSection(getContext().getObjectFileInfo()->getTextSection()); |
Rafael Espindola | 7b51496 | 2014-02-04 18:34:04 +0000 | [diff] [blame] | 69 | EmitCodeAlignment(4); |
Rafael Espindola | f281253 | 2014-01-24 02:28:11 +0000 | [diff] [blame] | 70 | |
| 71 | SwitchSection(getContext().getObjectFileInfo()->getDataSection()); |
Rafael Espindola | 7b51496 | 2014-02-04 18:34:04 +0000 | [diff] [blame] | 72 | EmitCodeAlignment(4); |
Rafael Espindola | f281253 | 2014-01-24 02:28:11 +0000 | [diff] [blame] | 73 | |
| 74 | SwitchSection(getContext().getObjectFileInfo()->getBSSSection()); |
Rafael Espindola | 7b51496 | 2014-02-04 18:34:04 +0000 | [diff] [blame] | 75 | EmitCodeAlignment(4); |
Rafael Espindola | f281253 | 2014-01-24 02:28:11 +0000 | [diff] [blame] | 76 | |
| 77 | SwitchSection(getContext().getObjectFileInfo()->getTextSection()); |
Rafael Espindola | f667d92 | 2010-09-15 21:48:40 +0000 | [diff] [blame] | 78 | } |
| 79 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 80 | void MCWinCOFFStreamer::EmitLabel(MCSymbol *Symbol) { |
Rafael Espindola | 1679580 | 2010-11-28 16:22:59 +0000 | [diff] [blame] | 81 | assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); |
Rafael Espindola | e5b7415 | 2010-11-28 17:18:55 +0000 | [diff] [blame] | 82 | MCObjectStreamer::EmitLabel(Symbol); |
Rafael Espindola | 1679580 | 2010-11-28 16:22:59 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 85 | void MCWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 86 | llvm_unreachable("not implemented"); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 87 | } |
| 88 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 89 | void MCWinCOFFStreamer::EmitThumbFunc(MCSymbol *Func) { |
Jim Grosbach | 5a2c68d | 2010-11-05 22:08:08 +0000 | [diff] [blame] | 90 | llvm_unreachable("not implemented"); |
| 91 | } |
| 92 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 93 | bool MCWinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol, |
| 94 | MCSymbolAttr Attribute) { |
Michael J. Spencer | be52c62 | 2010-10-09 11:00:37 +0000 | [diff] [blame] | 95 | assert(Symbol && "Symbol must be non-null!"); |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 96 | assert((!Symbol->isInSection() || |
| 97 | Symbol->getSection().getVariant() == MCSection::SV_COFF) && |
| 98 | "Got non-COFF section in the COFF backend!"); |
| 99 | |
| 100 | MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); |
| 101 | |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 102 | switch (Attribute) { |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 103 | default: return false; |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 104 | case MCSA_WeakReference: |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 105 | case MCSA_Weak: |
| 106 | SD.modifyFlags(COFF::SF_WeakExternal, COFF::SF_WeakExternal); |
| 107 | SD.setExternal(true); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 108 | break; |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 109 | case MCSA_Global: |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 110 | SD.setExternal(true); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 111 | break; |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 112 | } |
Saleem Abdulrasool | 4208b61 | 2013-08-09 01:52:03 +0000 | [diff] [blame] | 113 | |
| 114 | return true; |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 115 | } |
| 116 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 117 | void MCWinCOFFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 118 | llvm_unreachable("not implemented"); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 119 | } |
| 120 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 121 | void MCWinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) { |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 122 | assert((!Symbol->isInSection() || |
| 123 | Symbol->getSection().getVariant() == MCSection::SV_COFF) && |
| 124 | "Got non-COFF section in the COFF backend!"); |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 125 | |
| 126 | if (CurSymbol) |
| 127 | FatalError("starting a new symbol definition without completing the " |
| 128 | "previous one"); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 129 | CurSymbol = Symbol; |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 130 | } |
| 131 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 132 | void MCWinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) { |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 133 | if (!CurSymbol) |
| 134 | FatalError("storage class specified outside of symbol definition"); |
| 135 | |
David Majnemer | 2cc4bc77 | 2014-11-11 08:43:57 +0000 | [diff] [blame^] | 136 | if (StorageClass & ~COFF::SSC_Invalid) |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 137 | FatalError(Twine("storage class value '") + itostr(StorageClass) + |
| 138 | "' out of range"); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 139 | |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 140 | MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*CurSymbol); |
| 141 | SD.modifyFlags(StorageClass << COFF::SF_ClassShift, COFF::SF_ClassMask); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 142 | } |
| 143 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 144 | void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) { |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 145 | if (!CurSymbol) |
| 146 | FatalError("symbol type specified outside of a symbol definition"); |
| 147 | |
| 148 | if (Type & ~0xffff) |
| 149 | FatalError(Twine("type value '") + itostr(Type) + "' out of range"); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 150 | |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 151 | MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*CurSymbol); |
| 152 | SD.modifyFlags(Type << COFF::SF_TypeShift, COFF::SF_TypeMask); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 155 | void MCWinCOFFStreamer::EndCOFFSymbolDef() { |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 156 | if (!CurSymbol) |
| 157 | FatalError("ending symbol definition without starting one"); |
Craig Topper | bb694de | 2014-04-13 04:57:38 +0000 | [diff] [blame] | 158 | CurSymbol = nullptr; |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 161 | void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) { |
Timur Iskhodzhanov | c1fb2d6 | 2013-12-20 18:15:00 +0000 | [diff] [blame] | 162 | MCDataFragment *DF = getOrCreateDataFragment(); |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 163 | const MCSymbolRefExpr *SRE = MCSymbolRefExpr::Create(Symbol, getContext()); |
| 164 | MCFixup Fixup = MCFixup::Create(DF->getContents().size(), SRE, FK_SecRel_2); |
| 165 | DF->getFixups().push_back(Fixup); |
Timur Iskhodzhanov | 5fcaeeb | 2014-10-08 18:01:49 +0000 | [diff] [blame] | 166 | DF->getContents().resize(DF->getContents().size() + 2, 0); |
Timur Iskhodzhanov | c1fb2d6 | 2013-12-20 18:15:00 +0000 | [diff] [blame] | 167 | } |
| 168 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 169 | void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) { |
Rafael Espindola | d3df3d3 | 2011-12-17 01:14:52 +0000 | [diff] [blame] | 170 | MCDataFragment *DF = getOrCreateDataFragment(); |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 171 | const MCSymbolRefExpr *SRE = MCSymbolRefExpr::Create(Symbol, getContext()); |
| 172 | MCFixup Fixup = MCFixup::Create(DF->getContents().size(), SRE, FK_SecRel_4); |
| 173 | DF->getFixups().push_back(Fixup); |
Rafael Espindola | d3df3d3 | 2011-12-17 01:14:52 +0000 | [diff] [blame] | 174 | DF->getContents().resize(DF->getContents().size() + 4, 0); |
| 175 | } |
| 176 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 177 | void MCWinCOFFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) { |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 178 | llvm_unreachable("not supported"); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 179 | } |
| 180 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 181 | void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, |
| 182 | unsigned ByteAlignment) { |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 183 | assert((!Symbol->isInSection() || |
| 184 | Symbol->getSection().getVariant() == MCSection::SV_COFF) && |
| 185 | "Got non-COFF section in the COFF backend!"); |
David Majnemer | a9bdb32 | 2014-04-08 22:33:40 +0000 | [diff] [blame] | 186 | |
David Majnemer | 48227a3 | 2014-09-21 09:18:07 +0000 | [diff] [blame] | 187 | const Triple &T = getContext().getObjectFileInfo()->getTargetTriple(); |
David Majnemer | d758604 | 2014-10-08 06:38:53 +0000 | [diff] [blame] | 188 | if (T.isKnownWindowsMSVCEnvironment()) { |
David Majnemer | 48227a3 | 2014-09-21 09:18:07 +0000 | [diff] [blame] | 189 | if (ByteAlignment > 32) |
| 190 | report_fatal_error("alignment is limited to 32-bytes"); |
Saleem Abdulrasool | 64d491e | 2014-10-07 19:37:57 +0000 | [diff] [blame] | 191 | |
David Majnemer | d758604 | 2014-10-08 06:38:53 +0000 | [diff] [blame] | 192 | // Round size up to alignment so that we will honor the alignment request. |
| 193 | Size = std::max(Size, static_cast<uint64_t>(ByteAlignment)); |
| 194 | } |
David Majnemer | a9bdb32 | 2014-04-08 22:33:40 +0000 | [diff] [blame] | 195 | |
Craig Topper | bb694de | 2014-04-13 04:57:38 +0000 | [diff] [blame] | 196 | AssignSection(Symbol, nullptr); |
David Majnemer | a9bdb32 | 2014-04-08 22:33:40 +0000 | [diff] [blame] | 197 | |
| 198 | MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); |
| 199 | SD.setExternal(true); |
| 200 | SD.setCommon(Size, ByteAlignment); |
Saleem Abdulrasool | 64d491e | 2014-10-07 19:37:57 +0000 | [diff] [blame] | 201 | |
| 202 | if (!T.isKnownWindowsMSVCEnvironment() && ByteAlignment > 1) { |
| 203 | SmallString<128> Directive; |
| 204 | raw_svector_ostream OS(Directive); |
| 205 | const MCObjectFileInfo *MFI = getContext().getObjectFileInfo(); |
| 206 | |
| 207 | OS << " -aligncomm:\"" << Symbol->getName() << "\"," |
| 208 | << Log2_32_Ceil(ByteAlignment); |
| 209 | OS.flush(); |
| 210 | |
| 211 | PushSection(); |
| 212 | SwitchSection(MFI->getDrectveSection()); |
| 213 | EmitBytes(Directive); |
| 214 | PopSection(); |
| 215 | } |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 216 | } |
| 217 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 218 | void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, |
| 219 | unsigned ByteAlignment) { |
David Majnemer | a9bdb32 | 2014-04-08 22:33:40 +0000 | [diff] [blame] | 220 | assert(!Symbol->isInSection() && "Symbol must not already have a section!"); |
| 221 | |
| 222 | const MCSection *Section = getContext().getObjectFileInfo()->getBSSSection(); |
| 223 | MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section); |
| 224 | if (SectionData.getAlignment() < ByteAlignment) |
| 225 | SectionData.setAlignment(ByteAlignment); |
| 226 | |
| 227 | MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol); |
| 228 | SD.setExternal(false); |
| 229 | |
| 230 | AssignSection(Symbol, Section); |
| 231 | |
| 232 | if (ByteAlignment != 1) |
| 233 | new MCAlignFragment(ByteAlignment, /*_Value=*/0, /*_ValueSize=*/0, |
| 234 | ByteAlignment, &SectionData); |
| 235 | |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 236 | MCFillFragment *Fragment = |
| 237 | new MCFillFragment(/*_Value=*/0, /*_ValueSize=*/0, Size, &SectionData); |
| 238 | SD.setFragment(Fragment); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 239 | } |
| 240 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 241 | void MCWinCOFFStreamer::EmitZerofill(const MCSection *Section, |
| 242 | MCSymbol *Symbol, uint64_t Size, |
| 243 | unsigned ByteAlignment) { |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 244 | llvm_unreachable("not implemented"); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 245 | } |
| 246 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 247 | void MCWinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section, |
| 248 | MCSymbol *Symbol, uint64_t Size, |
| 249 | unsigned ByteAlignment) { |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 250 | llvm_unreachable("not implemented"); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 251 | } |
| 252 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 253 | void MCWinCOFFStreamer::EmitFileDirective(StringRef Filename) { |
Saleem Abdulrasool | a2bf05a | 2014-04-16 04:15:32 +0000 | [diff] [blame] | 254 | getAssembler().addFileName(Filename); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Rafael Espindola | 5645bad | 2013-10-16 01:05:45 +0000 | [diff] [blame] | 257 | // TODO: Implement this if you want to emit .comment section in COFF obj files. |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 258 | void MCWinCOFFStreamer::EmitIdent(StringRef IdentString) { |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 259 | llvm_unreachable("not implemented"); |
Rafael Espindola | 5645bad | 2013-10-16 01:05:45 +0000 | [diff] [blame] | 260 | } |
| 261 | |
Saleem Abdulrasool | 7206a52 | 2014-06-29 01:52:01 +0000 | [diff] [blame] | 262 | void MCWinCOFFStreamer::EmitWinEHHandlerData() { |
Saleem Abdulrasool | a8b1f72 | 2014-04-27 03:48:12 +0000 | [diff] [blame] | 263 | llvm_unreachable("not implemented"); |
Charles Davis | 1c8bd5a | 2011-05-22 03:01:05 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Saleem Abdulrasool | cf1a29f | 2014-04-27 03:48:05 +0000 | [diff] [blame] | 266 | void MCWinCOFFStreamer::FinishImpl() { |
Rafael Espindola | 0708209 | 2012-01-07 03:13:18 +0000 | [diff] [blame] | 267 | MCObjectStreamer::FinishImpl(); |
Chris Lattner | 56725be | 2010-07-11 22:05:00 +0000 | [diff] [blame] | 268 | } |
Saleem Abdulrasool | 6663f8f | 2014-05-22 02:18:10 +0000 | [diff] [blame] | 269 | |
| 270 | LLVM_ATTRIBUTE_NORETURN |
| 271 | void MCWinCOFFStreamer::FatalError(const Twine &Msg) const { |
| 272 | getContext().FatalError(SMLoc(), Msg); |
| 273 | } |
Saleem Abdulrasool | 8e4fee0 | 2014-04-27 03:48:01 +0000 | [diff] [blame] | 274 | } |
| 275 | |