LLVM  14.0.0git
MCWinCOFFStreamer.cpp
Go to the documentation of this file.
1 //===- llvm/MC/MCWinCOFFStreamer.cpp --------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains an implementation of a Windows COFF object file streamer.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/ADT/SmallString.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/Triple.h"
16 #include "llvm/ADT/Twine.h"
17 #include "llvm/BinaryFormat/COFF.h"
18 #include "llvm/MC/MCAsmBackend.h"
19 #include "llvm/MC/MCAssembler.h"
20 #include "llvm/MC/MCCodeEmitter.h"
21 #include "llvm/MC/MCContext.h"
22 #include "llvm/MC/MCExpr.h"
23 #include "llvm/MC/MCFixup.h"
24 #include "llvm/MC/MCFragment.h"
27 #include "llvm/MC/MCObjectWriter.h"
28 #include "llvm/MC/MCSection.h"
29 #include "llvm/MC/MCSymbolCOFF.h"
31 #include "llvm/Support/Casting.h"
34 #include "llvm/Support/SMLoc.h"
36 #include <algorithm>
37 #include <cassert>
38 #include <cstdint>
39 
40 using namespace llvm;
41 
42 #define DEBUG_TYPE "WinCOFFStreamer"
43 
45  std::unique_ptr<MCAsmBackend> MAB,
46  std::unique_ptr<MCCodeEmitter> CE,
47  std::unique_ptr<MCObjectWriter> OW)
48  : MCObjectStreamer(Context, std::move(MAB), std::move(OW), std::move(CE)),
49  CurSymbol(nullptr) {}
50 
52  const MCSubtargetInfo &STI) {
54 
56  SmallString<256> Code;
57  raw_svector_ostream VecOS(Code);
58  getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
59 
60  // Add the fixups and data.
61  for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
62  Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size());
63  DF->getFixups().push_back(Fixups[i]);
64  }
65  DF->setHasInstructions(STI);
66  DF->getContents().append(Code.begin(), Code.end());
67 }
68 
69 void MCWinCOFFStreamer::initSections(bool NoExecStack,
70  const MCSubtargetInfo &STI) {
71  // FIXME: this is identical to the ELF one.
72  // This emulates the same behavior of GNU as. This makes it easier
73  // to compare the output as the major sections are in the same order.
74  SwitchSection(getContext().getObjectFileInfo()->getTextSection());
75  emitCodeAlignment(4, &STI);
76 
77  SwitchSection(getContext().getObjectFileInfo()->getDataSection());
78  emitCodeAlignment(4, &STI);
79 
80  SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
81  emitCodeAlignment(4, &STI);
82 
83  SwitchSection(getContext().getObjectFileInfo()->getTextSection());
84 }
85 
87  auto *Symbol = cast<MCSymbolCOFF>(S);
89 }
90 
92  // Let the target do whatever target specific stuff it needs to do.
94 
95  switch (Flag) {
96  // None of these require COFF specific handling.
97  case MCAF_SyntaxUnified:
98  case MCAF_Code16:
99  case MCAF_Code32:
100  case MCAF_Code64:
101  break;
103  llvm_unreachable("COFF doesn't support .subsections_via_symbols");
104  }
105 }
106 
108  llvm_unreachable("not implemented");
109 }
110 
113  auto *Symbol = cast<MCSymbolCOFF>(S);
115 
116  switch (Attribute) {
117  default: return false;
118  case MCSA_WeakReference:
119  case MCSA_Weak:
120  Symbol->setIsWeakExternal();
121  Symbol->setExternal(true);
122  break;
123  case MCSA_Global:
124  Symbol->setExternal(true);
125  break;
126  case MCSA_AltEntry:
127  llvm_unreachable("COFF doesn't support the .alt_entry attribute");
128  }
129 
130  return true;
131 }
132 
134  llvm_unreachable("not implemented");
135 }
136 
138  auto *Symbol = cast<MCSymbolCOFF>(S);
139  if (CurSymbol)
140  Error("starting a new symbol definition without completing the "
141  "previous one");
142  CurSymbol = Symbol;
143 }
144 
146  if (!CurSymbol) {
147  Error("storage class specified outside of symbol definition");
148  return;
149  }
150 
152  Error("storage class value '" + Twine(StorageClass) +
153  "' out of range");
154  return;
155  }
156 
158  cast<MCSymbolCOFF>(CurSymbol)->setClass((uint16_t)StorageClass);
159 }
160 
162  if (!CurSymbol) {
163  Error("symbol type specified outside of a symbol definition");
164  return;
165  }
166 
167  if (Type & ~0xffff) {
168  Error("type value '" + Twine(Type) + "' out of range");
169  return;
170  }
171 
173  cast<MCSymbolCOFF>(CurSymbol)->setType((uint16_t)Type);
174 }
175 
177  if (!CurSymbol)
178  Error("ending symbol definition without starting one");
179  CurSymbol = nullptr;
180 }
181 
183  // SafeSEH is a feature specific to 32-bit x86. It does not exist (and is
184  // unnecessary) on all platforms which use table-based exception dispatch.
185  if (getContext().getTargetTriple().getArch() != Triple::x86)
186  return;
187 
188  const MCSymbolCOFF *CSymbol = cast<MCSymbolCOFF>(Symbol);
189  if (CSymbol->isSafeSEH())
190  return;
191 
193  getAssembler().registerSection(*SXData);
194  if (SXData->getAlignment() < 4)
195  SXData->setAlignment(Align(4));
196 
197  new MCSymbolIdFragment(Symbol, SXData);
198 
200  CSymbol->setIsSafeSEH();
201 
202  // The Microsoft linker requires that the symbol type of a handler be
203  // function. Go ahead and oblige it here.
206 }
207 
211  if (Sec->getAlignment() < 4)
212  Sec->setAlignment(Align(4));
213 
215 
217 }
218 
223  MCFixup Fixup = MCFixup::create(DF->getContents().size(), SRE, FK_SecRel_2);
224  DF->getFixups().push_back(Fixup);
225  DF->getContents().resize(DF->getContents().size() + 2, 0);
226 }
227 
229  uint64_t Offset) {
232  // Create Symbol A for the relocation relative reference.
234  // Add the constant offset, if given.
235  if (Offset)
238  // Build the secrel32 relocation.
239  MCFixup Fixup = MCFixup::create(DF->getContents().size(), MCE, FK_SecRel_4);
240  // Record the relocation.
241  DF->getFixups().push_back(Fixup);
242  // Emit 4 bytes (zeros) to the object file.
243  DF->getContents().resize(DF->getContents().size() + 4, 0);
244 }
245 
247  int64_t Offset) {
250  // Create Symbol A for the relocation relative reference.
251  const MCExpr *MCE = MCSymbolRefExpr::create(
253  // Add the constant offset, if given.
254  if (Offset)
257  // Build the imgrel relocation.
258  MCFixup Fixup = MCFixup::create(DF->getContents().size(), MCE, FK_Data_4);
259  // Record the relocation.
260  DF->getFixups().push_back(Fixup);
261  // Emit 4 bytes (zeros) to the object file.
262  DF->getContents().resize(DF->getContents().size() + 4, 0);
263 }
264 
266  unsigned ByteAlignment) {
267  auto *Symbol = cast<MCSymbolCOFF>(S);
268 
269  const Triple &T = getContext().getTargetTriple();
270  if (T.isWindowsMSVCEnvironment()) {
271  if (ByteAlignment > 32)
272  report_fatal_error("alignment is limited to 32-bytes");
273 
274  // Round size up to alignment so that we will honor the alignment request.
275  Size = std::max(Size, static_cast<uint64_t>(ByteAlignment));
276  }
277 
279  Symbol->setExternal(true);
280  Symbol->setCommon(Size, ByteAlignment);
281 
282  if (!T.isWindowsMSVCEnvironment() && ByteAlignment > 1) {
286 
287  OS << " -aligncomm:\"" << Symbol->getName() << "\","
289 
290  PushSection();
293  PopSection();
294  }
295 }
296 
298  unsigned ByteAlignment) {
299  auto *Symbol = cast<MCSymbolCOFF>(S);
300 
302  PushSection();
305  emitLabel(Symbol);
306  Symbol->setExternal(false);
307  emitZeros(Size);
308  PopSection();
309 }
310 
312  const MCSymbol *Symbol) {
313  auto *Alias = cast<MCSymbolCOFF>(AliasS);
315 
317  Alias->setVariableValue(MCSymbolRefExpr::create(
319 }
320 
322  uint64_t Size, unsigned ByteAlignment,
323  SMLoc Loc) {
324  llvm_unreachable("not implemented");
325 }
326 
328  uint64_t Size, unsigned ByteAlignment) {
329  llvm_unreachable("not implemented");
330 }
331 
332 // TODO: Implement this if you want to emit .comment section in COFF obj files.
334  llvm_unreachable("not implemented");
335 }
336 
338  llvm_unreachable("not implemented");
339 }
340 
342  const MCSymbolRefExpr *To,
343  uint64_t Count) {
344  // Ignore temporary symbols for now.
345  if (!From->getSymbol().isTemporary() && !To->getSymbol().isTemporary())
346  getAssembler().CGProfile.push_back({From, To, Count});
347 }
348 
350  const MCSymbol *S = &SRE->getSymbol();
351  bool Created;
352  getAssembler().registerSymbol(*S, &Created);
353  if (Created)
354  cast<MCSymbolCOFF>(S)->setExternal(true);
355 }
356 
358  for (MCAssembler::CGProfileEntry &E : getAssembler().CGProfile) {
361  }
362 }
363 
366 
368 }
369 
370 void MCWinCOFFStreamer::Error(const Twine &Msg) const {
371  getContext().reportError(SMLoc(), Msg);
372 }
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::MCAssembler::getBackend
MCAsmBackend & getBackend() const
Definition: MCAssembler.h:300
i
i
Definition: README.txt:29
llvm::MCContext::getObjectFileInfo
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:427
MathExtras.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MCObjectStreamer::emitLabel
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Definition: MCObjectStreamer.cpp:264
llvm::MCWinCOFFStreamer::emitLocalCommonSymbol
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a local common (.lcomm) symbol.
Definition: MCWinCOFFStreamer.cpp:297
llvm::MCWinCOFFStreamer::emitCommonSymbol
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a common symbol.
Definition: MCWinCOFFStreamer.cpp:265
llvm::MCAssembler::registerSymbol
void registerSymbol(const MCSymbol &Symbol, bool *Created=nullptr)
Definition: MCAssembler.cpp:463
llvm::MCObjectStreamer::emitValueToAlignment
void emitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
Definition: MCObjectStreamer.cpp:597
llvm::MCSymbol::isTemporary
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:215
T
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Attribute
Definition: Attributes.h:51
MCCodeEmitter.h
llvm::Triple::x86
@ x86
Definition: Triple.h:83
llvm::MCConstantExpr::create
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition: MCExpr.cpp:194
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::MCAsmBackend::handleAssemblerFlag
virtual void handleAssemblerFlag(MCAssemblerFlag Flag)
Handle any target-specific assembler flags. By default, do nothing.
Definition: MCAsmBackend.h:205
llvm::MCFixup::create
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Definition: MCFixup.h:87
ErrorHandling.h
llvm::MCWinCOFFStreamer::emitIdent
void emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
Definition: MCWinCOFFStreamer.cpp:333
MCFragment.h
llvm::MCWinCOFFStreamer::emitCGProfileEntry
void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count) override
Definition: MCWinCOFFStreamer.cpp:341
llvm::COFF::SCT_COMPLEX_TYPE_SHIFT
@ SCT_COMPLEX_TYPE_SHIFT
Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
Definition: COFF.h:265
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
MCAssembler.h
COFF.h
MCObjectFileInfo.h
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::COFF::SSC_Invalid
@ SSC_Invalid
Definition: COFF.h:204
llvm::MCWinCOFFStreamer::EmitCOFFSymbolType
void EmitCOFFSymbolType(int Type) override
Emit the type of the symbol.
Definition: MCWinCOFFStreamer.cpp:161
llvm::MCObjectStreamer::visitUsedSymbol
void visitUsedSymbol(const MCSymbol &Sym) override
Definition: MCObjectStreamer.cpp:212
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::MCWinCOFFStreamer::emitAssemblerFlag
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
Definition: MCWinCOFFStreamer.cpp:91
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::MCAssemblerFlag
MCAssemblerFlag
Definition: MCDirectives.h:50
llvm::getOffset
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
Definition: RuntimeDyld.cpp:170
llvm::MCSymbolAttr
MCSymbolAttr
Definition: MCDirectives.h:18
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::MCWinCOFFStreamer::emitThumbFunc
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
Definition: MCWinCOFFStreamer.cpp:107
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:82
MCObjectStreamer.h
llvm::MCWinCOFFStreamer::BeginCOFFSymbolDef
void BeginCOFFSymbolDef(MCSymbol const *Symbol) override
Start emitting COFF symbol definition.
Definition: MCWinCOFFStreamer.cpp:137
llvm::MCWinCOFFStreamer::emitLabel
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Definition: MCWinCOFFStreamer.cpp:86
llvm::FK_Data_4
@ FK_Data_4
A four-byte fixup.
Definition: MCFixup.h:25
llvm::MCSymbolCOFF::setIsSafeSEH
void setIsSafeSEH() const
Definition: MCSymbolCOFF.h:57
MCAsmBackend.h
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::MCWinCOFFStreamer::EmitCOFFSafeSEH
void EmitCOFFSafeSEH(MCSymbol const *Symbol) override
Definition: MCWinCOFFStreamer.cpp:182
SmallString.h
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::FK_SecRel_4
@ FK_SecRel_4
A four-byte section relative fixup.
Definition: MCFixup.h:42
llvm::MCSA_AltEntry
@ MCSA_AltEntry
.alt_entry (MachO)
Definition: MCDirectives.h:40
Twine.h
MCContext.h
llvm::MCSymbolIdFragment
Represents a symbol table index fragment.
Definition: MCFragment.h:499
llvm::MCAF_Code16
@ MCAF_Code16
.code16 (X86) / .code 16 (ARM)
Definition: MCDirectives.h:53
llvm::FK_SecRel_2
@ FK_SecRel_2
A two-byte section relative fixup.
Definition: MCFixup.h:41
llvm::MCObjectStreamer
Streaming object file generation interface.
Definition: MCObjectStreamer.h:36
llvm::MCWinCOFFStreamer::emitSymbolAttribute
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
Definition: MCWinCOFFStreamer.cpp:111
llvm::AArch64::Fixups
Fixups
Definition: AArch64FixupKinds.h:17
llvm::MCSymbolCOFF
Definition: MCSymbolCOFF.h:17
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:146
SMLoc.h
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:143
llvm::MCWinCOFFStreamer::EmitCOFFSymbolStorageClass
void EmitCOFFSymbolStorageClass(int StorageClass) override
Emit the storage class of the symbol.
Definition: MCWinCOFFStreamer.cpp:145
llvm::MCSymbolRefExpr::getSymbol
const MCSymbol & getSymbol() const
Definition: MCExpr.h:399
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::MCWinCOFFStreamer::emitZerofill
void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
Definition: MCWinCOFFStreamer.cpp:321
llvm::MCStreamer::getCurrentSectionOnly
MCSection * getCurrentSectionOnly() const
Definition: MCStreamer.h:376
llvm::MCContext::getTargetTriple
const Triple & getTargetTriple() const
Definition: MCContext.h:409
llvm::MCSymbolCOFF::setType
void setType(uint16_t Ty) const
Definition: MCSymbolCOFF.h:36
DF
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
llvm::Log2_32_Ceil
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
Definition: MathExtras.h:609
llvm::MCWinCOFFStreamer::emitSymbolDesc
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
Definition: MCWinCOFFStreamer.cpp:133
llvm::SmallString< 256 >
llvm::MCWinCOFFStreamer::initSections
void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override
Create the default sections and set the initial one.
Definition: MCWinCOFFStreamer.cpp:69
llvm::XCOFF::StorageClass
StorageClass
Definition: XCOFF.h:126
llvm::MCWinCOFFStreamer::EmitCOFFImgRel32
void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override
Emits a COFF image relative relocation.
Definition: MCWinCOFFStreamer.cpp:246
llvm::MCAssembler::getEmitter
MCCodeEmitter & getEmitter() const
Definition: MCAssembler.h:302
llvm::MCAF_SubsectionsViaSymbols
@ MCAF_SubsectionsViaSymbols
.subsections_via_symbols (MachO)
Definition: MCDirectives.h:52
uint64_t
llvm::MCSymbolCOFF::isSafeSEH
bool isSafeSEH() const
Definition: MCSymbolCOFF.h:54
llvm::MCWinCOFFStreamer::finalizeCGProfile
void finalizeCGProfile()
Definition: MCWinCOFFStreamer.cpp:357
llvm::MCSA_WeakReference
@ MCSA_WeakReference
.weak_reference (MachO)
Definition: MCDirectives.h:46
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::MCWinCOFFStreamer::EndCOFFSymbolDef
void EndCOFFSymbolDef() override
Marks the end of the symbol definition.
Definition: MCWinCOFFStreamer.cpp:176
llvm::MCStreamer::PopSection
bool PopSection()
Restore the current and previous section from the section stack.
Definition: MCStreamer.h:407
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1658
llvm::MCContext::reportError
void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:963
llvm::MCSymbolRefExpr
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
MCSection.h
Triple.h
llvm::MCBinaryExpr::createAdd
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition: MCExpr.h:525
llvm::MCObjectStreamer::getAssembler
MCAssembler & getAssembler()
Definition: MCObjectStreamer.h:112
llvm::MCObjectStreamer::getOrCreateDataFragment
MCDataFragment * getOrCreateDataFragment(const MCSubtargetInfo *STI=nullptr)
Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.
Definition: MCObjectStreamer.cpp:203
llvm::MCSection::getAlignment
unsigned getAlignment() const
Definition: MCSection.h:138
Fixup
PowerPC TLS Dynamic Call Fixup
Definition: PPCTLSDynamicCall.cpp:233
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::MCWinCOFFStreamer::finishImpl
void finishImpl() override
Streamer specific finalization.
Definition: MCWinCOFFStreamer.cpp:364
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
MCFixup.h
llvm::MCObjectFileInfo::getDrectveSection
MCSection * getDrectveSection() const
Definition: MCObjectFileInfo.h:410
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
MCWinCOFFStreamer.h
llvm::MCSymbolRefExpr::VK_WEAKREF
@ VK_WEAKREF
Definition: MCExpr.h:225
llvm::MCAF_Code32
@ MCAF_Code32
.code32 (X86) / .code 32 (ARM)
Definition: MCDirectives.h:54
llvm::MCWinCOFFStreamer::EmitCOFFSecRel32
void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override
Emits a COFF section relative relocation.
Definition: MCWinCOFFStreamer.cpp:228
llvm::MCSection::setAlignment
void setAlignment(Align Value)
Definition: MCSection.h:139
llvm::MCAF_Code64
@ MCAF_Code64
.code64 (X86)
Definition: MCDirectives.h:55
MCObjectWriter.h
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::MCAF_SyntaxUnified
@ MCAF_SyntaxUnified
.syntax (ARM/ELF)
Definition: MCDirectives.h:51
std
Definition: BitVector.h:838
uint16_t
llvm::MCWinCOFFStreamer::emitWeakReference
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
Definition: MCWinCOFFStreamer.cpp:311
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::MCStreamer::PushSection
void PushSection()
Save the current and previous section on the section stack.
Definition: MCStreamer.h:398
llvm::MCWinCOFFStreamer::EmitCOFFSectionIndex
void EmitCOFFSectionIndex(MCSymbol const *Symbol) override
Emits a COFF section index.
Definition: MCWinCOFFStreamer.cpp:219
Casting.h
llvm::MCWinCOFFStreamer::emitInstToData
void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override
Definition: MCWinCOFFStreamer.cpp:51
MCSymbolCOFF.h
llvm::MCObjectFileInfo::getBSSSection
MCSection * getBSSSection() const
Definition: MCObjectFileInfo.h:260
llvm::MCWinCOFFStreamer::EmitCOFFSymbolIndex
void EmitCOFFSymbolIndex(MCSymbol const *Symbol) override
Emits the symbol table index of a Symbol into the current section.
Definition: MCWinCOFFStreamer.cpp:208
llvm::MCSymbolRefExpr::VK_COFF_IMGREL32
@ VK_COFF_IMGREL32
Definition: MCExpr.h:316
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:386
llvm::MCSA_Global
@ MCSA_Global
.type _foo, @gnu_unique_object
Definition: MCDirectives.h:30
llvm::LCOMM::ByteAlignment
@ ByteAlignment
Definition: MCAsmInfo.h:50
llvm::MCAssembler::registerSection
bool registerSection(MCSection &Section)
Definition: MCAssembler.cpp:123
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::MCSA_Weak
@ MCSA_Weak
.weak
Definition: MCDirectives.h:44
llvm::MCObjectStreamer::emitBytes
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
Definition: MCObjectStreamer.cpp:590
llvm::MCStreamer::getContext
MCContext & getContext() const
Definition: MCStreamer.h:280
SmallVector.h
llvm::MCWinCOFFStreamer::emitTBSSSymbol
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a thread local bss (.tbss) symbol.
Definition: MCWinCOFFStreamer.cpp:327
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
llvm::raw_svector_ostream
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:658
llvm::MCWinCOFFStreamer::CurSymbol
const MCSymbol * CurSymbol
Definition: MCWinCOFFStreamer.h:75
llvm::MCWinCOFFStreamer::MCWinCOFFStreamer
MCWinCOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCCodeEmitter > CE, std::unique_ptr< MCObjectWriter > OW)
Definition: MCWinCOFFStreamer.cpp:44
llvm::MCWinCOFFStreamer::EmitWinEHHandlerData
void EmitWinEHHandlerData(SMLoc Loc) override
Definition: MCWinCOFFStreamer.cpp:337
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::MCObjectStreamer::finishImpl
void finishImpl() override
Streamer specific finalization.
Definition: MCObjectStreamer.cpp:870
raw_ostream.h
llvm::MCObjectStreamer::emitCodeAlignment
void emitCodeAlignment(unsigned ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0) override
Emit nops until the byte alignment ByteAlignment is reached.
Definition: MCObjectStreamer.cpp:611
llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION
@ IMAGE_SYM_DTYPE_FUNCTION
A function that returns a base type.
Definition: COFF.h:261
llvm::MCObjectFileInfo::getSXDataSection
MCSection * getSXDataSection() const
Definition: MCObjectFileInfo.h:413
llvm::MCDataFragment
Fragment for data and encoded instructions.
Definition: MCFragment.h:242
llvm::MCStreamer::SwitchSection
virtual void SwitchSection(MCSection *Section, const MCExpr *Subsection=nullptr)
Set the current section where code is being emitted to Section.
Definition: MCStreamer.cpp:1212
MCExpr.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::MCFixup
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:71
llvm::Directive
Definition: DirectiveEmitter.h:100
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::MCObjectFileInfo
Definition: MCObjectFileInfo.h:26
llvm::MCAssembler::CGProfileEntry
Definition: MCAssembler.h:436
llvm::MCCodeEmitter::encodeInstruction
virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.
llvm::MCWinCOFFStreamer::finalizeCGProfileEntry
void finalizeCGProfileEntry(const MCSymbolRefExpr *&S)
Definition: MCWinCOFFStreamer.cpp:349
llvm::MCStreamer::emitZeros
void emitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
Definition: MCStreamer.cpp:226
llvm::MCAssembler::CGProfile
std::vector< CGProfileEntry > CGProfile
Definition: MCAssembler.h:441