LLVM  10.0.0svn
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.getSectionName();
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 && "Creating regular section after DWARF");
159 
160  // Output a linker-local symbol so we don't need section-relative local
161  // relocations. The linker hates us when we do that.
162  if (LabelSections && !HasSectionLabel[Section] &&
163  !Section->getBeginSymbol()) {
164  MCSymbol *Label = getContext().createLinkerPrivateTempSymbol();
165  Section->setBeginSymbol(Label);
166  HasSectionLabel[Section] = true;
167  }
168 }
169 
170 void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
171  MCSymbol *EHSymbol) {
172  getAssembler().registerSymbol(*Symbol);
173  if (Symbol->isExternal())
174  EmitSymbolAttribute(EHSymbol, MCSA_Global);
175  if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition())
176  EmitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
177  if (Symbol->isPrivateExtern())
178  EmitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
179 }
180 
181 void MCMachOStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
182  // We have to create a new fragment if this is an atom defining symbol,
183  // fragments cannot span atoms.
184  if (getAssembler().isSymbolLinkerVisible(*Symbol))
185  insert(new MCDataFragment());
186 
187  MCObjectStreamer::EmitLabel(Symbol, Loc);
188 
189  // This causes the reference type flag to be cleared. Darwin 'as' was "trying"
190  // to clear the weak reference and weak definition bits too, but the
191  // implementation was buggy. For now we just try to match 'as', for
192  // diffability.
193  //
194  // FIXME: Cleanup this code, these bits should be emitted based on semantic
195  // properties, not on the order of definition, etc.
196  cast<MCSymbolMachO>(Symbol)->clearReferenceType();
197 }
198 
199 void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
200  MCValue Res;
201 
202  if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) {
203  if (const MCSymbolRefExpr *SymAExpr = Res.getSymA()) {
204  const MCSymbol &SymA = SymAExpr->getSymbol();
205  if (!Res.getSymB() && (SymA.getName() == "" || Res.getConstant() != 0))
206  cast<MCSymbolMachO>(Symbol)->setAltEntry();
207  }
208  }
209  MCObjectStreamer::EmitAssignment(Symbol, Value);
210 }
211 
212 void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
213  // Create a temporary label to mark the start of the data region.
214  MCSymbol *Start = getContext().createTempSymbol();
215  EmitLabel(Start);
216  // Record the region for the object writer to use.
217  DataRegionData Data = { Kind, Start, nullptr };
218  std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
219  Regions.push_back(Data);
220 }
221 
222 void MCMachOStreamer::EmitDataRegionEnd() {
223  std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
224  assert(!Regions.empty() && "Mismatched .end_data_region!");
225  DataRegionData &Data = Regions.back();
226  assert(!Data.End && "Mismatched .end_data_region!");
227  // Create a temporary label to mark the end of the data region.
228  Data.End = getContext().createTempSymbol();
229  EmitLabel(Data.End);
230 }
231 
232 void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
233  // Let the target do whatever target specific stuff it needs to do.
234  getAssembler().getBackend().handleAssemblerFlag(Flag);
235  // Do any generic stuff we need to do.
236  switch (Flag) {
237  case MCAF_SyntaxUnified: return; // no-op here.
238  case MCAF_Code16: return; // Change parsing mode; no-op here.
239  case MCAF_Code32: return; // Change parsing mode; no-op here.
240  case MCAF_Code64: return; // Change parsing mode; no-op here.
242  getAssembler().setSubsectionsViaSymbols(true);
243  return;
244  }
245 }
246 
247 void MCMachOStreamer::EmitLinkerOptions(ArrayRef<std::string> Options) {
248  getAssembler().getLinkerOptions().push_back(Options);
249 }
250 
251 void MCMachOStreamer::EmitDataRegion(MCDataRegionType Kind) {
252  switch (Kind) {
253  case MCDR_DataRegion:
254  EmitDataRegion(DataRegionData::Data);
255  return;
256  case MCDR_DataRegionJT8:
257  EmitDataRegion(DataRegionData::JumpTable8);
258  return;
259  case MCDR_DataRegionJT16:
260  EmitDataRegion(DataRegionData::JumpTable16);
261  return;
262  case MCDR_DataRegionJT32:
263  EmitDataRegion(DataRegionData::JumpTable32);
264  return;
265  case MCDR_DataRegionEnd:
266  EmitDataRegionEnd();
267  return;
268  }
269 }
270 
271 void MCMachOStreamer::EmitVersionMin(MCVersionMinType Kind, unsigned Major,
272  unsigned Minor, unsigned Update,
273  VersionTuple SDKVersion) {
274  getAssembler().setVersionMin(Kind, Major, Minor, Update, SDKVersion);
275 }
276 
277 void MCMachOStreamer::EmitBuildVersion(unsigned Platform, unsigned Major,
278  unsigned Minor, unsigned Update,
279  VersionTuple SDKVersion) {
280  getAssembler().setBuildVersion((MachO::PlatformType)Platform, Major, Minor,
281  Update, SDKVersion);
282 }
283 
284 void MCMachOStreamer::EmitThumbFunc(MCSymbol *Symbol) {
285  // Remember that the function is a thumb function. Fixup and relocation
286  // values will need adjusted.
287  getAssembler().setIsThumbFunc(Symbol);
288  cast<MCSymbolMachO>(Symbol)->setThumbFunc();
289 }
290 
291 bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Sym,
293  MCSymbolMachO *Symbol = cast<MCSymbolMachO>(Sym);
294 
295  // Indirect symbols are handled differently, to match how 'as' handles
296  // them. This makes writing matching .o files easier.
297  if (Attribute == MCSA_IndirectSymbol) {
298  // Note that we intentionally cannot use the symbol data here; this is
299  // important for matching the string table that 'as' generates.
300  IndirectSymbolData ISD;
301  ISD.Symbol = Symbol;
302  ISD.Section = getCurrentSectionOnly();
303  getAssembler().getIndirectSymbols().push_back(ISD);
304  return true;
305  }
306 
307  // Adding a symbol attribute always introduces the symbol, note that an
308  // important side effect of calling registerSymbol here is to register
309  // the symbol with the assembler.
310  getAssembler().registerSymbol(*Symbol);
311 
312  // The implementation of symbol attributes is designed to match 'as', but it
313  // leaves much to desired. It doesn't really make sense to arbitrarily add and
314  // remove flags, but 'as' allows this (in particular, see .desc).
315  //
316  // In the future it might be worth trying to make these operations more well
317  // defined.
318  switch (Attribute) {
319  case MCSA_Invalid:
322  case MCSA_ELF_TypeObject:
323  case MCSA_ELF_TypeTLS:
324  case MCSA_ELF_TypeCommon:
325  case MCSA_ELF_TypeNoType:
327  case MCSA_Hidden:
328  case MCSA_IndirectSymbol:
329  case MCSA_Internal:
330  case MCSA_Protected:
331  case MCSA_Weak:
332  case MCSA_Local:
333  return false;
334 
335  case MCSA_Global:
336  Symbol->setExternal(true);
337  // This effectively clears the undefined lazy bit, in Darwin 'as', although
338  // it isn't very consistent because it implements this as part of symbol
339  // lookup.
340  //
341  // FIXME: Cleanup this code, these bits should be emitted based on semantic
342  // properties, not on the order of definition, etc.
343  Symbol->setReferenceTypeUndefinedLazy(false);
344  break;
345 
346  case MCSA_LazyReference:
347  // FIXME: This requires -dynamic.
348  Symbol->setNoDeadStrip();
349  if (Symbol->isUndefined())
350  Symbol->setReferenceTypeUndefinedLazy(true);
351  break;
352 
353  // Since .reference sets the no dead strip bit, it is equivalent to
354  // .no_dead_strip in practice.
355  case MCSA_Reference:
356  case MCSA_NoDeadStrip:
357  Symbol->setNoDeadStrip();
358  break;
359 
360  case MCSA_SymbolResolver:
361  Symbol->setSymbolResolver();
362  break;
363 
364  case MCSA_AltEntry:
365  Symbol->setAltEntry();
366  break;
367 
368  case MCSA_PrivateExtern:
369  Symbol->setExternal(true);
370  Symbol->setPrivateExtern(true);
371  break;
372 
373  case MCSA_WeakReference:
374  // FIXME: This requires -dynamic.
375  if (Symbol->isUndefined())
376  Symbol->setWeakReference();
377  break;
378 
379  case MCSA_WeakDefinition:
380  // FIXME: 'as' enforces that this is defined and global. The manual claims
381  // it has to be in a coalesced section, but this isn't enforced.
382  Symbol->setWeakDefinition();
383  break;
384 
386  Symbol->setWeakDefinition();
387  Symbol->setWeakReference();
388  break;
389 
390  case MCSA_Cold:
391  Symbol->setCold();
392  break;
393  }
394 
395  return true;
396 }
397 
398 void MCMachOStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
399  // Encode the 'desc' value into the lowest implementation defined bits.
400  getAssembler().registerSymbol(*Symbol);
401  cast<MCSymbolMachO>(Symbol)->setDesc(DescValue);
402 }
403 
404 void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
405  unsigned ByteAlignment) {
406  // FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
407  assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
408 
409  getAssembler().registerSymbol(*Symbol);
410  Symbol->setExternal(true);
411  Symbol->setCommon(Size, ByteAlignment);
412 }
413 
414 void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
415  unsigned ByteAlignment) {
416  // '.lcomm' is equivalent to '.zerofill'.
417  return EmitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
418  Symbol, Size, ByteAlignment);
419 }
420 
421 void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
422  uint64_t Size, unsigned ByteAlignment,
423  SMLoc Loc) {
424  // On darwin all virtual sections have zerofill type. Disallow the usage of
425  // .zerofill in non-virtual functions. If something similar is needed, use
426  // .space or .zero.
427  if (!Section->isVirtualSection()) {
428  getContext().reportError(
429  Loc, "The usage of .zerofill is restricted to sections of "
430  "ZEROFILL type. Use .zero or .space instead.");
431  return; // Early returning here shouldn't harm. EmitZeros should work on any
432  // section.
433  }
434 
435  PushSection();
436  SwitchSection(Section);
437 
438  // The symbol may not be present, which only creates the section.
439  if (Symbol) {
440  EmitValueToAlignment(ByteAlignment, 0, 1, 0);
441  EmitLabel(Symbol);
442  EmitZeros(Size);
443  }
444  PopSection();
445 }
446 
447 // This should always be called with the thread local bss section. Like the
448 // .zerofill directive this doesn't actually switch sections on us.
449 void MCMachOStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
450  uint64_t Size, unsigned ByteAlignment) {
451  EmitZerofill(Section, Symbol, Size, ByteAlignment);
452 }
453 
454 void MCMachOStreamer::EmitInstToData(const MCInst &Inst,
455  const MCSubtargetInfo &STI) {
456  MCDataFragment *DF = getOrCreateDataFragment();
457 
459  SmallString<256> Code;
460  raw_svector_ostream VecOS(Code);
461  getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
462 
463  // Add the fixups and data.
464  for (MCFixup &Fixup : Fixups) {
465  Fixup.setOffset(Fixup.getOffset() + DF->getContents().size());
466  DF->getFixups().push_back(Fixup);
467  }
468  DF->setHasInstructions(STI);
469  DF->getContents().append(Code.begin(), Code.end());
470 }
471 
472 void MCMachOStreamer::FinishImpl() {
473  EmitFrames(&getAssembler().getBackend());
474 
475  // We have to set the fragment atom associations so we can relax properly for
476  // Mach-O.
477 
478  // First, scan the symbol table to build a lookup table from fragments to
479  // defining symbols.
481  for (const MCSymbol &Symbol : getAssembler().symbols()) {
482  if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() &&
483  !Symbol.isVariable()) {
484  // An atom defining symbol should never be internal to a fragment.
485  assert(Symbol.getOffset() == 0 &&
486  "Invalid offset in atom defining symbol!");
487  DefiningSymbolMap[Symbol.getFragment()] = &Symbol;
488  }
489  }
490 
491  // Set the fragment atom associations by tracking the last seen atom defining
492  // symbol.
493  for (MCSection &Sec : getAssembler()) {
494  const MCSymbol *CurrentAtom = nullptr;
495  for (MCFragment &Frag : Sec) {
496  if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(&Frag))
497  CurrentAtom = Symbol;
498  Frag.setAtom(CurrentAtom);
499  }
500  }
501 
503 }
504 
506  std::unique_ptr<MCAsmBackend> &&MAB,
507  std::unique_ptr<MCObjectWriter> &&OW,
508  std::unique_ptr<MCCodeEmitter> &&CE,
509  bool RelaxAll, bool DWARFMustBeAtTheEnd,
510  bool LabelSections) {
511  MCMachOStreamer *S =
512  new MCMachOStreamer(Context, std::move(MAB), std::move(OW), std::move(CE),
513  DWARFMustBeAtTheEnd, LabelSections);
514  const Triple &Target = Context.getObjectFileInfo()->getTargetTriple();
515  S->EmitVersionForTarget(Target, Context.getObjectFileInfo()->getSDKVersion());
516  if (RelaxAll)
517  S->getAssembler().setRelaxAll(true);
518  return S;
519 }
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:38
void setPrivateExtern(bool Value)
Definition: MCSymbol.h:409
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:297
void setCommon(uint64_t Size, unsigned Align, bool Target=false)
Mark this symbol as being &#39;common&#39;.
Definition: MCSymbol.h:349
.type _foo, STT_OBJECT # aka
Definition: MCDirectives.h:25
This represents an "assembler immediate".
Definition: MCValue.h:39
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:530
MCDataRegionType
Definition: MCDirectives.h:56
.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:77
.cold (MachO)
Definition: MCDirectives.h:22
int64_t getConstant() const
Definition: MCValue.h:46
const MCSymbolRefExpr * getSymB() const
Definition: MCValue.h:48
Definition: BitVector.h:937
void setExternal(bool Value) const
Definition: MCSymbol.h:406
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:41
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:253
.data_region jt16
Definition: MCDirectives.h:59
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:173
.local (ELF)
Definition: MCDirectives.h:35
StringRef getSectionName() const
.no_dead_strip (MachO)
Definition: MCDirectives.h:36
PlatformType
Definition: MachO.h:484
Context object for machine code objects.
Definition: MCContext.h:65
void setSymbolResolver() const
Definition: MCSymbolMachO.h:89
.code16 (X86) / .code 16 (ARM)
Definition: MCDirectives.h:51
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:672
Streaming object file generation interface.
.type _foo, STT_GNU_IFUNC
Definition: MCDirectives.h:24
.alt_entry (MachO)
Definition: MCDirectives.h:38
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
.protected (ELF)
Definition: MCDirectives.h:40
.lazy_reference (MachO)
Definition: MCDirectives.h:34
SmallVectorImpl< char > & getContents()
Definition: MCFragment.h:198
.reference (MachO)
Definition: MCDirectives.h:41
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:131
.hidden (ELF)
Definition: MCDirectives.h:31
.data_region jt32
Definition: MCDirectives.h:60
void setCold() const
Streaming machine code generation interface.
Definition: MCStreamer.h:189
void setWeakDefinition() const
Definition: MCSymbolMachO.h:82
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
.weak_def_can_be_hidden (MachO)
Definition: MCDirectives.h:45
void setHasInstructions(const MCSubtargetInfo &STI)
Record that the fragment contains instructions with the MCSubtargetInfo in effect when the instructio...
Definition: MCFragment.h:178
SmallVectorImpl< MCFixup > & getFixups()
Definition: MCFragment.h:224
MCLOHType
Linker Optimization Hint Type.
const MCSymbolRefExpr * getSymA() const
Definition: MCValue.h:47
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:322
.subsections_via_symbols (MachO)
Definition: MCDirectives.h:50
uint64_t getOffset() const
Definition: MCSymbol.h:324
.weak_reference (MachO)
Definition: MCDirectives.h:44
bool isExternal() const
Definition: MCSymbol.h:405
size_t size() const
Definition: SmallVector.h:52
#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:43
static bool canGoAfterDWARF(const MCSectionMachO &MSec)
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:258
MCFragment * getFragment(bool SetUsed=true) const
Definition: MCSymbol.h:396
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:837
.indirect_symbol (MachO)
Definition: MCDirectives.h:32
.type _foo, STT_TLS # aka
Definition: MCDirectives.h:26
MCSymbol * getBeginSymbol()
Definition: MCSection.h:109
const Triple & getTargetTriple() const
MCSymbolAttr
Definition: MCDirectives.h:18
Target - Wrapper for Target specific information.
.syntax (ARM/ELF)
Definition: MCDirectives.h:49
.internal (ELF)
Definition: MCDirectives.h:33
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:387
.code32 (X86) / .code 32 (ARM)
Definition: MCDirectives.h:52
.type _foo, STT_COMMON # aka
Definition: MCDirectives.h:27
.code64 (X86)
Definition: MCDirectives.h:53
.symbol_resolver (MachO)
Definition: MCDirectives.h:37
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition: VersionTuple.h:26
.type _foo,
Definition: MCDirectives.h:30
void FinishImpl() override
Streamer specific finalization.
MCAssemblerFlag
Definition: MCDirectives.h:48
const VersionTuple & getSDKVersion() const
.type _foo, STT_FUNC # aka
Definition: MCDirectives.h:23
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol.
void reset() override
state management
Generic base class for all target subtargets.
uint32_t Size
Definition: Profile.cpp:46
void setNoDeadStrip() const
Definition: MCSymbolMachO.h:68
.weak_definition (MachO)
Definition: MCDirectives.h:43
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:211
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:204
Fragment for data and encoded instructions.
Definition: MCFragment.h:243
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
.private_extern (MachO)
Definition: MCDirectives.h:39
.data_region jt8
Definition: MCDirectives.h:58
MCVersionMinType
Definition: MCDirectives.h:64
LLVM Value Representation.
Definition: Value.h:73
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
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:408
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
.end_data_region
Definition: MCDirectives.h:61
void setBeginSymbol(MCSymbol *Sym)
Definition: MCSection.h:113