-//===----------------------------------------------------------------------===//
-// MCSectionMachO
-//===----------------------------------------------------------------------===//
-
-/// SectionTypeDescriptors - These are strings that describe the various section
-/// types. This *must* be kept in order with and stay synchronized with the
-/// section type list.
-static const struct {
- const char *AssemblerName, *EnumName;
-} SectionTypeDescriptors[MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1] = {
- { "regular", "S_REGULAR" }, // 0x00
- { 0, "S_ZEROFILL" }, // 0x01
- { "cstring_literals", "S_CSTRING_LITERALS" }, // 0x02
- { "4byte_literals", "S_4BYTE_LITERALS" }, // 0x03
- { "8byte_literals", "S_8BYTE_LITERALS" }, // 0x04
- { "literal_pointers", "S_LITERAL_POINTERS" }, // 0x05
- { "non_lazy_symbol_pointers", "S_NON_LAZY_SYMBOL_POINTERS" }, // 0x06
- { "lazy_symbol_pointers", "S_LAZY_SYMBOL_POINTERS" }, // 0x07
- { "symbol_stubs", "S_SYMBOL_STUBS" }, // 0x08
- { "mod_init_funcs", "S_MOD_INIT_FUNC_POINTERS" }, // 0x09
- { "mod_term_funcs", "S_MOD_TERM_FUNC_POINTERS" }, // 0x0A
- { "coalesced", "S_COALESCED" }, // 0x0B
- { 0, /*FIXME??*/ "S_GB_ZEROFILL" }, // 0x0C
- { "interposing", "S_INTERPOSING" }, // 0x0D
- { "16byte_literals", "S_16BYTE_LITERALS" }, // 0x0E
- { 0, /*FIXME??*/ "S_DTRACE_DOF" }, // 0x0F
- { 0, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" } // 0x10
-};
-
-
-/// SectionAttrDescriptors - This is an array of descriptors for section
-/// attributes. Unlike the SectionTypeDescriptors, this is not directly indexed
-/// by attribute, instead it is searched. The last entry has a zero AttrFlag
-/// value.
-static const struct {
- unsigned AttrFlag;
- const char *AssemblerName, *EnumName;
-} SectionAttrDescriptors[] = {
-#define ENTRY(ASMNAME, ENUM) \
- { MCSectionMachO::ENUM, ASMNAME, #ENUM },
-ENTRY("pure_instructions", S_ATTR_PURE_INSTRUCTIONS)
-ENTRY("no_toc", S_ATTR_NO_TOC)
-ENTRY("strip_static_syms", S_ATTR_STRIP_STATIC_SYMS)
-ENTRY("no_dead_strip", S_ATTR_NO_DEAD_STRIP)
-ENTRY("live_support", S_ATTR_LIVE_SUPPORT)
-ENTRY("self_modifying_code", S_ATTR_SELF_MODIFYING_CODE)
-ENTRY("debug", S_ATTR_DEBUG)
-ENTRY(0 /*FIXME*/, S_ATTR_SOME_INSTRUCTIONS)
-ENTRY(0 /*FIXME*/, S_ATTR_EXT_RELOC)
-ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
-#undef ENTRY
- { 0, "none", 0 }
-};
-
-
-MCSectionMachO *MCSectionMachO::
-Create(const StringRef &Segment, const StringRef &Section,
- unsigned TypeAndAttributes, unsigned Reserved2,
- SectionKind K, MCContext &Ctx) {
- // S_SYMBOL_STUBS must be set for Reserved2 to be non-zero.
- return new (Ctx) MCSectionMachO(Segment, Section, TypeAndAttributes,
- Reserved2, K);
-}
-
-void MCSectionMachO::PrintSwitchToSection(const TargetAsmInfo &TAI,
- raw_ostream &OS) const {
- OS << "\t.section\t" << getSegmentName() << ',' << getSectionName();
-
- // Get the section type and attributes.
- unsigned TAA = getTypeAndAttributes();
- if (TAA == 0) {
- OS << '\n';
- return;