LLVM  6.0.0svn
MCObjectFileInfo.h
Go to the documentation of this file.
1 //===-- llvm/MC/MCObjectFileInfo.h - Object File Info -----------*- C++ -*-===//
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 // This file describes common object file formats.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_MC_MCOBJECTFILEINFO_H
15 #define LLVM_MC_MCOBJECTFILEINFO_H
16 
17 #include "llvm/ADT/Triple.h"
18 #include "llvm/Support/CodeGen.h"
19 
20 namespace llvm {
21 class MCContext;
22 class MCSection;
23 
25 protected:
26  /// True if .comm supports alignment. This is a hack for as long as we
27  /// support 10.4 Tiger, whose assembler doesn't support alignment on comm.
29 
30  /// True if target object file supports a weak_definition of constant 0 for an
31  /// omitted EH frame.
33 
34  /// True if the target object file supports emitting a compact unwind section
35  /// without an associated EH frame section.
37 
38  /// OmitDwarfIfHaveCompactUnwind - True if the target object file
39  /// supports having some functions with compact unwind and other with
40  /// dwarf unwind.
42 
43  /// PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values
44  /// for EH.
46  unsigned LSDAEncoding;
47  unsigned FDECFIEncoding;
48  unsigned TTypeEncoding;
49 
50  /// Compact unwind encoding indicating that we should emit only an EH frame.
52 
53  /// Section directive for standard text.
55 
56  /// Section directive for standard data.
58 
59  /// Section that is default initialized to zero.
61 
62  /// Section that is readonly and can contain arbitrary initialized data.
63  /// Targets are not required to have a readonly section. If they don't,
64  /// various bits of code will fall back to using the data section for
65  /// constants.
67 
68  /// If exception handling is supported by the target, this is the section the
69  /// Language Specific Data Area information is emitted to.
71 
72  /// If exception handling is supported by the target and the target can
73  /// support a compact representation of the CIE and FDE, this is the section
74  /// to emit them into.
76 
77  // Dwarf sections for debug info. If a target supports debug info, these must
78  // be set.
90  // The pubnames section is no longer generated by default. The generation
91  // can be enabled by a compiler flag.
93 
94  /// DWARF5 Experimental Debug Info Sections
95  /// DwarfAccelNamesSection, DwarfAccelObjCSection,
96  /// DwarfAccelNamespaceSection, DwarfAccelTypesSection -
97  /// If we use the DWARF accelerated hash tables then we want to emit these
98  /// sections.
103 
104  // These are used for the Fission separate debug information files.
112 
113  /// The DWARF v5 string offset and address table sections.
116 
117  // These are for Fission DWP files.
120 
121  /// Section for newer gnu pubnames.
123  /// Section for newer gnu pubtypes.
125 
126  // Section for Swift AST
128 
131 
132  /// Extra TLS Variable Data section.
133  ///
134  /// If the target needs to put additional information for a TLS variable,
135  /// it'll go here.
137 
138  /// Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
139  MCSection *TLSDataSection; // Defaults to ".tdata".
140 
141  /// Section directive for Thread Local uninitialized data.
142  ///
143  /// Null if this target doesn't support a BSS section. ELF and MachO only.
144  MCSection *TLSBSSSection; // Defaults to ".tbss".
145 
146  /// StackMap section.
148 
149  /// FaultMap section.
151 
152  /// EH frame section.
153  ///
154  /// It is initialized on demand so it can be overwritten (with uniquing).
156 
157  // ELF specific sections.
163 
164  // MachO specific sections.
165 
166  /// Section for thread local structure information.
167  ///
168  /// Contains the source code name of the variable, visibility and a pointer to
169  /// the initial value (.tdata or .tbss).
170  MCSection *TLSTLVSection; // Defaults to ".tlv".
171 
172  /// Section for thread local data initialization functions.
173  const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
174 
189 
190  /// COFF specific sections.
195 
196 public:
197  void InitMCObjectFileInfo(const Triple &TT, bool PIC, MCContext &ctx,
198  bool LargeCodeModel = false);
199 
202  }
205  }
208  }
209 
212  }
213 
214  unsigned getPersonalityEncoding() const { return PersonalityEncoding; }
215  unsigned getLSDAEncoding() const { return LSDAEncoding; }
216  unsigned getFDEEncoding() const { return FDECFIEncoding; }
217  unsigned getTTypeEncoding() const { return TTypeEncoding; }
218 
221  }
222 
223  MCSection *getTextSection() const { return TextSection; }
224  MCSection *getDataSection() const { return DataSection; }
225  MCSection *getBSSSection() const { return BSSSection; }
227  MCSection *getLSDASection() const { return LSDASection; }
237  }
240  }
243  }
249 
250  // DWARF5 Experimental Debug Info Sections
252  return DwarfAccelNamesSection;
253  }
257  }
259  return DwarfAccelTypesSection;
260  }
262  MCSection *getDwarfTypesSection(uint64_t Hash) const;
274 
277  }
279  return COFFDebugTypesSection;
280  }
281 
282 
284  const MCSection *getTLSDataSection() const { return TLSDataSection; }
286 
289 
290  // ELF specific sections.
293  return MergeableConst4Section;
294  }
296  return MergeableConst8Section;
297  }
300  }
303  }
304 
305  // MachO specific sections.
306  const MCSection *getTLSTLVSection() const { return TLSTLVSection; }
308  return TLSThreadInitSection;
309  }
310  const MCSection *getCStringSection() const { return CStringSection; }
311  const MCSection *getUStringSection() const { return UStringSection; }
314  return ConstTextCoalSection;
315  }
316  const MCSection *getConstDataSection() const { return ConstDataSection; }
317  const MCSection *getDataCoalSection() const { return DataCoalSection; }
322  }
325  }
328  }
331  }
334  }
337  }
338 
339  // COFF specific sections.
344 
346  return EHFrameSection;
347  }
348 
350  Environment getObjectFileType() const { return Env; }
351 
352  bool isPositionIndependent() const { return PositionIndependent; }
353 
354 private:
355  Environment Env;
356  bool PositionIndependent;
357  MCContext *Ctx;
358  Triple TT;
359 
360  void initMachOMCObjectFileInfo(const Triple &T);
361  void initELFMCObjectFileInfo(const Triple &T, bool Large);
362  void initCOFFMCObjectFileInfo(const Triple &T);
363  void initWasmMCObjectFileInfo(const Triple &T);
364 
365 public:
366  const Triple &getTargetTriple() const { return TT; }
367 };
368 
369 } // end namespace llvm
370 
371 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
MCSection * MergeableConst4Section
MCSection * DwarfStrOffSection
The DWARF v5 string offset and address table sections.
const MCSection * getConstDataSection() const
MCSection * getDwarfStrOffSection() const
MCSection * getDwarfTUIndexSection() const
MCSection * getDwarfAccelObjCSection() const
MCSection * getDwarfCUIndexSection() const
MCSection * getDwarfStrSection() const
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
MCSection * getCOFFDebugTypesSection() const
const MCSection * getTLSTLVSection() const
MCSection * getDwarfLineSection() const
MCSection * getStackMapSection() const
MCSection * DwarfPubTypesSection
MCSection * getDwarfLocSection() const
MCSection * DwarfGnuPubTypesSection
Section for newer gnu pubtypes.
MCSection * getTLSBSSSection() const
const MCSection * getFourByteConstantSection() const
MCSection * StackMapSection
StackMap section.
MCSection * SixteenByteConstantSection
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
MCSection * TextSection
Section directive for standard text.
MCSection * getEHFrameSection()
MCSection * ConstTextCoalSection
MCSection * getDwarfAccelNamesSection() const
MCSection * LazySymbolPointerSection
MCSection * getDwarfARangesSection() const
bool getSupportsCompactUnwindWithoutEHFrame() const
MCSection * getDwarfPubNamesSection() const
MCSection * getReadOnlySection() const
MCSection * MergeableConst32Section
MCSection * getDwarfMacinfoSection() const
MCSection * getDwarfLocDWOSection() const
MCSection * COFFDebugTypesSection
const MCSection * getCStringSection() const
MCSection * MergeableConst16Section
MCSection * DwarfPubNamesSection
bool getCommDirectiveSupportsAlignment() const
MCSection * getBSSSection() const
MCSection * getDataSection() const
MCSection * EightByteConstantSection
unsigned getCompactUnwindDwarfEHFrameOnly() const
MCSection * getDwarfFrameSection() const
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
MCSection * getDataBSSSection() const
bool getOmitDwarfIfHaveCompactUnwind() const
Context object for machine code objects.
Definition: MCContext.h:59
MCSection * getSXDataSection() const
const MCSection * DwarfDebugInlineSection
const MCSection * getDwarfDebugInlineSection() const
bool getSupportsWeakOmittedEHFrame() const
MCSection * getCOFFDebugSymbolsSection() const
MCSection * DrectveSection
COFF specific sections.
MCSection * getCompactUnwindSection() const
MCSection * getPDataSection() const
MCSection * DwarfAccelNamesSection
DWARF5 Experimental Debug Info Sections DwarfAccelNamesSection, DwarfAccelObjCSection, DwarfAccelNamespaceSection, DwarfAccelTypesSection - If we use the DWARF accelerated hash tables then we want to emit these sections.
const MCSection * getMergeableConst16Section() const
MCSection * getDwarfAccelTypesSection() const
MCSection * getDwarfAbbrevSection() const
MCSection * DataSection
Section directive for standard data.
unsigned getLSDAEncoding() const
MCSection * getDwarfAbbrevDWOSection() const
MCSection * getTLSExtraDataSection() const
MCSection * getDwarfGnuPubTypesSection() const
MCSection * getDwarfTypesDWOSection() const
MCSection * ThreadLocalPointerSection
MCSection * getDwarfAddrSection() const
MCSection * DwarfSwiftASTSection
MCSection * TLSTLVSection
Section for thread local structure information.
MCSection * getNonLazySymbolPointerSection() const
unsigned getFDEEncoding() const
MCSection * DwarfAccelNamespaceSection
unsigned getPersonalityEncoding() const
MCSection * getDwarfLineDWOSection() const
const MCSection * getMergeableConst8Section() const
Environment getObjectFileType() const
MCSection * getDwarfTypesSection(uint64_t Hash) const
bool SupportsCompactUnwindWithoutEHFrame
True if the target object file supports emitting a compact unwind section without an associated EH fr...
MCSection * getDwarfSwiftASTSection() const
bool CommDirectiveSupportsAlignment
True if .comm supports alignment.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
MCSection * getDrectveSection() const
MCSection * COFFDebugSymbolsSection
MCSection * DwarfAbbrevSection
MCSection * getThreadLocalPointerSection() const
MCSection * EHFrameSection
EH frame section.
const MCSection * getEightByteConstantSection() const
MCSection * getDataRelROSection() const
MCSection * DwarfTypesDWOSection
MCSection * DwarfRangesSection
const MCSection * getConstTextCoalSection() const
const Triple & getTargetTriple() const
MCSection * DwarfARangesSection
const MCSection * getDataCommonSection() const
MCSection * CompactUnwindSection
If exception handling is supported by the target and the target can support a compact representation ...
MCSection * getDwarfInfoSection() const
MCSection * DwarfAccelTypesSection
MCSection * getDwarfStrOffDWOSection() const
MCSection * DwarfStrOffDWOSection
MCSection * DwarfGnuPubNamesSection
Section for newer gnu pubnames.
MCSection * DwarfAbbrevDWOSection
const MCSection * getMergeableConst4Section() const
MCSection * getDwarfPubTypesSection() const
MCSection * FaultMapSection
FaultMap section.
bool OmitDwarfIfHaveCompactUnwind
OmitDwarfIfHaveCompactUnwind - True if the target object file supports having some functions with com...
MCSection * FourByteConstantSection
void InitMCObjectFileInfo(const Triple &TT, bool PIC, MCContext &ctx, bool LargeCodeModel=false)
MCSection * getDwarfStrDWOSection() const
const MCSection * getMergeableConst32Section() const
MCSection * getXDataSection() const
MCSection * LSDASection
If exception handling is supported by the target, this is the section the Language Specific Data Area...
MCSection * TLSExtraDataSection
Extra TLS Variable Data section.
MCSection * getLazySymbolPointerSection() const
unsigned CompactUnwindDwarfEHFrameOnly
Compact unwind encoding indicating that we should emit only an EH frame.
MCSection * getDwarfGnuPubNamesSection() const
MCSection * DwarfAccelObjCSection
MCSection * getFaultMapSection() const
const MCSection * getTLSThreadInitSection() const
MCSection * getTextSection() const
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
MCSection * NonLazySymbolPointerSection
MCSection * getDwarfAccelNamespaceSection() const
const MCSection * TLSThreadInitSection
Section for thread local data initialization functions.
bool SupportsWeakOmittedEHFrame
True if target object file supports a weak_definition of constant 0 for an omitted EH frame...
MCSection * getLSDASection() const
MCSection * getDwarfInfoDWOSection() const
MCSection * BSSSection
Section that is default initialized to zero.
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
bool isPositionIndependent() const
MCSection * DwarfMacinfoSection
MCSection * getDwarfRangesSection() const
const MCSection * getTLSDataSection() const
unsigned getTTypeEncoding() const
const MCSection * getSixteenByteConstantSection() const
const MCSection * getUStringSection() const
MCSection * getTextCoalSection() const
const MCSection * getDataCoalSection() const
MCSection * MergeableConst8Section