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