1e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//===-- llvm/MC/MCObjectFileInfo.h - Object File Info -----------*- C++ -*-===//
2e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//
3e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//                     The LLVM Compiler Infrastructure
4e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//
5e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng// This file is distributed under the University of Illinois Open Source
6e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng// License. See LICENSE.TXT for details.
7e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//
8e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//===----------------------------------------------------------------------===//
9e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//
10e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng// This file describes common object file formats.
11e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//
12e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng//===----------------------------------------------------------------------===//
13e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
14e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng#ifndef LLVM_MC_MCBJECTFILEINFO_H
15e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng#define LLVM_MC_MCBJECTFILEINFO_H
16e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
17f1d0f7781e766df878bec4e7977fa3204374f394Craig Topper#include "llvm/Support/CodeGen.h"
18e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
19e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Chengnamespace llvm {
200cb2a45cceaefb48ec7efb902c453aaae4e24cb2Anton Korobeynikov  class MCContext;
210cb2a45cceaefb48ec7efb902c453aaae4e24cb2Anton Korobeynikov  class MCSection;
22f1d0f7781e766df878bec4e7977fa3204374f394Craig Topper  class StringRef;
230cb2a45cceaefb48ec7efb902c453aaae4e24cb2Anton Korobeynikov  class Triple;
240cb2a45cceaefb48ec7efb902c453aaae4e24cb2Anton Korobeynikov
25e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Chengclass MCObjectFileInfo {
26e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Chengprotected:
27e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// CommDirectiveSupportsAlignment - True if .comm supports alignment.  This
28e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// is a hack for as long as we support 10.4 Tiger, whose assembler doesn't
29e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// support alignment on comm.
30e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  bool CommDirectiveSupportsAlignment;
31e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
32e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// SupportsWeakEmptyEHFrame - True if target object file supports a
33e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// weak_definition of constant 0 for an omitted EH frame.
34e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  bool SupportsWeakOmittedEHFrame;
35e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
36e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// IsFunctionEHFrameSymbolPrivate - This flag is set to true if the
37e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// "EH_frame" symbol for EH information should be an assembler temporary (aka
38e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// private linkage, aka an L or .L label) or false if it should be a normal
39e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// non-.globl label.  This defaults to true.
40e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  bool IsFunctionEHFrameSymbolPrivate;
41e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
42203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  /// PersonalityEncoding, LSDAEncoding, FDEEncoding, TTypeEncoding - Some
43203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  /// encoding values for EH.
44203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned PersonalityEncoding;
45203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned LSDAEncoding;
46203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned FDEEncoding;
47203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned FDECFIEncoding;
48203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned TTypeEncoding;
494cbcee16187ab07a70280fc10af327767325b848David Chisnall  // Section flags for eh_frame
50bce0de462f9510e57598aeae918d1e1cced718abDavid Chisnall  unsigned EHSectionType;
514cbcee16187ab07a70280fc10af327767325b848David Chisnall  unsigned EHSectionFlags;
52e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
53e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// TextSection - Section directive for standard text.
54e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
55e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TextSection;
56e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
57e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// DataSection - Section directive for standard data.
58e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
59e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataSection;
60e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
61e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// BSSSection - Section that is default initialized to zero.
62e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *BSSSection;
63e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
64e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// ReadOnlySection - Section that is readonly and can contain arbitrary
65e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// initialized data.  Targets are not required to have a readonly section.
66e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// If they don't, various bits of code will fall back to using the data
67e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// section for constants.
68e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *ReadOnlySection;
69e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
70e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// StaticCtorSection - This section contains the static constructor pointer
71e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// list.
72e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *StaticCtorSection;
73e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
74e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// StaticDtorSection - This section contains the static destructor pointer
75e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// list.
76e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *StaticDtorSection;
77e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
78e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// LSDASection - If exception handling is supported by the target, this is
79e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// the section the Language Specific Data Area information is emitted to.
80e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *LSDASection;
81e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
82e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// CompactUnwindSection - If exception handling is supported by the target
83e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// and the target can support a compact representation of the CIE and FDE,
84e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// this is the section to emit them into.
85e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *CompactUnwindSection;
86e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
8709ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  /// DwarfAccelNamesSection, DwarfAccelObjCSection
8809ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  /// If we use the DWARF accelerated hash tables then we want toe emit these
8909ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  /// sections.
9009ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *DwarfAccelNamesSection;
9109ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *DwarfAccelObjCSection;
9209ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *DwarfAccelNamespaceSection;
9309ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *DwarfAccelTypesSection;
9409ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher
95e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  // Dwarf sections for debug info.  If a target supports debug info, these must
96e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  // be set.
97e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfAbbrevSection;
98e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfInfoSection;
99e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfLineSection;
100e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfFrameSection;
101e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfPubTypesSection;
102e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfDebugInlineSection;
103e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfStrSection;
104e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfLocSection;
105e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfARangesSection;
106e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfRangesSection;
107e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DwarfMacroInfoSection;
108e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
109e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  // Extra TLS Variable Data section.  If the target needs to put additional
110e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  // information for a TLS variable, it'll go here.
111e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TLSExtraDataSection;
112e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
113e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// TLSDataSection - Section directive for Thread Local data.
114d4a19b6a72d19a6f90b676aac37118664b7b7a84Anton Korobeynikov  /// ELF, MachO and COFF.
115e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TLSDataSection;        // Defaults to ".tdata".
116e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
117e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// TLSBSSSection - Section directive for Thread Local uninitialized data.
118e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// Null if this target doesn't support a BSS section.
119e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// ELF and MachO only.
120e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TLSBSSSection;         // Defaults to ".tbss".
121e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
122e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
123e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// EHFrameSection - EH frame section. It is initialized on demand so it
124e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// can be overwritten (with uniquing).
125e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *EHFrameSection;
126e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
127e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// ELF specific sections.
128e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
129e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataRelSection;
130e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataRelLocalSection;
131e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataRelROSection;
132e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataRelROLocalSection;
133e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *MergeableConst4Section;
134e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *MergeableConst8Section;
135e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *MergeableConst16Section;
136e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
137e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// MachO specific sections.
138e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
139e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
140e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// TLSTLVSection - Section for thread local structure information.
141e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// Contains the source code name of the variable, visibility and a pointer
142e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// to the initial value (.tdata or .tbss).
143e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TLSTLVSection;         // Defaults to ".tlv".
144e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
145e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// TLSThreadInitSection - Section for thread local data initialization
146e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// functions.
147e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TLSThreadInitSection;  // Defaults to ".thread_init_func".
148e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
149e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *CStringSection;
150e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *UStringSection;
151e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *TextCoalSection;
152e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *ConstTextCoalSection;
153e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *ConstDataSection;
154e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataCoalSection;
155e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataCommonSection;
156e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DataBSSSection;
157e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *FourByteConstantSection;
158e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *EightByteConstantSection;
159e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *SixteenByteConstantSection;
160e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *LazySymbolPointerSection;
161e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *NonLazySymbolPointerSection;
162e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
163e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// COFF specific sections.
164e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
165e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *DrectveSection;
166e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *PDataSection;
167e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *XDataSection;
1680cb2a45cceaefb48ec7efb902c453aaae4e24cb2Anton Korobeynikov
169e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Chengpublic:
170203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM,
171203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng                            MCContext &ctx);
172e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
173e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  bool isFunctionEHFrameSymbolPrivate() const {
174e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return IsFunctionEHFrameSymbolPrivate;
175e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
176e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  bool getSupportsWeakOmittedEHFrame() const {
177e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return SupportsWeakOmittedEHFrame;
178e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
179e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  bool getCommDirectiveSupportsAlignment() const {
180e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return CommDirectiveSupportsAlignment;
181e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
182e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
183203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned getPersonalityEncoding() const { return PersonalityEncoding; }
184203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned getLSDAEncoding() const { return LSDAEncoding; }
185203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned getFDEEncoding(bool CFI) const {
186203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng    return CFI ? FDECFIEncoding : FDEEncoding;
187203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  }
188203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  unsigned getTTypeEncoding() const { return TTypeEncoding; }
189203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng
190e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTextSection() const { return TextSection; }
191e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataSection() const { return DataSection; }
192e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getBSSSection() const { return BSSSection; }
193e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getLSDASection() const { return LSDASection; }
194e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getCompactUnwindSection() const{
195e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return CompactUnwindSection;
196e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
19709ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *getDwarfAccelNamesSection() const {
19809ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher    return DwarfAccelNamesSection;
19909ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  }
20009ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *getDwarfAccelObjCSection() const {
20109ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher    return DwarfAccelObjCSection;
20209ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  }
20309ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *getDwarfAccelNamespaceSection() const {
20409ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher    return DwarfAccelNamespaceSection;
20509ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  }
20609ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  const MCSection *getDwarfAccelTypesSection() const {
20709ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher    return DwarfAccelTypesSection;
20809ac3d841367d5d56328eade506c951e0dc3a72dEric Christopher  }
209e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
210e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
211e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfLineSection() const { return DwarfLineSection; }
212e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfFrameSection() const { return DwarfFrameSection; }
213e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfPubTypesSection() const{return DwarfPubTypesSection;}
214e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfDebugInlineSection() const {
215e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return DwarfDebugInlineSection;
216e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
217e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfStrSection() const { return DwarfStrSection; }
218e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfLocSection() const { return DwarfLocSection; }
219e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfARangesSection() const { return DwarfARangesSection;}
220e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfRangesSection() const { return DwarfRangesSection; }
221e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDwarfMacroInfoSection() const {
222e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return DwarfMacroInfoSection;
223e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
224e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTLSExtraDataSection() const {
225e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return TLSExtraDataSection;
226e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
227e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTLSDataSection() const { return TLSDataSection; }
228e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTLSBSSSection() const { return TLSBSSSection; }
229e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
230e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// ELF specific sections.
231e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
232e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataRelSection() const { return DataRelSection; }
233e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataRelLocalSection() const {
234e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return DataRelLocalSection;
235e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
236e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataRelROSection() const { return DataRelROSection; }
237e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataRelROLocalSection() const {
238e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return DataRelROLocalSection;
239e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
240e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getMergeableConst4Section() const {
241e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return MergeableConst4Section;
242e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
243e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getMergeableConst8Section() const {
244e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return MergeableConst8Section;
245e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
246e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getMergeableConst16Section() const {
247e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return MergeableConst16Section;
248e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
249e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
250e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// MachO specific sections.
251e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
252e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTLSTLVSection() const { return TLSTLVSection; }
253e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTLSThreadInitSection() const {
254e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return TLSThreadInitSection;
255e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
256e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getCStringSection() const { return CStringSection; }
257e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getUStringSection() const { return UStringSection; }
258e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getTextCoalSection() const { return TextCoalSection; }
259e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getConstTextCoalSection() const {
260e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return ConstTextCoalSection;
261e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
262e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getConstDataSection() const { return ConstDataSection; }
263e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataCoalSection() const { return DataCoalSection; }
264e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataCommonSection() const { return DataCommonSection; }
265e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDataBSSSection() const { return DataBSSSection; }
266e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getFourByteConstantSection() const {
267e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return FourByteConstantSection;
268e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
269e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getEightByteConstantSection() const {
270e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return EightByteConstantSection;
271e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
272e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getSixteenByteConstantSection() const {
273e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return SixteenByteConstantSection;
274e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
275e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getLazySymbolPointerSection() const {
276e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return LazySymbolPointerSection;
277e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
278e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getNonLazySymbolPointerSection() const {
279e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return NonLazySymbolPointerSection;
280e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
281e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
282e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  /// COFF specific sections.
283e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  ///
284e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getDrectveSection() const { return DrectveSection; }
285e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getPDataSection() const { return PDataSection; }
286e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getXDataSection() const { return XDataSection; }
287e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
288e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  const MCSection *getEHFrameSection() {
2898bb51ef6d2a396715f1dbc6edc1599892779e4d6David Chisnall    if (!EHFrameSection)
2908bb51ef6d2a396715f1dbc6edc1599892779e4d6David Chisnall      InitEHFrameSection();
291e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng    return EHFrameSection;
292e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  }
293e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
294e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Chengprivate:
295e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  enum Environment { IsMachO, IsELF, IsCOFF };
296e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  Environment Env;
297e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  Reloc::Model RelocM;
298203576aa0cb9d8bf2d2e4d910ebab4b7a63262aeEvan Cheng  CodeModel::Model CMModel;
299e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  MCContext *Ctx;
300e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
301e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  void InitMachOMCObjectFileInfo(Triple T);
302e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  void InitELFMCObjectFileInfo(Triple T);
303e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng  void InitCOFFMCObjectFileInfo(Triple T);
304e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
3058bb51ef6d2a396715f1dbc6edc1599892779e4d6David Chisnall  /// InitEHFrameSection - Initialize EHFrameSection on demand.
3068bb51ef6d2a396715f1dbc6edc1599892779e4d6David Chisnall  ///
3078bb51ef6d2a396715f1dbc6edc1599892779e4d6David Chisnall  void InitEHFrameSection();
308e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng};
309e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
310e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng} // end namespace llvm
311e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng
312e76a33b9567d78a5744dc52fcec3a6056d6fb576Evan Cheng#endif
313