LLVM  5.0.0
MCMachOStreamer.cpp
Go to the documentation of this file.
1 //===- MCMachOStreamer.cpp - MachO Streamer -------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/ADT/DenseMap.h"
11 #include "llvm/ADT/SmallString.h"
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/ADT/Triple.h"
15 #include "llvm/MC/MCAsmBackend.h"
16 #include "llvm/MC/MCAssembler.h"
17 #include "llvm/MC/MCCodeEmitter.h"
18 #include "llvm/MC/MCContext.h"
19 #include "llvm/MC/MCDirectives.h"
20 #include "llvm/MC/MCExpr.h"
21 #include "llvm/MC/MCFixup.h"
22 #include "llvm/MC/MCFragment.h"
23 #include "llvm/MC/MCInst.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, MCAsmBackend &MAB, raw_pwrite_stream &OS,
66  MCCodeEmitter *Emitter, bool DWARFMustBeAtTheEnd, bool label)
67  : MCObjectStreamer(Context, MAB, OS, Emitter), LabelSections(label),
68  DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd), CreatedADWARFSection(false) {}
69 
70  /// state management
71  void reset() override {
72  CreatedADWARFSection = false;
73  HasSectionLabel.clear();
75  }
76 
77  /// @name MCStreamer Interface
78  /// @{
79 
80  void ChangeSection(MCSection *Sect, const MCExpr *Subsect) override;
81  void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
82  void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
83  void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
84  void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
85  void EmitLinkerOptions(ArrayRef<std::string> Options) override;
86  void EmitDataRegion(MCDataRegionType Kind) override;
87  void EmitVersionMin(MCVersionMinType Kind, unsigned Major,
88  unsigned Minor, unsigned Update) override;
89  void EmitThumbFunc(MCSymbol *Func) override;
90  bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
91  void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
92  void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
93  unsigned ByteAlignment) override;
94 
95  void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
96  unsigned ByteAlignment) override;
97  void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
98  uint64_t Size = 0, unsigned ByteAlignment = 0) override;
99  void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
100  unsigned ByteAlignment = 0) override;
101 
102  void EmitIdent(StringRef IdentString) override {
103  llvm_unreachable("macho doesn't support this directive");
104  }
105 
106  void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override {
107  getAssembler().getLOHContainer().addDirective(Kind, Args);
108  }
109 
110  void FinishImpl() override;
111 };
112 
113 } // end anonymous namespace.
114 
115 static bool canGoAfterDWARF(const MCSectionMachO &MSec) {
116  // These sections are created by the assembler itself after the end of
117  // the .s file.
118  StringRef SegName = MSec.getSegmentName();
119  StringRef SecName = MSec.getSectionName();
120 
121  if (SegName == "__LD" && SecName == "__compact_unwind")
122  return true;
123 
124  if (SegName == "__IMPORT") {
125  if (SecName == "__jump_table")
126  return true;
127 
128  if (SecName == "__pointers")
129  return true;
130  }
131 
132  if (SegName == "__TEXT" && SecName == "__eh_frame")
133  return true;
134 
135  if (SegName == "__DATA" && (SecName == "__nl_symbol_ptr" ||
136  SecName == "__thread_ptr"))
137  return true;
138 
139  return false;
140 }
141 
142 void MCMachOStreamer::ChangeSection(MCSection *Section,
143  const MCExpr *Subsection) {
144  // Change the section normally.
145  bool Created = changeSectionImpl(Section, Subsection);
146  const MCSectionMachO &MSec = *cast<MCSectionMachO>(Section);
147  StringRef SegName = MSec.getSegmentName();
148  if (SegName == "__DWARF")
149  CreatedADWARFSection = true;
150  else if (Created && DWARFMustBeAtTheEnd && !canGoAfterDWARF(MSec))
151  assert(!CreatedADWARFSection && "Creating regular section after DWARF");
152 
153  // Output a linker-local symbol so we don't need section-relative local
154  // relocations. The linker hates us when we do that.
155  if (LabelSections && !HasSectionLabel[Section] &&
156  !Section->getBeginSymbol()) {
157  MCSymbol *Label = getContext().createLinkerPrivateTempSymbol();
158  Section->setBeginSymbol(Label);
159  HasSectionLabel[Section] = true;
160  }
161 }
162 
163 void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
164  MCSymbol *EHSymbol) {
165  getAssembler().registerSymbol(*Symbol);
166  if (Symbol->isExternal())
167  EmitSymbolAttribute(EHSymbol, MCSA_Global);
168  if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition())
169  EmitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
170  if (Symbol->isPrivateExtern())
171  EmitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
172 }
173 
174 void MCMachOStreamer::EmitLabel(MCSymbol *Symbol, SMLoc Loc) {
175  // We have to create a new fragment if this is an atom defining symbol,
176  // fragments cannot span atoms.
177  if (getAssembler().isSymbolLinkerVisible(*Symbol))
178  insert(new MCDataFragment());
179 
180  MCObjectStreamer::EmitLabel(Symbol, Loc);
181 
182  // This causes the reference type flag to be cleared. Darwin 'as' was "trying"
183  // to clear the weak reference and weak definition bits too, but the
184  // implementation was buggy. For now we just try to match 'as', for
185  // diffability.
186  //
187  // FIXME: Cleanup this code, these bits should be emitted based on semantic
188  // properties, not on the order of definition, etc.
189  cast<MCSymbolMachO>(Symbol)->clearReferenceType();
190 }
191 
192 void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
193  MCValue Res;
194 
195  if (Value->evaluateAsRelocatable(Res, nullptr, nullptr)) {
196  if (const MCSymbolRefExpr *SymAExpr = Res.getSymA()) {
197  const MCSymbol &SymA = SymAExpr->getSymbol();
198  if (!Res.getSymB() && (SymA.getName() == "" || Res.getConstant() != 0))
199  cast<MCSymbolMachO>(Symbol)->setAltEntry();
200  }
201  }
202  MCObjectStreamer::EmitAssignment(Symbol, Value);
203 }
204 
205 void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
206  // Create a temporary label to mark the start of the data region.
207  MCSymbol *Start = getContext().createTempSymbol();
208  EmitLabel(Start);
209  // Record the region for the object writer to use.
210  DataRegionData Data = { Kind, Start, nullptr };
211  std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
212  Regions.push_back(Data);
213 }
214 
215 void MCMachOStreamer::EmitDataRegionEnd() {
216  std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
217  assert(!Regions.empty() && "Mismatched .end_data_region!");
218  DataRegionData &Data = Regions.back();
219  assert(!Data.End && "Mismatched .end_data_region!");
220  // Create a temporary label to mark the end of the data region.
221  Data.End = getContext().createTempSymbol();
222  EmitLabel(Data.End);
223 }
224 
225 void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
226  // Let the target do whatever target specific stuff it needs to do.
227  getAssembler().getBackend().handleAssemblerFlag(Flag);
228  // Do any generic stuff we need to do.
229  switch (Flag) {
230  case MCAF_SyntaxUnified: return; // no-op here.
231  case MCAF_Code16: return; // Change parsing mode; no-op here.
232  case MCAF_Code32: return; // Change parsing mode; no-op here.
233  case MCAF_Code64: return; // Change parsing mode; no-op here.
235  getAssembler().setSubsectionsViaSymbols(true);
236  return;
237  }
238 }
239 
240 void MCMachOStreamer::EmitLinkerOptions(ArrayRef<std::string> Options) {
241  getAssembler().getLinkerOptions().push_back(Options);
242 }
243 
244 void MCMachOStreamer::EmitDataRegion(MCDataRegionType Kind) {
245  switch (Kind) {
246  case MCDR_DataRegion:
247  EmitDataRegion(DataRegionData::Data);
248  return;
249  case MCDR_DataRegionJT8:
250  EmitDataRegion(DataRegionData::JumpTable8);
251  return;
252  case MCDR_DataRegionJT16:
253  EmitDataRegion(DataRegionData::JumpTable16);
254  return;
255  case MCDR_DataRegionJT32:
256  EmitDataRegion(DataRegionData::JumpTable32);
257  return;
258  case MCDR_DataRegionEnd:
259  EmitDataRegionEnd();
260  return;
261  }
262 }
263 
264 void MCMachOStreamer::EmitVersionMin(MCVersionMinType Kind, unsigned Major,
265  unsigned Minor, unsigned Update) {
266  getAssembler().setVersionMinInfo(Kind, Major, Minor, Update);
267 }
268 
269 void MCMachOStreamer::EmitThumbFunc(MCSymbol *Symbol) {
270  // Remember that the function is a thumb function. Fixup and relocation
271  // values will need adjusted.
272  getAssembler().setIsThumbFunc(Symbol);
273  cast<MCSymbolMachO>(Symbol)->setThumbFunc();
274 }
275 
276 bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Sym,
278  MCSymbolMachO *Symbol = cast<MCSymbolMachO>(Sym);
279 
280  // Indirect symbols are handled differently, to match how 'as' handles
281  // them. This makes writing matching .o files easier.
282  if (Attribute == MCSA_IndirectSymbol) {
283  // Note that we intentionally cannot use the symbol data here; this is
284  // important for matching the string table that 'as' generates.
285  IndirectSymbolData ISD;
286  ISD.Symbol = Symbol;
287  ISD.Section = getCurrentSectionOnly();
288  getAssembler().getIndirectSymbols().push_back(ISD);
289  return true;
290  }
291 
292  // Adding a symbol attribute always introduces the symbol, note that an
293  // important side effect of calling registerSymbol here is to register
294  // the symbol with the assembler.
295  getAssembler().registerSymbol(*Symbol);
296 
297  // The implementation of symbol attributes is designed to match 'as', but it
298  // leaves much to desired. It doesn't really make sense to arbitrarily add and
299  // remove flags, but 'as' allows this (in particular, see .desc).
300  //
301  // In the future it might be worth trying to make these operations more well
302  // defined.
303  switch (Attribute) {
304  case MCSA_Invalid:
307  case MCSA_ELF_TypeObject:
308  case MCSA_ELF_TypeTLS:
309  case MCSA_ELF_TypeCommon:
310  case MCSA_ELF_TypeNoType:
312  case MCSA_Hidden:
313  case MCSA_IndirectSymbol:
314  case MCSA_Internal:
315  case MCSA_Protected:
316  case MCSA_Weak:
317  case MCSA_Local:
318  return false;
319 
320  case MCSA_Global:
321  Symbol->setExternal(true);
322  // This effectively clears the undefined lazy bit, in Darwin 'as', although
323  // it isn't very consistent because it implements this as part of symbol
324  // lookup.
325  //
326  // FIXME: Cleanup this code, these bits should be emitted based on semantic
327  // properties, not on the order of definition, etc.
328  Symbol->setReferenceTypeUndefinedLazy(false);
329  break;
330 
331  case MCSA_LazyReference:
332  // FIXME: This requires -dynamic.
333  Symbol->setNoDeadStrip();
334  if (Symbol->isUndefined())
335  Symbol->setReferenceTypeUndefinedLazy(true);
336  break;
337 
338  // Since .reference sets the no dead strip bit, it is equivalent to
339  // .no_dead_strip in practice.
340  case MCSA_Reference:
341  case MCSA_NoDeadStrip:
342  Symbol->setNoDeadStrip();
343  break;
344 
345  case MCSA_SymbolResolver:
346  Symbol->setSymbolResolver();
347  break;
348 
349  case MCSA_AltEntry:
350  Symbol->setAltEntry();
351  break;
352 
353  case MCSA_PrivateExtern:
354  Symbol->setExternal(true);
355  Symbol->setPrivateExtern(true);
356  break;
357 
358  case MCSA_WeakReference:
359  // FIXME: This requires -dynamic.
360  if (Symbol->isUndefined())
361  Symbol->setWeakReference();
362  break;
363 
364  case MCSA_WeakDefinition:
365  // FIXME: 'as' enforces that this is defined and global. The manual claims
366  // it has to be in a coalesced section, but this isn't enforced.
367  Symbol->setWeakDefinition();
368  break;
369 
371  Symbol->setWeakDefinition();
372  Symbol->setWeakReference();
373  break;
374  }
375 
376  return true;
377 }
378 
379 void MCMachOStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
380  // Encode the 'desc' value into the lowest implementation defined bits.
381  getAssembler().registerSymbol(*Symbol);
382  cast<MCSymbolMachO>(Symbol)->setDesc(DescValue);
383 }
384 
385 void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
386  unsigned ByteAlignment) {
387  // FIXME: Darwin 'as' does appear to allow redef of a .comm by itself.
388  assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
389 
390  getAssembler().registerSymbol(*Symbol);
391  Symbol->setExternal(true);
392  Symbol->setCommon(Size, ByteAlignment);
393 }
394 
395 void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
396  unsigned ByteAlignment) {
397  // '.lcomm' is equivalent to '.zerofill'.
398  return EmitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
399  Symbol, Size, ByteAlignment);
400 }
401 
402 void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
403  uint64_t Size, unsigned ByteAlignment) {
404  getAssembler().registerSection(*Section);
405 
406  // The symbol may not be present, which only creates the section.
407  if (!Symbol)
408  return;
409 
410  // On darwin all virtual sections have zerofill type.
411  assert(Section->isVirtualSection() && "Section does not have zerofill type!");
412 
413  assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
414 
415  getAssembler().registerSymbol(*Symbol);
416 
417  // Emit an align fragment if necessary.
418  if (ByteAlignment != 1)
419  new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section);
420 
421  MCFragment *F = new MCFillFragment(0, Size, Section);
422  Symbol->setFragment(F);
423 
424  // Update the maximum alignment on the zero fill section if necessary.
425  if (ByteAlignment > Section->getAlignment())
426  Section->setAlignment(ByteAlignment);
427 }
428 
429 // This should always be called with the thread local bss section. Like the
430 // .zerofill directive this doesn't actually switch sections on us.
431 void MCMachOStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
432  uint64_t Size, unsigned ByteAlignment) {
433  EmitZerofill(Section, Symbol, Size, ByteAlignment);
434 }
435 
436 void MCMachOStreamer::EmitInstToData(const MCInst &Inst,
437  const MCSubtargetInfo &STI) {
438  MCDataFragment *DF = getOrCreateDataFragment();
439 
442  raw_svector_ostream VecOS(Code);
443  getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
444 
445  // Add the fixups and data.
446  for (MCFixup &Fixup : Fixups) {
447  Fixup.setOffset(Fixup.getOffset() + DF->getContents().size());
448  DF->getFixups().push_back(Fixup);
449  }
450  DF->getContents().append(Code.begin(), Code.end());
451 }
452 
453 void MCMachOStreamer::FinishImpl() {
454  EmitFrames(&getAssembler().getBackend());
455 
456  // We have to set the fragment atom associations so we can relax properly for
457  // Mach-O.
458 
459  // First, scan the symbol table to build a lookup table from fragments to
460  // defining symbols.
462  for (const MCSymbol &Symbol : getAssembler().symbols()) {
463  if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.isInSection() &&
464  !Symbol.isVariable()) {
465  // An atom defining symbol should never be internal to a fragment.
466  assert(Symbol.getOffset() == 0 &&
467  "Invalid offset in atom defining symbol!");
468  DefiningSymbolMap[Symbol.getFragment()] = &Symbol;
469  }
470  }
471 
472  // Set the fragment atom associations by tracking the last seen atom defining
473  // symbol.
474  for (MCSection &Sec : getAssembler()) {
475  const MCSymbol *CurrentAtom = nullptr;
476  for (MCFragment &Frag : Sec) {
477  if (const MCSymbol *Symbol = DefiningSymbolMap.lookup(&Frag))
478  CurrentAtom = Symbol;
479  Frag.setAtom(CurrentAtom);
480  }
481  }
482 
484 }
485 
488  bool RelaxAll, bool DWARFMustBeAtTheEnd,
489  bool LabelSections) {
490  MCMachOStreamer *S = new MCMachOStreamer(Context, MAB, OS, CE,
491  DWARFMustBeAtTheEnd, LabelSections);
492  const Triple &TT = Context.getObjectFileInfo()->getTargetTriple();
493  if (TT.isOSDarwin()) {
494  unsigned Major, Minor, Update;
495  TT.getOSVersion(Major, Minor, Update);
496  // If there is a version specified, Major will be non-zero.
497  if (Major) {
498  MCVersionMinType VersionType;
499  if (TT.isWatchOS())
500  VersionType = MCVM_WatchOSVersionMin;
501  else if (TT.isTvOS())
502  VersionType = MCVM_TvOSVersionMin;
503  else if (TT.isMacOSX())
504  VersionType = MCVM_OSXVersionMin;
505  else {
506  assert(TT.isiOS() && "Must only be iOS platform left");
507  VersionType = MCVM_IOSVersionMin;
508  }
509  S->EmitVersionMin(VersionType, Major, Minor, Update);
510  }
511  }
512  if (RelaxAll)
513  S->getAssembler().setRelaxAll(true);
514  return S;
515 }
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:396
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:166
This represents a section on a Mach-O system (used by Mac OS X).
LLVMContext & Context
.type _foo, STT_OBJECT # aka
Definition: MCDirectives.h:25
This represents an "assembler immediate".
Definition: MCValue.h:40
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
Not a valid directive.
Definition: MCDirectives.h:20
.watchos_version_min
Definition: MCDirectives.h:68
.ios_version_min
Definition: MCDirectives.h:65
void setAlignment(unsigned Value)
Definition: MCSection.h:118
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:490
.macosx_version_min
Definition: MCDirectives.h:66
MCDataRegionType
Definition: MCDirectives.h:56
bool isExternal() const
Definition: MCSymbol.h:392
.type _foo, STT_NOTYPE # aka
Definition: MCDirectives.h:28
unsigned getAlignment() const
Definition: MCSection.h:117
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:66
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:438
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
.data_region jt16
Definition: MCDirectives.h:59
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:165
void setCommon(uint64_t Size, unsigned Align)
Mark this symbol as being 'common'.
Definition: MCSymbol.h:344
.local (ELF)
Definition: MCDirectives.h:35
.no_dead_strip (MachO)
Definition: MCDirectives.h:36
Context object for machine code objects.
Definition: MCContext.h:59
void setWeakReference() const
Definition: MCSymbolMachO.h:75
#define F(x, y, z)
Definition: MD5.cpp:55
.code16 (X86) / .code 16 (ARM)
Definition: MCDirectives.h:51
Streaming object file generation interface.
StringRef getSectionName() const
.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:33
.protected (ELF)
Definition: MCDirectives.h:40
void setWeakDefinition() const
Definition: MCSymbolMachO.h:82
void setExternal(bool Value) const
Definition: MCSymbol.h:393
.lazy_reference (MachO)
Definition: MCDirectives.h:34
bool isTvOS() const
Is this an Apple tvOS triple.
Definition: Triple.h:452
const Triple & getTargetTriple() const
SmallVectorImpl< char > & getContents()
Definition: MCFragment.h:181
.reference (MachO)
Definition: MCDirectives.h:41
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:121
void setFragment(MCFragment *F) const
Mark the symbol as defined in the fragment F.
Definition: MCSymbol.h:274
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:447
Function Alias Analysis false
.hidden (ELF)
Definition: MCDirectives.h:31
.data_region jt32
Definition: MCDirectives.h:60
Streaming machine code generation interface.
Definition: MCStreamer.h:167
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
.tvos_version_min
Definition: MCDirectives.h:67
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Definition: SmallVector.h:115
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:22
SmallVectorImpl< MCFixup > & getFixups()
Definition: MCFragment.h:206
bool isWatchOS() const
Is this an Apple watchOS triple.
Definition: Triple.h:457
MCLOHType
Linker Optimization Hint Type.
.subsections_via_symbols (MachO)
Definition: MCDirectives.h:50
void setReferenceTypeUndefinedLazy(bool Value) const
Definition: MCSymbolMachO.h:54
.weak_reference (MachO)
Definition: MCDirectives.h:44
bool isInSection(bool SetUsed=true) const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
Definition: MCSymbol.h:255
const MCSymbolRefExpr * getSymB() const
Definition: MCValue.h:48
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
static bool canGoAfterDWARF(const MCSectionMachO &MSec)
PowerPC TLS Dynamic Call Fixup
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:466
void setSymbolResolver() const
Definition: MCSymbolMachO.h:89
const MCSymbolRefExpr * getSymA() const
Definition: MCValue.h:47
virtual bool isVirtualSection() const =0
Check whether this section is "virtual", that is has no actual object file contents.
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getOSVersion - Parse the version number from the OS name component of the triple, if present...
Definition: Triple.cpp:992
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
.indirect_symbol (MachO)
Definition: MCDirectives.h:32
.type _foo, STT_TLS # aka
Definition: MCDirectives.h:26
MCSymbol * getBeginSymbol()
Definition: MCSection.h:106
MCSymbolAttr
Definition: MCDirectives.h:19
void setNoDeadStrip() const
Definition: MCSymbolMachO.h:68
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:594
.syntax (ARM/ELF)
Definition: MCDirectives.h:49
void setAltEntry() const
Definition: MCSymbolMachO.h:93
.internal (ELF)
Definition: MCDirectives.h:33
StringRef getSegmentName() const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Definition: SmallVector.h:395
.code32 (X86) / .code 32 (ARM)
Definition: MCDirectives.h:52
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
.type _foo, STT_COMMON # aka
Definition: MCDirectives.h:27
.code64 (X86)
Definition: MCDirectives.h:53
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Definition: SmallVector.h:119
.symbol_resolver (MachO)
Definition: MCDirectives.h:37
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:203
.type _foo,
Definition: MCDirectives.h:30
void FinishImpl() override
Streamer specific finalization.
uint64_t getOffset() const
Definition: MCSymbol.h:320
MCAssemblerFlag
Definition: MCDirectives.h:48
.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
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
Definition: SmallVector.h:135
MCSubtargetInfo - Generic base class for all target subtargets.
.weak_definition (MachO)
Definition: MCDirectives.h:43
bool isVariable() const
isVariable - Check if this is a variable symbol.
Definition: MCSymbol.h:295
MCFragment * getFragment(bool SetUsed=true) const
Definition: MCSymbol.h:383
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:333
const unsigned Kind
Fragment for data and encoded instructions.
Definition: MCFragment.h:224
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
.private_extern (MachO)
Definition: MCDirectives.h:39
int64_t getConstant() const
Definition: MCValue.h:46
.data_region jt8
Definition: MCDirectives.h:58
bool isPrivateExtern() const
Definition: MCSymbol.h:395
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
MCStreamer * createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB, raw_pwrite_stream &OS, MCCodeEmitter *CE, bool RelaxAll, bool DWARFMustBeAtTheEnd, bool LabelSections=false)
MCVersionMinType
Definition: MCDirectives.h:64
LLVM Value Representation.
Definition: Value.h:73
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:35
const MCObjectFileInfo * getObjectFileInfo() const
Definition: MCContext.h:287
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Represents a location in source code.
Definition: SMLoc.h:24
.end_data_region
Definition: MCDirectives.h:61
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
Definition: MCSymbol.h:260
void setBeginSymbol(MCSymbol *Sym)
Definition: MCSection.h:110