LLVM 22.0.0git
MCMachOStreamer.cpp
Go to the documentation of this file.
1//===- MCMachOStreamer.cpp - MachO Streamer -------------------------------===//
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#include "llvm/ADT/DenseMap.h"
11#include "llvm/ADT/StringRef.h"
14#include "llvm/MC/MCAssembler.h"
16#include "llvm/MC/MCContext.h"
18#include "llvm/MC/MCExpr.h"
19#include "llvm/MC/MCFixup.h"
25#include "llvm/MC/MCSection.h"
27#include "llvm/MC/MCSymbol.h"
29#include "llvm/MC/MCValue.h"
30#include "llvm/MC/SectionKind.h"
34#include <cassert>
35#include <vector>
36
37namespace llvm {
38class MCInst;
39class MCStreamer;
40class MCSubtargetInfo;
41class Triple;
42} // namespace llvm
43
44using namespace llvm;
45
46namespace {
47
48class MCMachOStreamer : public MCObjectStreamer {
49private:
50 /// LabelSections - true if each section change should emit a linker local
51 /// label for use in relocations for assembler local references. Obviates the
52 /// need for local relocations. False by default.
53 bool LabelSections;
54
55 /// HasSectionLabel - map of which sections have already had a non-local
56 /// label emitted to them. Used so we don't emit extraneous linker local
57 /// labels in the middle of the section.
59
60 void emitDataRegion(MachO::DataRegionType Kind);
61 void emitDataRegionEnd();
62
63public:
64 MCMachOStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
65 std::unique_ptr<MCObjectWriter> OW,
66 std::unique_ptr<MCCodeEmitter> Emitter, bool label)
67 : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
68 std::move(Emitter)),
69 LabelSections(label) {}
70
71 /// state management
72 void reset() override {
73 HasSectionLabel.clear();
75 }
76
77 MachObjectWriter &getWriter() {
78 return static_cast<MachObjectWriter &>(getAssembler().getWriter());
79 }
80
81 /// @name MCStreamer Interface
82 /// @{
83
84 void changeSection(MCSection *Sect, uint32_t Subsection = 0) override;
85 void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
86 void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
87 void emitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
88 void emitSubsectionsViaSymbols() override;
89 void emitLinkerOptions(ArrayRef<std::string> Options) override;
90 void emitDataRegion(MCDataRegionType Kind) override;
91 void emitVersionMin(MCVersionMinType Kind, unsigned Major, unsigned Minor,
92 unsigned Update, VersionTuple SDKVersion) override;
93 void emitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor,
94 unsigned Update, VersionTuple SDKVersion) override;
95 void emitDarwinTargetVariantBuildVersion(unsigned Platform, unsigned Major,
96 unsigned Minor, unsigned Update,
97 VersionTuple SDKVersion) override;
98 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
99 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
100 void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
101 Align ByteAlignment) override;
102
103 void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
104 Align ByteAlignment) override;
105 void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
106 uint64_t Size = 0, Align ByteAlignment = Align(1),
107 SMLoc Loc = SMLoc()) override;
108 void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
109 Align ByteAlignment = Align(1)) override;
110
111 void emitIdent(StringRef IdentString) override {
112 llvm_unreachable("macho doesn't support this directive");
113 }
114
115 void emitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override {
116 getWriter().getLOHContainer().addDirective(Kind, Args);
117 }
118 void emitCGProfileEntry(const MCSymbolRefExpr *From,
119 const MCSymbolRefExpr *To, uint64_t Count) override {
120 if (!From->getSymbol().isTemporary() && !To->getSymbol().isTemporary())
121 getWriter().getCGProfile().push_back({From, To, Count});
122 }
123
124 void finishImpl() override;
125
126 void finalizeCGProfileEntry(const MCSymbolRefExpr *&SRE);
127 void finalizeCGProfile();
128 void createAddrSigSection();
129};
130
131} // end anonymous namespace.
132
133void MCMachOStreamer::changeSection(MCSection *Section, uint32_t Subsection) {
134 MCObjectStreamer::changeSection(Section, Subsection);
135
136 // Output a linker-local symbol so we don't need section-relative local
137 // relocations. The linker hates us when we do that.
138 if (LabelSections && !HasSectionLabel[Section] &&
139 !Section->getBeginSymbol()) {
140 MCSymbol *Label = getContext().createLinkerPrivateTempSymbol();
141 Section->setBeginSymbol(Label);
142 HasSectionLabel[Section] = true;
143 if (!Label->isInSection())
144 emitLabel(Label);
145 }
146}
147
148void MCMachOStreamer::emitEHSymAttributes(const MCSymbol *Symbol,
149 MCSymbol *EHSymbol) {
150 auto *Sym = static_cast<const MCSymbolMachO *>(Symbol);
151 getAssembler().registerSymbol(*Symbol);
152 if (Sym->isExternal())
153 emitSymbolAttribute(EHSymbol, MCSA_Global);
154 if (Sym->isWeakDefinition())
155 emitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
156 if (Sym->isPrivateExtern())
157 emitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
158}
159
160void MCMachOStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
161 // We have to create a new fragment if this is an atom defining symbol,
162 // fragments cannot span atoms.
163 if (static_cast<MCSymbolMachO *>(Symbol)->isSymbolLinkerVisible())
164 newFragment();
165
166 MCObjectStreamer::emitLabel(Symbol, Loc);
167
168 // This causes the reference type flag to be cleared. Darwin 'as' was "trying"
169 // to clear the weak reference and weak definition bits too, but the
170 // implementation was buggy. For now we just try to match 'as', for
171 // diffability.
172 //
173 // FIXME: Cleanup this code, these bits should be emitted based on semantic
174 // properties, not on the order of definition, etc.
175 static_cast<MCSymbolMachO *>(Symbol)->clearReferenceType();
176}
177
178void MCMachOStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
179 MCValue Res;
180
181 if (Value->evaluateAsRelocatable(Res, nullptr)) {
182 if (const auto *SymA = Res.getAddSym()) {
183 if (!Res.getSubSym() &&
184 (SymA->getName().empty() || Res.getConstant() != 0))
185 static_cast<MCSymbolMachO *>(Symbol)->setAltEntry();
186 }
187 }
189}
190
191void MCMachOStreamer::emitDataRegion(MachO::DataRegionType Kind) {
192 // Create a temporary label to mark the start of the data region.
193 MCSymbol *Start = getContext().createTempSymbol();
194 emitLabel(Start);
195 // Record the region for the object writer to use.
196 getWriter().getDataRegions().push_back({Kind, Start, nullptr});
197}
198
199void MCMachOStreamer::emitDataRegionEnd() {
200 auto &Regions = getWriter().getDataRegions();
201 assert(!Regions.empty() && "Mismatched .end_data_region!");
202 auto &Data = Regions.back();
203 assert(!Data.End && "Mismatched .end_data_region!");
204 // Create a temporary label to mark the end of the data region.
205 Data.End = getContext().createTempSymbol();
206 emitLabel(Data.End);
207}
208
209void MCMachOStreamer::emitSubsectionsViaSymbols() {
210 getWriter().setSubsectionsViaSymbols(true);
211}
212
213void MCMachOStreamer::emitLinkerOptions(ArrayRef<std::string> Options) {
214 getWriter().getLinkerOptions().push_back(Options);
215}
216
217void MCMachOStreamer::emitDataRegion(MCDataRegionType Kind) {
218 switch (Kind) {
219 case MCDR_DataRegion:
220 emitDataRegion(MachO::DataRegionType::DICE_KIND_DATA);
221 return;
223 emitDataRegion(MachO::DataRegionType::DICE_KIND_JUMP_TABLE8);
224 return;
226 emitDataRegion(MachO::DataRegionType::DICE_KIND_JUMP_TABLE16);
227 return;
229 emitDataRegion(MachO::DataRegionType::DICE_KIND_JUMP_TABLE32);
230 return;
232 emitDataRegionEnd();
233 return;
234 }
235}
236
237void MCMachOStreamer::emitVersionMin(MCVersionMinType Kind, unsigned Major,
238 unsigned Minor, unsigned Update,
239 VersionTuple SDKVersion) {
240 getWriter().setVersionMin(Kind, Major, Minor, Update, SDKVersion);
241}
242
243void MCMachOStreamer::emitBuildVersion(unsigned Platform, unsigned Major,
244 unsigned Minor, unsigned Update,
245 VersionTuple SDKVersion) {
246 getWriter().setBuildVersion((MachO::PlatformType)Platform, Major, Minor,
247 Update, SDKVersion);
248}
249
250void MCMachOStreamer::emitDarwinTargetVariantBuildVersion(
251 unsigned Platform, unsigned Major, unsigned Minor, unsigned Update,
252 VersionTuple SDKVersion) {
253 getWriter().setTargetVariantBuildVersion((MachO::PlatformType)Platform, Major,
254 Minor, Update, SDKVersion);
255}
256
257bool MCMachOStreamer::emitSymbolAttribute(MCSymbol *Sym,
259 auto *Symbol = static_cast<MCSymbolMachO *>(Sym);
260
261 // Indirect symbols are handled differently, to match how 'as' handles
262 // them. This makes writing matching .o files easier.
264 // Note that we intentionally cannot use the symbol data here; this is
265 // important for matching the string table that 'as' generates.
266 getWriter().getIndirectSymbols().push_back(
267 {Symbol, getCurrentSectionOnly()});
268 return true;
269 }
270
271 // Adding a symbol attribute always introduces the symbol, note that an
272 // important side effect of calling registerSymbol here is to register
273 // the symbol with the assembler.
274 getAssembler().registerSymbol(*Symbol);
275
276 // The implementation of symbol attributes is designed to match 'as', but it
277 // leaves much to desired. It doesn't really make sense to arbitrarily add and
278 // remove flags, but 'as' allows this (in particular, see .desc).
279 //
280 // In the future it might be worth trying to make these operations more well
281 // defined.
282 switch (Attribute) {
283 case MCSA_Invalid:
287 case MCSA_ELF_TypeTLS:
291 case MCSA_Extern:
292 case MCSA_Hidden:
294 case MCSA_Internal:
295 case MCSA_Protected:
296 case MCSA_Weak:
297 case MCSA_Local:
298 case MCSA_LGlobal:
299 case MCSA_Exported:
300 case MCSA_Memtag:
301 case MCSA_WeakAntiDep:
302 return false;
303
304 case MCSA_Global:
305 Symbol->setExternal(true);
306 // This effectively clears the undefined lazy bit, in Darwin 'as', although
307 // it isn't very consistent because it implements this as part of symbol
308 // lookup.
309 //
310 // FIXME: Cleanup this code, these bits should be emitted based on semantic
311 // properties, not on the order of definition, etc.
312 Symbol->setReferenceTypeUndefinedLazy(false);
313 break;
314
316 // FIXME: This requires -dynamic.
317 Symbol->setNoDeadStrip();
318 if (Symbol->isUndefined())
319 Symbol->setReferenceTypeUndefinedLazy(true);
320 break;
321
322 // Since .reference sets the no dead strip bit, it is equivalent to
323 // .no_dead_strip in practice.
324 case MCSA_Reference:
325 case MCSA_NoDeadStrip:
326 Symbol->setNoDeadStrip();
327 break;
328
330 Symbol->setSymbolResolver();
331 break;
332
333 case MCSA_AltEntry:
334 Symbol->setAltEntry();
335 break;
336
338 Symbol->setExternal(true);
339 Symbol->setPrivateExtern(true);
340 break;
341
343 // FIXME: This requires -dynamic.
344 if (Symbol->isUndefined())
345 Symbol->setWeakReference();
346 break;
347
349 // FIXME: 'as' enforces that this is defined and global. The manual claims
350 // it has to be in a coalesced section, but this isn't enforced.
351 Symbol->setWeakDefinition();
352 break;
353
355 Symbol->setWeakDefinition();
356 Symbol->setWeakReference();
357 break;
358
359 case MCSA_Cold:
360 Symbol->setCold();
361 break;
362 }
363
364 return true;
365}
366
367void MCMachOStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
368 // Encode the 'desc' value into the lowest implementation defined bits.
369 getAssembler().registerSymbol(*Symbol);
370 static_cast<MCSymbolMachO *>(Symbol)->setDesc(DescValue);
371}
372
373void MCMachOStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
374 Align ByteAlignment) {
375 auto &Sym = static_cast<MCSymbolMachO &>(*Symbol);
376 // FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
377 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
378
379 getAssembler().registerSymbol(Sym);
380 Sym.setExternal(true);
381 Sym.setCommon(Size, ByteAlignment);
382}
383
384void MCMachOStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
385 Align ByteAlignment) {
386 // '.lcomm' is equivalent to '.zerofill'.
387 return emitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
388 Symbol, Size, ByteAlignment);
389}
390
391void MCMachOStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
392 uint64_t Size, Align ByteAlignment,
393 SMLoc Loc) {
394 // On darwin all virtual sections have zerofill type. Disallow the usage of
395 // .zerofill in non-virtual functions. If something similar is needed, use
396 // .space or .zero.
397 if (!Section->isBssSection()) {
398 getContext().reportError(
399 Loc, "The usage of .zerofill is restricted to sections of "
400 "ZEROFILL type. Use .zero or .space instead.");
401 return; // Early returning here shouldn't harm. EmitZeros should work on any
402 // section.
403 }
404
405 pushSection();
406 switchSection(Section);
407
408 // The symbol may not be present, which only creates the section.
409 if (Symbol) {
410 emitValueToAlignment(ByteAlignment, 0, 1, 0);
411 emitLabel(Symbol);
412 emitZeros(Size);
413 }
414 popSection();
415}
416
417// This should always be called with the thread local bss section. Like the
418// .zerofill directive this doesn't actually switch sections on us.
419void MCMachOStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
420 uint64_t Size, Align ByteAlignment) {
421 emitZerofill(Section, Symbol, Size, ByteAlignment);
422}
423
424void MCMachOStreamer::finishImpl() {
425 emitFrames(&getAssembler().getBackend());
426
427 // We have to set the fragment atom associations so we can relax properly for
428 // Mach-O.
429
430 // First, scan the symbol table to build a lookup table from fragments to
431 // defining symbols.
433 for (const MCSymbol &Symbol : getAssembler().symbols()) {
434 auto &Sym = static_cast<const MCSymbolMachO &>(Symbol);
435 if (Sym.isSymbolLinkerVisible() && Sym.isInSection() && !Sym.isVariable() &&
436 !Sym.isAltEntry()) {
437 // An atom defining symbol should never be internal to a fragment.
438 assert(Symbol.getOffset() == 0 &&
439 "Invalid offset in atom defining symbol!");
440 DefiningSymbolMap[Symbol.getFragment()] = &Symbol;
441 }
442 }
443
444 // Set the fragment atom associations by tracking the last seen atom defining
445 // symbol.
446 for (MCSection &Sec : getAssembler()) {
447 static_cast<MCSectionMachO &>(Sec).allocAtoms();
448 const MCSymbol *CurrentAtom = nullptr;
449 size_t I = 0;
450 for (MCFragment &Frag : Sec) {
451 if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(&Frag))
452 CurrentAtom = Symbol;
453 static_cast<MCSectionMachO &>(Sec).setAtom(I++, CurrentAtom);
454 }
455 }
456
457 finalizeCGProfile();
458
459 createAddrSigSection();
461}
462
463void MCMachOStreamer::finalizeCGProfileEntry(const MCSymbolRefExpr *&SRE) {
464 auto *S =
465 static_cast<MCSymbolMachO *>(const_cast<MCSymbol *>(&SRE->getSymbol()));
466 if (getAssembler().registerSymbol(*S))
467 S->setExternal(true);
468}
469
470void MCMachOStreamer::finalizeCGProfile() {
471 MCAssembler &Asm = getAssembler();
472 MCObjectWriter &W = getWriter();
473 if (W.getCGProfile().empty())
474 return;
475 for (auto &E : W.getCGProfile()) {
476 finalizeCGProfileEntry(E.From);
477 finalizeCGProfileEntry(E.To);
478 }
479 // We can't write the section out until symbol indices are finalized which
480 // doesn't happen until after section layout. We need to create the section
481 // and set its size now so that it's accounted for in layout.
482 MCSection *CGProfileSection = Asm.getContext().getMachOSection(
483 "__LLVM", "__cg_profile", 0, SectionKind::getMetadata());
484 // Call the base class changeSection to omit the linker-local label.
485 MCObjectStreamer::changeSection(CGProfileSection);
486 // For each entry, reserve space for 2 32-bit indices and a 64-bit count.
487 size_t SectionBytes =
488 W.getCGProfile().size() * (2 * sizeof(uint32_t) + sizeof(uint64_t));
489 (*CGProfileSection->begin())
490 .setVarContents(std::vector<char>(SectionBytes, 0));
491}
492
494 std::unique_ptr<MCAsmBackend> &&MAB,
495 std::unique_ptr<MCObjectWriter> &&OW,
496 std::unique_ptr<MCCodeEmitter> &&CE,
497 bool DWARFMustBeAtTheEnd,
498 bool LabelSections) {
499 return new MCMachOStreamer(Context, std::move(MAB), std::move(OW),
500 std::move(CE), LabelSections);
501}
502
503// The AddrSig section uses a series of relocations to refer to the symbols that
504// should be considered address-significant. The only interesting content of
505// these relocations is their symbol; the type, length etc will be ignored by
506// the linker. The reason we are not referring to the symbol indices directly is
507// that those indices will be invalidated by tools that update the symbol table.
508// Symbol relocations OTOH will have their indices updated by e.g. llvm-strip.
509void MCMachOStreamer::createAddrSigSection() {
510 MCAssembler &Asm = getAssembler();
511 MCObjectWriter &writer = Asm.getWriter();
512 if (!writer.getEmitAddrsigSection())
513 return;
514 // Create the AddrSig section and first data fragment here as its layout needs
515 // to be computed immediately after in order for it to be exported correctly.
516 MCSection *AddrSigSection =
517 Asm.getContext().getObjectFileInfo()->getAddrSigSection();
518 // Call the base class changeSection to omit the linker-local label.
519 MCObjectStreamer::changeSection(AddrSigSection);
520 auto *Frag = cast<MCFragment>(AddrSigSection->curFragList()->Head);
521 // We will generate a series of pointer-sized symbol relocations at offset
522 // 0x0. Set the section size to be large enough to contain a single pointer
523 // (instead of emitting a zero-sized section) so these relocations are
524 // technically valid, even though we don't expect these relocations to
525 // actually be applied by the linker.
526 constexpr char zero[8] = {};
527 Frag->setVarContents(zero);
528}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
BlockVerifier::State From
dxil DXContainer Global Emitter
This file defines the DenseMap class.
static void zero(T &Obj)
Definition: ELFEmitter.cpp:340
uint64_t Size
Symbol * Sym
Definition: ELF_riscv.cpp:479
static LVOptions Options
Definition: LVOptions.cpp:25
#define I(x, y, z)
Definition: MD5.cpp:58
static bool isSymbolLinkerVisible(const MCSymbol &Symbol)
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: DenseMap.h:203
Context object for machine code objects.
Definition: MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:188
Streaming object file generation interface.
void reset() override
state management
void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol.
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void finishImpl() override
Streamer specific finalization.
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
Defines the object file and target independent interfaces used by the assembler backend to write nati...
This represents a section on a Mach-O system (used by Mac OS X).
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:496
FragList * curFragList() const
Definition: MCSection.h:603
iterator begin() const
Definition: MCSection.h:604
Streaming machine code generation interface.
Definition: MCStreamer.h:220
Generic base class for all target subtargets.
void setExternal(bool Value) const
Definition: MCSymbolMachO.h:50
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:190
const MCSymbol & getSymbol() const
Definition: MCExpr.h:227
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition: MCSymbol.h:205
const MCSymbol * getAddSym() const
Definition: MCValue.h:49
int64_t getConstant() const
Definition: MCValue.h:44
const MCSymbol * getSubSym() const
Definition: MCValue.h:51
Represents a location in source code.
Definition: SMLoc.h:23
static SectionKind getMetadata()
Definition: SectionKind.h:188
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:47
LLVM Value Representation.
Definition: Value.h:75
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:30
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PlatformType
Definition: MachO.h:500
DataRegionType
Definition: MachO.h:225
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCDataRegionType
Definition: MCDirectives.h:53
@ MCDR_DataRegionEnd
.end_data_region
Definition: MCDirectives.h:58
@ MCDR_DataRegion
.data_region
Definition: MCDirectives.h:54
@ MCDR_DataRegionJT8
.data_region jt8
Definition: MCDirectives.h:55
@ MCDR_DataRegionJT32
.data_region jt32
Definition: MCDirectives.h:57
@ MCDR_DataRegionJT16
.data_region jt16
Definition: MCDirectives.h:56
LLVM_ABI MCStreamer * createMachOStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool DWARFMustBeAtTheEnd, bool LabelSections=false)
MCVersionMinType
Definition: MCDirectives.h:61
MCLOHType
Linker Optimization Hint Type.
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:1886
MCSymbolAttr
Definition: MCDirectives.h:18
@ MCSA_Local
.local (ELF)
Definition: MCDirectives.h:38
@ MCSA_WeakDefAutoPrivate
.weak_def_can_be_hidden (MachO)
Definition: MCDirectives.h:48
@ MCSA_Memtag
.memtag (ELF)
Definition: MCDirectives.h:50
@ MCSA_Protected
.protected (ELF)
Definition: MCDirectives.h:43
@ MCSA_Exported
.globl _foo, exported (XCOFF)
Definition: MCDirectives.h:34
@ MCSA_PrivateExtern
.private_extern (MachO)
Definition: MCDirectives.h:42
@ MCSA_Internal
.internal (ELF)
Definition: MCDirectives.h:36
@ MCSA_WeakReference
.weak_reference (MachO)
Definition: MCDirectives.h:47
@ MCSA_AltEntry
.alt_entry (MachO)
Definition: MCDirectives.h:41
@ MCSA_ELF_TypeIndFunction
.type _foo, STT_GNU_IFUNC
Definition: MCDirectives.h:24
@ MCSA_LazyReference
.lazy_reference (MachO)
Definition: MCDirectives.h:37
@ MCSA_ELF_TypeNoType
.type _foo, STT_NOTYPE # aka @notype
Definition: MCDirectives.h:28
@ MCSA_Reference
.reference (MachO)
Definition: MCDirectives.h:44
@ MCSA_SymbolResolver
.symbol_resolver (MachO)
Definition: MCDirectives.h:40
@ MCSA_Weak
.weak
Definition: MCDirectives.h:45
@ MCSA_ELF_TypeTLS
.type _foo, STT_TLS # aka @tls_object
Definition: MCDirectives.h:26
@ MCSA_IndirectSymbol
.indirect_symbol (MachO)
Definition: MCDirectives.h:35
@ MCSA_WeakDefinition
.weak_definition (MachO)
Definition: MCDirectives.h:46
@ MCSA_ELF_TypeCommon
.type _foo, STT_COMMON # aka @common
Definition: MCDirectives.h:27
@ MCSA_Global
.type _foo, @gnu_unique_object
Definition: MCDirectives.h:30
@ MCSA_WeakAntiDep
.weak_anti_dep (COFF)
Definition: MCDirectives.h:49
@ MCSA_Extern
.extern (XCOFF)
Definition: MCDirectives.h:32
@ MCSA_Cold
.cold (MachO)
Definition: MCDirectives.h:22
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
Definition: MCDirectives.h:25
@ MCSA_ELF_TypeGnuUniqueObject
Definition: MCDirectives.h:29
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
Definition: MCDirectives.h:23
@ MCSA_Hidden
.hidden (ELF)
Definition: MCDirectives.h:33
@ MCSA_LGlobal
.lglobl (XCOFF)
Definition: MCDirectives.h:31
@ MCSA_Invalid
Not a valid directive.
Definition: MCDirectives.h:19
@ MCSA_NoDeadStrip
.no_dead_strip (MachO)
Definition: MCDirectives.h:39
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39