LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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_MCBJECTFILEINFO_H
15 #define LLVM_MC_MCBJECTFILEINFO_H
16 
17 #include "llvm/Support/CodeGen.h"
18 
19 namespace llvm {
20  class MCContext;
21  class MCSection;
22  class StringRef;
23  class Triple;
24 
26 protected:
27  /// CommDirectiveSupportsAlignment - True if .comm supports alignment. This
28  /// is a hack for as long as we support 10.4 Tiger, whose assembler doesn't
29  /// support alignment on comm.
31 
32  /// SupportsWeakEmptyEHFrame - True if target object file supports a
33  /// weak_definition of constant 0 for an omitted EH frame.
35 
36  /// IsFunctionEHFrameSymbolPrivate - This flag is set to true if the
37  /// "EH_frame" symbol for EH information should be an assembler temporary (aka
38  /// private linkage, aka an L or .L label) or false if it should be a normal
39  /// non-.globl label. This defaults to true.
41 
42  /// PersonalityEncoding, LSDAEncoding, FDEEncoding, TTypeEncoding - Some
43  /// encoding values for EH.
45  unsigned LSDAEncoding;
46  unsigned FDEEncoding;
47  unsigned FDECFIEncoding;
48  unsigned TTypeEncoding;
49 
50  /// Section flags for eh_frame
51  unsigned EHSectionType;
52  unsigned EHSectionFlags;
53 
54  /// CompactUnwindDwarfEHFrameOnly - Compact unwind encoding indicating that we
55  /// should emit only an EH frame.
57 
58  /// TextSection - Section directive for standard text.
59  ///
61 
62  /// DataSection - Section directive for standard data.
63  ///
65 
66  /// BSSSection - Section that is default initialized to zero.
68 
69  /// ReadOnlySection - Section that is readonly and can contain arbitrary
70  /// initialized data. Targets are not required to have a readonly section.
71  /// If they don't, various bits of code will fall back to using the data
72  /// section for constants.
74 
75  /// StaticCtorSection - This section contains the static constructor pointer
76  /// list.
78 
79  /// StaticDtorSection - This section contains the static destructor pointer
80  /// list.
82 
83  /// LSDASection - If exception handling is supported by the target, this is
84  /// the section the Language Specific Data Area information is emitted to.
86 
87  /// CompactUnwindSection - If exception handling is supported by the target
88  /// and the target can support a compact representation of the CIE and FDE,
89  /// this is the section to emit them into.
91 
92  // Dwarf sections for debug info. If a target supports debug info, these must
93  // be set.
105  // The pubnames section is no longer generated by default. The generation
106  // can be enabled by a compiler flag.
108 
109  // DWARF5 Experimental Debug Info Sections
110  /// DwarfAccelNamesSection, DwarfAccelObjCSection,
111  /// DwarfAccelNamespaceSection, DwarfAccelTypesSection -
112  /// If we use the DWARF accelerated hash tables then we want to emit these
113  /// sections.
118 
119  /// These are used for the Fission separate debug information files.
127 
128  /// Sections for newer gnu pubnames and pubtypes.
131 
132  // Extra TLS Variable Data section. If the target needs to put additional
133  // information for a TLS variable, it'll go here.
135 
136  /// TLSDataSection - Section directive for Thread Local data.
137  /// ELF, MachO and COFF.
138  const MCSection *TLSDataSection; // Defaults to ".tdata".
139 
140  /// TLSBSSSection - Section directive for Thread Local uninitialized data.
141  /// Null if this target doesn't support a BSS section.
142  /// ELF and MachO only.
143  const MCSection *TLSBSSSection; // Defaults to ".tbss".
144 
145  /// StackMap section.
147 
148  /// EHFrameSection - EH frame section. It is initialized on demand so it
149  /// can be overwritten (with uniquing).
151 
152  /// ELF specific sections.
153  ///
161 
162  /// MachO specific sections.
163  ///
164 
165  /// TLSTLVSection - Section for thread local structure information.
166  /// Contains the source code name of the variable, visibility and a pointer
167  /// to the initial value (.tdata or .tbss).
168  const MCSection *TLSTLVSection; // Defaults to ".tlv".
169 
170  /// TLSThreadInitSection - Section for thread local data initialization
171  /// functions.
172  const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
173 
187 
188  /// COFF specific sections.
189  ///
193 
194 public:
196  MCContext &ctx);
197 
200  }
203  }
206  }
207 
208  unsigned getPersonalityEncoding() const { return PersonalityEncoding; }
209  unsigned getLSDAEncoding() const { return LSDAEncoding; }
210  unsigned getFDEEncoding(bool CFI) const {
211  return CFI ? FDECFIEncoding : FDEEncoding;
212  }
213  unsigned getTTypeEncoding() const { return TTypeEncoding; }
214 
217  }
218 
219  const MCSection *getTextSection() const { return TextSection; }
220  const MCSection *getDataSection() const { return DataSection; }
221  const MCSection *getBSSSection() const { return BSSSection; }
222  const MCSection *getLSDASection() const { return LSDASection; }
224  return CompactUnwindSection;
225  }
227  const MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
228  const MCSection *getDwarfLineSection() const { return DwarfLineSection; }
234  }
237  }
240  }
241  const MCSection *getDwarfStrSection() const { return DwarfStrSection; }
242  const MCSection *getDwarfLocSection() const { return DwarfLocSection; }
246  return DwarfMacroInfoSection;
247  }
248 
249  // DWARF5 Experimental Debug Info Sections
251  return DwarfAccelNamesSection;
252  }
254  return DwarfAccelObjCSection;
255  }
258  }
260  return DwarfAccelTypesSection;
261  }
263  return DwarfInfoDWOSection;
264  }
266  return DwarfAbbrevDWOSection;
267  }
269  return DwarfStrDWOSection;
270  }
272  return DwarfLineDWOSection;
273  }
275  return DwarfLocDWOSection;
276  }
278  return DwarfStrOffDWOSection;
279  }
281  return DwarfAddrSection;
282  }
283 
285  return TLSExtraDataSection;
286  }
287  const MCSection *getTLSDataSection() const { return TLSDataSection; }
288  const MCSection *getTLSBSSSection() const { return TLSBSSSection; }
289 
290  const MCSection *getStackMapSection() const { return StackMapSection; }
291 
292  /// ELF specific sections.
293  ///
294  const MCSection *getDataRelSection() const { return DataRelSection; }
296  return DataRelLocalSection;
297  }
298  const MCSection *getDataRelROSection() const { return DataRelROSection; }
300  return DataRelROLocalSection;
301  }
303  return MergeableConst4Section;
304  }
306  return MergeableConst8Section;
307  }
310  }
311 
312  /// MachO specific sections.
313  ///
314  const MCSection *getTLSTLVSection() const { return TLSTLVSection; }
316  return TLSThreadInitSection;
317  }
318  const MCSection *getCStringSection() const { return CStringSection; }
319  const MCSection *getUStringSection() const { return UStringSection; }
320  const MCSection *getTextCoalSection() const { return TextCoalSection; }
322  return ConstTextCoalSection;
323  }
324  const MCSection *getConstDataSection() const { return ConstDataSection; }
325  const MCSection *getDataCoalSection() const { return DataCoalSection; }
327  const MCSection *getDataBSSSection() const { return DataBSSSection; }
330  }
333  }
336  }
339  }
342  }
343 
344  /// COFF specific sections.
345  ///
346  const MCSection *getDrectveSection() const { return DrectveSection; }
347  const MCSection *getPDataSection() const { return PDataSection; }
348  const MCSection *getXDataSection() const { return XDataSection; }
349 
351  if (!EHFrameSection)
352  InitEHFrameSection();
353  return EHFrameSection;
354  }
355 
356 private:
357  enum Environment { IsMachO, IsELF, IsCOFF };
358  Environment Env;
359  Reloc::Model RelocM;
360  CodeModel::Model CMModel;
361  MCContext *Ctx;
362 
363  void InitMachOMCObjectFileInfo(Triple T);
364  void InitELFMCObjectFileInfo(Triple T);
365  void InitCOFFMCObjectFileInfo(Triple T);
366 
367  /// InitEHFrameSection - Initialize EHFrameSection on demand.
368  ///
369  void InitEHFrameSection();
370 };
371 
372 } // end namespace llvm
373 
374 #endif
const MCSection * getTLSExtraDataSection() const
const MCSection * NonLazySymbolPointerSection
const MCSection * DwarfARangesSection
const MCSection * DwarfFrameSection
const MCSection * getDwarfAccelNamesSection() const
const MCSection * getDwarfAbbrevSection() const
const MCSection * DataRelROSection
const MCSection * getDwarfMacroInfoSection() const
const MCSection * DwarfAbbrevDWOSection
const MCSection * DwarfStrDWOSection
const MCSection * getBSSSection() const
const MCSection * getDwarfLineDWOSection() const
const MCSection * getDwarfLineSection() const
const MCSection * DwarfAccelTypesSection
const MCSection * getConstDataSection() const
const MCSection * getDwarfRangesSection() const
const MCSection * getPDataSection() const
const MCSection * StaticDtorSection
const MCSection * getDrectveSection() const
const MCSection * ConstTextCoalSection
const MCSection * getFourByteConstantSection() const
const MCSection * getNonLazySymbolPointerSection() const
const MCSection * DataCoalSection
const MCSection * getTLSThreadInitSection() const
const MCSection * getSixteenByteConstantSection() const
const MCSection * getDataSection() const
const MCSection * DwarfStrSection
const MCSection * StackMapSection
StackMap section.
const MCSection * getEHFrameSection()
const MCSection * DataBSSSection
const MCSection * DwarfInfoSection
const MCSection * DwarfAccelNamespaceSection
const MCSection * getTLSBSSSection() const
const MCSection * DwarfAbbrevSection
const MCSection * EightByteConstantSection
const MCSection * getXDataSection() const
const MCSection * getDwarfLocSection() const
const MCSection * DataRelSection
const MCSection * getMergeableConst16Section() const
const MCSection * DwarfLocSection
const MCSection * getEightByteConstantSection() const
const MCSection * getDwarfStrDWOSection() const
const MCSection * DwarfPubNamesSection
const MCSection * getDwarfAccelObjCSection() const
unsigned getTTypeEncoding() const
const MCSection * getDwarfAccelNamespaceSection() const
const MCSection * DwarfDebugInlineSection
const MCSection * getMergeableConst8Section() const
const MCSection * getDwarfPubNamesSection() const
const MCSection * getDataRelLocalSection() const
const MCSection * getTextSection() const
const MCSection * DwarfMacroInfoSection
const MCSection * getTLSDataSection() const
const MCSection * DwarfLineSection
const MCSection * getTextCoalSection() const
const MCSection * getDataRelROSection() const
const MCSection * getUStringSection() const
bool getCommDirectiveSupportsAlignment() const
const MCSection * getConstTextCoalSection() const
const MCSection * LazySymbolPointerSection
const MCSection * DwarfGnuPubTypesSection
void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM, MCContext &ctx)
const MCSection * getDwarfGnuPubNamesSection() const
const MCSection * DwarfInfoDWOSection
These are used for the Fission separate debug information files.
const MCSection * getCompactUnwindSection() const
const MCSection * getDwarfInfoSection() const
const MCSection * MergeableConst8Section
const MCSection * XDataSection
bool isFunctionEHFrameSymbolPrivate() const
const MCSection * BSSSection
BSSSection - Section that is default initialized to zero.
const MCSection * getDataCommonSection() const
const MCSection * TextSection
const MCSection * DataRelLocalSection
unsigned getFDEEncoding(bool CFI) const
const MCSection * TLSExtraDataSection
const MCSection * getStackMapSection() const
const MCSection * DwarfPubTypesSection
const MCSection * LSDASection
const MCSection * getDwarfPubTypesSection() const
unsigned getLSDAEncoding() const
const MCSection * getDataRelROLocalSection() const
const MCSection * DwarfAccelObjCSection
const MCSection * DrectveSection
const MCSection * ReadOnlySection
const MCSection * getDwarfGnuPubTypesSection() const
const MCSection * getDwarfStrSection() const
unsigned getPersonalityEncoding() const
const MCSection * getDwarfInfoDWOSection() const
const MCSection * getLSDASection() const
const MCSection * CStringSection
const MCSection * TLSBSSSection
const MCSection * EHFrameSection
const MCSection * getDwarfStrOffDWOSection() const
const MCSection * getDataCoalSection() const
const MCSection * DataRelROLocalSection
const MCSection * SixteenByteConstantSection
const MCSection * getDwarfAddrSection() const
const MCSection * StaticCtorSection
const MCSection * getCStringSection() const
unsigned CompactUnwindDwarfEHFrameOnly
const MCSection * MergeableConst16Section
const MCSection * TLSTLVSection
const MCSection * TLSDataSection
const MCSection * FourByteConstantSection
const MCSection * TextCoalSection
const MCSection * DwarfLocDWOSection
const MCSection * DwarfLineDWOSection
const MCSection * DataSection
const MCSection * DwarfAddrSection
const MCSection * getDwarfARangesSection() const
const MCSection * getDwarfAccelTypesSection() const
const MCSection * UStringSection
#define CFI(x)
Definition: X86JITInfo.cpp:79
const MCSection * TLSThreadInitSection
const MCSection * getDataBSSSection() const
unsigned EHSectionType
Section flags for eh_frame.
const MCSection * CompactUnwindSection
const MCSection * getLazySymbolPointerSection() const
unsigned getCompactUnwindDwarfEHFrameOnly() const
const MCSection * DwarfGnuPubNamesSection
Sections for newer gnu pubnames and pubtypes.
const MCSection * DwarfAccelNamesSection
const MCSection * DwarfStrOffDWOSection
bool getSupportsWeakOmittedEHFrame() const
const MCSection * getMergeableConst4Section() const
const MCSection * getDwarfFrameSection() const
const MCSection * getDataRelSection() const
const MCSection * getDwarfLocDWOSection() const
const MCSection * MergeableConst4Section
const MCSection * ConstDataSection
const MCSection * PDataSection
const MCSection * getDwarfDebugInlineSection() const
const MCSection * getDwarfAbbrevDWOSection() const
const MCSection * DwarfRangesSection
const MCSection * DataCommonSection
const MCSection * getTLSTLVSection() const