LLVM  12.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"
10 #include "llvm/ADT/SmallString.h"
11 #include "llvm/ADT/SmallVector.h"
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/ADT/Triple.h"
14 #include "llvm/MC/MCAsmBackend.h"
15 #include "llvm/MC/MCAssembler.h"
16 #include "llvm/MC/MCCodeEmitter.h"
17 #include "llvm/MC/MCContext.h"
18 #include "llvm/MC/MCDirectives.h"
19 #include "llvm/MC/MCExpr.h"
20 #include "llvm/MC/MCFixup.h"
21 #include "llvm/MC/MCFragment.h"
22 #include "llvm/MC/MCInst.h"
26 #include "llvm/MC/MCObjectWriter.h"
27 #include "llvm/MC/MCSection.h"
28 #include "llvm/MC/MCSectionMachO.h"
29 #include "llvm/MC/MCStreamer.h"
30 #include "llvm/MC/MCSymbol.h"
31 #include "llvm/MC/MCSymbolMachO.h"
32 #include "llvm/MC/MCValue.h"
33 #include "llvm/Support/Casting.h"
37 #include <cassert>
38 #include <vector>
39 
40 using namespace llvm;
41 
42 namespace {
43 
44 class MCMachOStreamer : public MCObjectStreamer {
45 private:
46  /// LabelSections - true if each section change should emit a linker local
47  /// label for use in relocations for assembler local references. Obviates the
48  /// need for local relocations. False by default.
49  bool LabelSections;
50 
51  bool DWARFMustBeAtTheEnd;
52  bool CreatedADWARFSection;
53 
54  /// HasSectionLabel - map of which sections have already had a non-local
55  /// label emitted to them. Used so we don't emit extraneous linker local
56  /// labels in the middle of the section.
57  DenseMap<const MCSection*, bool> HasSectionLabel;
58 
59  void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
60 
61  void emitDataRegion(DataRegionData::KindTy Kind);
62  void emitDataRegionEnd();
63 
64 public:
65  MCMachOStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
66  std::unique_ptr<MCObjectWriter> OW,
67  std::unique_ptr<MCCodeEmitter> Emitter,
68  bool DWARFMustBeAtTheEnd, bool label)
69  : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
70  std::move(Emitter)),
71  LabelSections(label), DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd),
72  CreatedADWARFSection(false) {}
73 
74  /// state management
75  void reset() override {
76  CreatedADWARFSection = false;
77  HasSectionLabel.clear();
79  }
80 
81  /// @name MCStreamer Interface
82  /// @{
83 
84  void changeSection(MCSection *Sect, const MCExpr *Subsect) 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 emitAssemblerFlag(MCAssemblerFlag Flag) 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 emitThumbFunc(MCSymbol *Func) override;
96  bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
97  void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
98  void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
99  unsigned ByteAlignment) override;
100 
101  void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
102  unsigned ByteAlignment) override;
103  void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
104  uint64_t Size = 0, unsigned ByteAlignment = 0,
105  SMLoc Loc = SMLoc()) override;
106  void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
107  unsigned ByteAlignment = 0) override;
108 
109  void emitIdent(StringRef IdentString) override {
110  llvm_unreachable("macho doesn't support this directive");
111  }
112 
113  void emitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override {
114  getAssembler().getLOHContainer().addDirective(Kind, Args);
115  }
116 
117  void finishImpl() override;
118 };
119 
120 } // end anonymous namespace.
121 
122 static bool canGoAfterDWARF(const MCSectionMachO &MSec) {
123  // These sections are created by the assembler itself after the end of
124  // the .s file.
125  StringRef SegName = MSec.getSegmentName();
126  StringRef SecName = MSec.getName();
127 
128  if (SegName == "__LD" && SecName == "__compact_unwind")
129  return true;
130 
131  if (SegName == "__IMPORT") {
132  if (SecName == "__jump_table")
133  return true;
134 
135  if (SecName == "__pointers")
136  return true;
137  }
138 
139  if (SegName == "__TEXT" && SecName == "__eh_frame")
140  return true;
141 
142  if (SegName == "__DATA" && (SecName == "__nl_symbol_ptr" ||
143  SecName == "__thread_ptr"))
144  return true;
145 
146  return false;
147 }
148 
149 void MCMachOStreamer::changeSection(MCSection *Section,
150  const MCExpr *Subsection) {
151  // Change the section normally.
152  bool Created = changeSectionImpl(Section, Subsection);
153  const MCSectionMachO &MSec = *cast<MCSectionMachO>(Section);
154  StringRef SegName = MSec.getSegmentName();
155  if (SegName == "__DWARF")
156  CreatedADWARFSection = true;
157  else if (Created && DWARFMustBeAtTheEnd && !canGoAfterDWARF(MSec))
158  assert((!CreatedADWARFSection ||
159  Section == getContext().getObjectFileInfo()->getStackMapSection())
160  && "Creating regular section after DWARF");
161 
162  // Output a linker-local symbol so we don't need section-relative local
163  // relocations. The linker hates us when we do that.
164  if (LabelSections && !HasSectionLabel[Section] &&
165  !Section->getBeginSymbol()) {
166  MCSymbol *Label = getContext().createLinkerPrivateTempSymbol();
167  Section->setBeginSymbol(Label);
168  HasSectionLabel[Section] = true;
169  }
170 }
171 
172 void MCMachOStreamer::emitEHSymAttributes(const MCSymbol *Symbol,
173  MCSymbol *EHSymbol) {
174  getAssembler().registerSymbol(*Symbol);
175  if (Symbol->isExternal())
176  emitSymbolAttribute(EHSymbol, MCSA_Global);
177  if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition())
178  emitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
179  if (Symbol->isPrivateExtern())
180  emitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
181 }
182 
183 void MCMachOStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
184  // We have to create a new fragment if this is an atom defining symbol,
185  // fragments cannot span atoms.
186  if (getAssembler().isSymbolLinkerVisible(*Symbol))
187  insert(new MCDataFragment());
188 
189  MCObjectStreamer::emitLabel(Symbol, Loc);
190 
191  // This causes the reference type flag to be cleared. Darwin 'as' was "trying"
192  // to clear the weak reference and weak definition bits too, but the
193  // implementation was buggy. For now we just try to match 'as', for
194  // diffability.
195  //
196  // FIXME: Cleanup this code, these bits should be emitted based on semantic
197  // properties, not on the order of definition, etc.
198  cast<MCSymbolMachO>(Symbol)->clearReferenceType();
199 }
200 
201 void MCMachOStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
202  MCValue Res;
203 
204  if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) {
205  if (const MCSymbolRefExpr *SymAExpr = Res.getSymA()) {
206  const MCSymbol &SymA = SymAExpr->getSymbol();
207  if (!Res.getSymB() && (SymA.getName() == "" || Res.getConstant() != 0))
208  cast<MCSymbolMachO>(Symbol)->setAltEntry();
209  }
210  }
211  MCObjectStreamer::emitAssignment(Symbol, Value);
212 }
213 
214 void MCMachOStreamer::emitDataRegion(DataRegionData::KindTy Kind) {
215  // Create a temporary label to mark the start of the data region.
216  MCSymbol *Start = getContext().createTempSymbol();
217  emitLabel(Start);
218  // Record the region for the object writer to use.
219  DataRegionData Data = { Kind, Start, nullptr };
220  std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
221  Regions.push_back(Data);
222 }
223 
224 void MCMachOStreamer::emitDataRegionEnd() {
225  std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
226  assert(!Regions.empty() && "Mismatched .end_data_region!");
227  DataRegionData &Data = Regions.back();
228  assert(!Data.End && "Mismatched .end_data_region!");
229  // Create a temporary label to mark the end of the data region.
230  Data.End = getContext().createTempSymbol();
231  emitLabel(Data.End);
232 }
233 
234 void MCMachOStreamer::emitAssemblerFlag(MCAssemblerFlag Flag) {
235  // Let the target do whatever target specific stuff it needs to do.
236  getAssembler().getBackend().handleAssemblerFlag(Flag);
237  // Do any generic stuff we need to do.
238  switch (Flag) {
239  case MCAF_SyntaxUnified: return; // no-op here.
240  case MCAF_Code16: return; // Change parsing mode; no-op here.
241  case MCAF_Code32: return; // Change parsing mode; no-op here.
242  case MCAF_Code64: return; // Change parsing mode; no-op here.
244  getAssembler().setSubsectionsViaSymbols(true);
245  return;
246  }
247 }
248 
249 void MCMachOStreamer::emitLinkerOptions(ArrayRef<std::string> Options) {
250  getAssembler().getLinkerOptions().push_back(Options);
251 }
252 
253 void MCMachOStreamer::emitDataRegion(MCDataRegionType Kind) {
254  switch (Kind) {
255  case MCDR_DataRegion:
256  emitDataRegion(DataRegionData::Data);
257  return;
258  case MCDR_DataRegionJT8:
259  emitDataRegion(DataRegionData::JumpTable8);
260  return;
261  case MCDR_DataRegionJT16:
262  emitDataRegion(DataRegionData::JumpTable16);
263  return;
264  case MCDR_DataRegionJT32:
265  emitDataRegion(DataRegionData::JumpTable32);
266  return;
267  case MCDR_DataRegionEnd:
268  emitDataRegionEnd();
269  return;
270  }
271 }
272 
273 void MCMachOStreamer::emitVersionMin(MCVersionMinType Kind, unsigned Major,
274  unsigned Minor, unsigned Update,
275  VersionTuple SDKVersion) {
276  getAssembler().setVersionMin(Kind, Major, Minor, Update, SDKVersion);
277 }
278 
279 void MCMachOStreamer::emitBuildVersion(unsigned Platform, unsigned Major,
280  unsigned Minor, unsigned Update,
281  VersionTuple SDKVersion) {
282  getAssembler().setBuildVersion((MachO::PlatformType)Platform, Major, Minor,
283  Update, SDKVersion);
284 }
285 
286 void MCMachOStreamer::emitThumbFunc(MCSymbol *Symbol) {
287  // Remember that the function is a thumb function. Fixup and relocation
288  // values will need adjusted.
289  getAssembler().setIsThumbFunc(Symbol);
290  cast<MCSymbolMachO>(Symbol)->setThumbFunc();
291 }
292 
293 bool MCMachOStreamer::emitSymbolAttribute(MCSymbol *Sym,
295  MCSymbolMachO *Symbol = cast<MCSymbolMachO>(Sym);
296 
297  // Indirect symbols are handled differently, to match how 'as' handles
298  // them. This makes writing matching .o files easier.
299  if (Attribute == MCSA_IndirectSymbol) {
300  // Note that we intentionally cannot use the symbol data here; this is
301  // important for matching the string table that 'as' generates.
302  IndirectSymbolData ISD;
303  ISD.Symbol = Symbol;
304  ISD.Section = getCurrentSectionOnly();
305  getAssembler().getIndirectSymbols().push_back(ISD);
306  return true;
307  }
308 
309  // Adding a symbol attribute always introduces the symbol, note that an
310  // important side effect of calling registerSymbol here is to register
311  // the symbol with the assembler.
312  getAssembler().registerSymbol(*Symbol);
313 
314  // The implementation of symbol attributes is designed to match 'as', but it
315  // leaves much to desired. It doesn't really make sense to arbitrarily add and
316  // remove flags, but 'as' allows this (in particular, see .desc).
317  //
318  // In the future it might be worth trying to make these operations more well
319  // defined.
320  switch (Attribute) {
321  case MCSA_Invalid:
324  case MCSA_ELF_TypeObject:
325  case MCSA_ELF_TypeTLS:
326  case MCSA_ELF_TypeCommon:
327  case MCSA_ELF_TypeNoType:
329  case MCSA_Extern:
330  case MCSA_Hidden:
331  case MCSA_IndirectSymbol:
332  case MCSA_Internal:
333  case MCSA_Protected:
334  case MCSA_Weak:
335  case MCSA_Local:
336  case MCSA_LGlobal:
337  return false;
338 
339  case MCSA_Global:
340  Symbol->setExternal(true);
341  // This effectively clears the undefined lazy bit, in Darwin 'as', although
342  // it isn't very consistent because it implements this as part of symbol
343  // lookup.
344  //
345  // FIXME: Cleanup this code, these bits should be emitted based on semantic
346  // properties, not on the order of definition, etc.
347  Symbol->setReferenceTypeUndefinedLazy(false);
348  break;
349 
350  case MCSA_LazyReference:
351  // FIXME: This requires -dynamic.
352  Symbol->setNoDeadStrip();
353  if (Symbol->isUndefined())
354  Symbol->setReferenceTypeUndefinedLazy(true);
355  break;
356 
357  // Since .reference sets the no dead strip bit, it is equivalent to
358  // .no_dead_strip in practice.
359  case MCSA_Reference:
360  case MCSA_NoDeadStrip:
361  Symbol->setNoDeadStrip();
362  break;
363 
364  case MCSA_SymbolResolver:
365  Symbol->setSymbolResolver();
366  break;
367 
368  case MCSA_AltEntry:
369  Symbol->setAltEntry();
370  break;
371 
372  case MCSA_PrivateExtern:
373  Symbol->setExternal(true);
374  Symbol->setPrivateExtern(true);
375  break;
376 
377  case MCSA_WeakReference:
378  // FIXME: This requires -dynamic.
379  if (Symbol->isUndefined())
380  Symbol->setWeakReference();
381  break;
382 
383  case MCSA_WeakDefinition:
384  // FIXME: 'as' enforces that this is defined and global. The manual claims
385  // it has to be in a coalesced section, but this isn't enforced.
386  Symbol->setWeakDefinition();
387  break;
388 
390  Symbol->setWeakDefinition();
391  Symbol->setWeakReference();
392  break;
393 
394  case MCSA_Cold:
395  Symbol->setCold();
396  break;
397  }
398 
399  return true;
400 }
401 
402 void MCMachOStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
403  // Encode the 'desc' value into the lowest implementation defined bits.
404  getAssembler().registerSymbol(*Symbol);
405  cast<MCSymbolMachO>(Symbol)->setDesc(DescValue);
406 }
407 
408 void MCMachOStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
409  unsigned ByteAlignment) {
410  // FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
411  assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
412 
413  getAssembler().registerSymbol(*Symbol);
414  Symbol->setExternal(true);
415  Symbol->setCommon(Size, ByteAlignment);
416 }
417 
418 void MCMachOStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
419  unsigned ByteAlignment) {
420  // '.lcomm' is equivalent to '.zerofill'.
421  return emitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
422  Symbol, Size, ByteAlignment);
423 }
424 
425 void MCMachOStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
426  uint64_t Size, unsigned ByteAlignment,
427  SMLoc Loc) {
428  // On darwin all virtual sections have zerofill type. Disallow the usage of
429  // .zerofill in non-virtual functions. If something similar is needed, use
430  // .space or .zero.
431  if (!Section->isVirtualSection()) {
432  getContext().reportError(
433  Loc, "The usage of .zerofill is restricted to sections of "
434  "ZEROFILL type. Use .zero or .space instead.");
435  return; // Early returning here shouldn't harm. EmitZeros should work on any
436  // section.
437  }
438 
439  PushSection();
440  SwitchSection(Section);
441 
442  // The symbol may not be present, which only creates the section.
443  if (Symbol) {
444  emitValueToAlignment(ByteAlignment, 0, 1, 0);
445  emitLabel(Symbol);
446  emitZeros(Size);
447  }
448  PopSection();
449 }
450 
451 // This should always be called with the thread local bss section. Like the
452 // .zerofill directive this doesn't actually switch sections on us.
453 void MCMachOStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
454  uint64_t Size, unsigned ByteAlignment) {
455  emitZerofill(Section, Symbol, Size, ByteAlignment);
456 }
457 
458 void MCMachOStreamer::emitInstToData(const MCInst &Inst,
459  const MCSubtargetInfo &STI) {
460  MCDataFragment *DF = getOrCreateDataFragment();
461 
463  SmallString<256> Code;
464  raw_svector_ostream VecOS(Code);
465  getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
466 
467  // Add the fixups and data.
468  for (MCFixup &Fixup : Fixups) {
469  Fixup.setOffset(Fixup.getOffset() + DF->getContents().size());
470  DF->getFixups().push_back(Fixup);
471  }
472  DF->setHasInstructions(STI);
473  DF->getContents().append(Code.begin(), Code.end());
474 }
475 
476 void MCMachOStreamer::finishImpl() {
477  emitFrames(&getAssembler().getBackend());
478 
479  // We have to set the fragment atom associations so we can relax properly for
480  // Mach-O.
481 
482  // First, scan the symbol table to build a lookup table from fragments to
483  // defining symbols.
485  for (const MCSymbol &Symbol : getAssembler().symbols()) {
486  if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() &&
487  !Symbol.isVariable()) {
488  // An atom defining symbol should never be internal to a fragment.
489  assert(Symbol.getOffset() == 0 &&
490  "Invalid offset in atom defining symbol!");
491  DefiningSymbolMap[Symbol.getFragment()] = &Symbol;
492  }
493  }
494 
495  // Set the fragment atom associations by tracking the last seen atom defining
496  // symbol.
497  for (MCSection &Sec : getAssembler()) {
498  const MCSymbol *CurrentAtom = nullptr;
499  for (MCFragment &Frag : Sec) {
500  if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(&Frag))
501  CurrentAtom = Symbol;
502  Frag.setAtom(CurrentAtom);
503  }
504  }
505 
507 }
508 
510  std::unique_ptr<MCAsmBackend> &&MAB,
511  std::unique_ptr<MCObjectWriter> &&OW,
512  std::unique_ptr<MCCodeEmitter> &&CE,
513  bool RelaxAll, bool DWARFMustBeAtTheEnd,
514  bool LabelSections) {
515  MCMachOStreamer *S =
516  new MCMachOStreamer(Context, std::move(MAB), std::move(OW), std::move(CE),
517  DWARFMustBeAtTheEnd, LabelSections);
518  const Triple &Target = Context.getObjectFileInfo()->getTargetTriple();
519  S->emitVersionForTarget(Target, Context.getObjectFileInfo()->getSDKVersion());
520  if (RelaxAll)
521  S->getAssembler().setRelaxAll(true);
522  return S;
523 }
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
void setPrivateExtern(bool Value)
Definition: MCSymbol.h:401
void setReferenceTypeUndefinedLazy(bool Value) const
Definition: MCSymbolMachO.h:54
This represents a section on a Mach-O system (used by Mac OS X).
LLVMContext & Context
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool isVariable() const
isVariable - Check if this is a variable symbol.
Definition: MCSymbol.h:289
void setCommon(uint64_t Size, unsigned Align, bool Target=false)
Mark this symbol as being &#39;common&#39;.
Definition: MCSymbol.h:341
.type _foo, STT_OBJECT # aka
Definition: MCDirectives.h:25
This represents an "assembler immediate".
Definition: MCValue.h:37
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Not a valid directive.
Definition: MCDirectives.h:19
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:550
void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol.
MCDataRegionType
Definition: MCDirectives.h:58
.type _foo, STT_NOTYPE # aka
Definition: MCDirectives.h:28
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:82
.cold (MachO)
Definition: MCDirectives.h:22
int64_t getConstant() const
Definition: MCValue.h:44
const MCSymbolRefExpr * getSymB() const
Definition: MCValue.h:46
Definition: BitVector.h:959
void setExternal(bool Value) const
Definition: MCSymbol.h:398
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
Definition: MCSymbol.h:245
.data_region jt16
Definition: MCDirectives.h:61
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
.local (ELF)
Definition: MCDirectives.h:37
.no_dead_strip (MachO)
Definition: MCDirectives.h:38
PlatformType
Definition: MachO.h:489
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Context object for machine code objects.
Definition: MCContext.h:67
void setSymbolResolver() const
Definition: MCSymbolMachO.h:89
.lglobl (XCOFF)
Definition: MCDirectives.h:31
.code16 (X86) / .code 16 (ARM)
Definition: MCDirectives.h:53
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Definition: MCExpr.cpp:727
Streaming object file generation interface.
.extern (XCOFF)
Definition: MCDirectives.h:32
.type _foo, STT_GNU_IFUNC
Definition: MCDirectives.h:24
.alt_entry (MachO)
Definition: MCDirectives.h:40
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
.protected (ELF)
Definition: MCDirectives.h:42
.lazy_reference (MachO)
Definition: MCDirectives.h:36
SmallVectorImpl< char > & getContents()
Definition: MCFragment.h:187
.reference (MachO)
Definition: MCDirectives.h:43
StringRef getSegmentName() const
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:138
.hidden (ELF)
Definition: MCDirectives.h:33
.data_region jt32
Definition: MCDirectives.h:62
void setCold() const
Streaming machine code generation interface.
Definition: MCStreamer.h:196
void setWeakDefinition() const
Definition: MCSymbolMachO.h:82
.weak_def_can_be_hidden (MachO)
Definition: MCDirectives.h:47
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
Definition: MCFragment.h:167
SmallVectorImpl< MCFixup > & getFixups()
Definition: MCFragment.h:213
StringRef getName() const
Definition: MCSection.h:115
MCLOHType
Linker Optimization Hint Type.
const MCSymbolRefExpr * getSymA() const
Definition: MCValue.h:45
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:367
.subsections_via_symbols (MachO)
Definition: MCDirectives.h:52
uint64_t getOffset() const
Definition: MCSymbol.h:316
.weak_reference (MachO)
Definition: MCDirectives.h:46
bool isExternal() const
Definition: MCSymbol.h:397
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
static bool canGoAfterDWARF(const MCSectionMachO &MSec)
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
PowerPC TLS Dynamic Call Fixup
virtual bool isVirtualSection() const =0
Check whether this section is "virtual", that is has no actual object file contents.
void setAltEntry() const
Definition: MCSymbolMachO.h:93
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
Definition: MCSymbol.h:250
MCFragment * getFragment(bool SetUsed=true) const
Definition: MCSymbol.h:388
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:883
.indirect_symbol (MachO)
Definition: MCDirectives.h:34
.type _foo, STT_TLS # aka
Definition: MCDirectives.h:26
MCSymbol * getBeginSymbol()
Definition: MCSection.h:120
const Triple & getTargetTriple() const
MCSymbolAttr
Definition: MCDirectives.h:18
Target - Wrapper for Target specific information.
.syntax (ARM/ELF)
Definition: MCDirectives.h:51
.internal (ELF)
Definition: MCDirectives.h:35
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:433
.code32 (X86) / .code 32 (ARM)
Definition: MCDirectives.h:54
.type _foo, STT_COMMON # aka
Definition: MCDirectives.h:27
.code64 (X86)
Definition: MCDirectives.h:55
.symbol_resolver (MachO)
Definition: MCDirectives.h:39
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:27
.type _foo,
Definition: MCDirectives.h:30
MCAssemblerFlag
Definition: MCDirectives.h:50
const VersionTuple & getSDKVersion() const
.type _foo, STT_FUNC # aka
Definition: MCDirectives.h:23
void reset() override
state management
Generic base class for all target subtargets.
void finishImpl() override
Streamer specific finalization.
uint32_t Size
Definition: Profile.cpp:46
void setNoDeadStrip() const
Definition: MCSymbolMachO.h:68
.weak_definition (MachO)
Definition: MCDirectives.h:45
size_t size() const
Definition: SmallVector.h:66
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:197
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:196
Fragment for data and encoded instructions.
Definition: MCFragment.h:232
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
.private_extern (MachO)
Definition: MCDirectives.h:41
.data_region jt8
Definition: MCDirectives.h:60
MCVersionMinType
Definition: MCDirectives.h:66
LLVM Value Representation.
Definition: Value.h:74
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
MCStreamer * createMachOStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE, bool RelaxAll, bool DWARFMustBeAtTheEnd, bool LabelSections=false)
Represents a location in source code.
Definition: SMLoc.h:23
void setWeakReference() const
Definition: MCSymbolMachO.h:75
bool isPrivateExtern() const
Definition: MCSymbol.h:400
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
.end_data_region
Definition: MCDirectives.h:63
void setBeginSymbol(MCSymbol *Sym)
Definition: MCSection.h:124