llvm.org GIT mirror llvm / 508e0c4
MC: Remove superfluous section attribute flag definitions Summary: llvm/MC/MCSectionMachO.h and llvm/Support/MachO.h both had the same definitions for the section flags. Instead, grab the definitions out of support. No functionality change. Reviewers: grosbach, Bigcheese, rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2998 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203211 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 5 years ago
12 changed file(s) with 152 addition(s) and 240 deletion(s). Raw diff Collapse all Expand all
1515
1616 #include "llvm/ADT/StringRef.h"
1717 #include "llvm/MC/MCSection.h"
18 #include "llvm/Support/MachO.h"
1819
1920 namespace llvm {
2021
3738 unsigned TAA, unsigned reserved2, SectionKind K);
3839 friend class MCContext;
3940 public:
40
41 /// These are the section type and attributes fields. A MachO section can
42 /// have only one Type, but can have any of the attributes specified.
43 enum : uint32_t {
44 // TypeAndAttributes bitmasks.
45 SECTION_TYPE = 0x000000FFU,
46 SECTION_ATTRIBUTES = 0xFFFFFF00U,
47
48 // Valid section types.
49
50 /// S_REGULAR - Regular section.
51 S_REGULAR = 0x00U,
52 /// S_ZEROFILL - Zero fill on demand section.
53 S_ZEROFILL = 0x01U,
54 /// S_CSTRING_LITERALS - Section with literal C strings.
55 S_CSTRING_LITERALS = 0x02U,
56 /// S_4BYTE_LITERALS - Section with 4 byte literals.
57 S_4BYTE_LITERALS = 0x03U,
58 /// S_8BYTE_LITERALS - Section with 8 byte literals.
59 S_8BYTE_LITERALS = 0x04U,
60 /// S_LITERAL_POINTERS - Section with pointers to literals.
61 S_LITERAL_POINTERS = 0x05U,
62 /// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
63 S_NON_LAZY_SYMBOL_POINTERS = 0x06U,
64 /// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
65 S_LAZY_SYMBOL_POINTERS = 0x07U,
66 /// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
67 /// the Reserved2 field.
68 S_SYMBOL_STUBS = 0x08U,
69 /// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
70 /// initialization.
71 S_MOD_INIT_FUNC_POINTERS = 0x09U,
72 /// S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for
73 /// termination.
74 S_MOD_TERM_FUNC_POINTERS = 0x0AU,
75 /// S_COALESCED - Section contains symbols that are to be coalesced.
76 S_COALESCED = 0x0BU,
77 /// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
78 /// gigabytes).
79 S_GB_ZEROFILL = 0x0CU,
80 /// S_INTERPOSING - Section with only pairs of function pointers for
81 /// interposing.
82 S_INTERPOSING = 0x0DU,
83 /// S_16BYTE_LITERALS - Section with only 16 byte literals.
84 S_16BYTE_LITERALS = 0x0EU,
85 /// S_DTRACE_DOF - Section contains DTrace Object Format.
86 S_DTRACE_DOF = 0x0FU,
87 /// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
88 /// lazy loaded dylibs.
89 S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10U,
90 /// S_THREAD_LOCAL_REGULAR - Section with ....
91 S_THREAD_LOCAL_REGULAR = 0x11U,
92 /// S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
93 S_THREAD_LOCAL_ZEROFILL = 0x12U,
94 /// S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure
95 /// data.
96 S_THREAD_LOCAL_VARIABLES = 0x13U,
97 /// S_THREAD_LOCAL_VARIABLE_POINTERS - Section with ....
98 S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14U,
99 /// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
100 /// variable initialization pointers to functions.
101 S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15U,
102
103 LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
104
105
106 // Valid section attributes.
107
108 /// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
109 /// instructions.
110 S_ATTR_PURE_INSTRUCTIONS = 1U << 31,
111 /// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
112 /// in a ranlib table of contents.
113 S_ATTR_NO_TOC = 1U << 30,
114 /// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
115 /// in files with the MY_DYLDLINK flag.
116 S_ATTR_STRIP_STATIC_SYMS = 1U << 29,
117 /// S_ATTR_NO_DEAD_STRIP - No dead stripping.
118 S_ATTR_NO_DEAD_STRIP = 1U << 28,
119 /// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
120 S_ATTR_LIVE_SUPPORT = 1U << 27,
121 /// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
122 /// dyld.
123 S_ATTR_SELF_MODIFYING_CODE = 1U << 26,
124 /// S_ATTR_DEBUG - A debug section.
125 S_ATTR_DEBUG = 1U << 25,
126 /// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
127 S_ATTR_SOME_INSTRUCTIONS = 1U << 10,
128 /// S_ATTR_EXT_RELOC - Section has external relocation entries.
129 S_ATTR_EXT_RELOC = 1U << 9,
130 /// S_ATTR_LOC_RELOC - Section has local relocation entries.
131 S_ATTR_LOC_RELOC = 1U << 8
132 };
13341
13442 StringRef getSegmentName() const {
13543 // SegmentName is not necessarily null terminated!
15563 unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
15664 unsigned getStubSize() const { return Reserved2; }
15765
158 unsigned getType() const { return TypeAndAttributes & SECTION_TYPE; }
66 unsigned getType() const { return TypeAndAttributes & MachO::SECTION_TYPE; }
15967 bool hasAttribute(unsigned Value) const {
16068 return (TypeAndAttributes & Value) != 0;
16169 }
146146 SECTION_ATTRIBUTES_SYS = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
147147 };
148148
149 enum SectionType {
149 /// These are the section type and attributes fields. A MachO section can
150 /// have only one Type, but can have any of the attributes specified.
151 enum SectionType : uint32_t {
150152 // Constant masks for the "flags[7:0]" field in llvm::MachO::section and
151153 // llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
152154 S_REGULAR = 0x00u,
170172 S_THREAD_LOCAL_ZEROFILL = 0x12u,
171173 S_THREAD_LOCAL_VARIABLES = 0x13u,
172174 S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14u,
173 S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u
175 S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u,
176
177 LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
174178 };
175179
176180 enum : uint32_t {
547547
548548 // These sections are atomized at the element boundaries without using
549549 // symbols.
550 case MCSectionMachO::S_4BYTE_LITERALS:
551 case MCSectionMachO::S_8BYTE_LITERALS:
552 case MCSectionMachO::S_16BYTE_LITERALS:
553 case MCSectionMachO::S_LITERAL_POINTERS:
554 case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:
555 case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:
556 case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:
557 case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:
558 case MCSectionMachO::S_INTERPOSING:
550 case MachO::S_4BYTE_LITERALS:
551 case MachO::S_8BYTE_LITERALS:
552 case MachO::S_16BYTE_LITERALS:
553 case MachO::S_LITERAL_POINTERS:
554 case MachO::S_NON_LAZY_SYMBOL_POINTERS:
555 case MachO::S_LAZY_SYMBOL_POINTERS:
556 case MachO::S_MOD_INIT_FUNC_POINTERS:
557 case MachO::S_MOD_TERM_FUNC_POINTERS:
558 case MachO::S_INTERPOSING:
559559 return false;
560560 }
561561 }
3333
3434 TextSection // .text
3535 = Ctx->getMachOSection("__TEXT", "__text",
36 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
36 MachO::S_ATTR_PURE_INSTRUCTIONS,
3737 SectionKind::getText());
3838 DataSection // .data
3939 = Ctx->getMachOSection("__DATA", "__data", 0,
4444
4545 TLSDataSection // .tdata
4646 = Ctx->getMachOSection("__DATA", "__thread_data",
47 MCSectionMachO::S_THREAD_LOCAL_REGULAR,
47 MachO::S_THREAD_LOCAL_REGULAR,
4848 SectionKind::getDataRel());
4949 TLSBSSSection // .tbss
5050 = Ctx->getMachOSection("__DATA", "__thread_bss",
51 MCSectionMachO::S_THREAD_LOCAL_ZEROFILL,
51 MachO::S_THREAD_LOCAL_ZEROFILL,
5252 SectionKind::getThreadBSS());
5353
5454 // TODO: Verify datarel below.
5555 TLSTLVSection // .tlv
5656 = Ctx->getMachOSection("__DATA", "__thread_vars",
57 MCSectionMachO::S_THREAD_LOCAL_VARIABLES,
57 MachO::S_THREAD_LOCAL_VARIABLES,
5858 SectionKind::getDataRel());
5959
6060 TLSThreadInitSection
6161 = Ctx->getMachOSection("__DATA", "__thread_init",
62 MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
62 MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
6363 SectionKind::getDataRel());
6464
6565 CStringSection // .cstring
6666 = Ctx->getMachOSection("__TEXT", "__cstring",
67 MCSectionMachO::S_CSTRING_LITERALS,
67 MachO::S_CSTRING_LITERALS,
6868 SectionKind::getMergeable1ByteCString());
6969 UStringSection
7070 = Ctx->getMachOSection("__TEXT","__ustring", 0,
7171 SectionKind::getMergeable2ByteCString());
7272 FourByteConstantSection // .literal4
7373 = Ctx->getMachOSection("__TEXT", "__literal4",
74 MCSectionMachO::S_4BYTE_LITERALS,
74 MachO::S_4BYTE_LITERALS,
7575 SectionKind::getMergeableConst4());
7676 EightByteConstantSection // .literal8
7777 = Ctx->getMachOSection("__TEXT", "__literal8",
78 MCSectionMachO::S_8BYTE_LITERALS,
78 MachO::S_8BYTE_LITERALS,
7979 SectionKind::getMergeableConst8());
8080
8181 SixteenByteConstantSection // .literal16
8282 = Ctx->getMachOSection("__TEXT", "__literal16",
83 MCSectionMachO::S_16BYTE_LITERALS,
83 MachO::S_16BYTE_LITERALS,
8484 SectionKind::getMergeableConst16());
8585
8686 ReadOnlySection // .const
8989
9090 TextCoalSection
9191 = Ctx->getMachOSection("__TEXT", "__textcoal_nt",
92 MCSectionMachO::S_COALESCED |
93 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
92 MachO::S_COALESCED |
93 MachO::S_ATTR_PURE_INSTRUCTIONS,
9494 SectionKind::getText());
9595 ConstTextCoalSection
9696 = Ctx->getMachOSection("__TEXT", "__const_coal",
97 MCSectionMachO::S_COALESCED,
97 MachO::S_COALESCED,
9898 SectionKind::getReadOnly());
9999 ConstDataSection // .const_data
100100 = Ctx->getMachOSection("__DATA", "__const", 0,
101101 SectionKind::getReadOnlyWithRel());
102102 DataCoalSection
103103 = Ctx->getMachOSection("__DATA","__datacoal_nt",
104 MCSectionMachO::S_COALESCED,
104 MachO::S_COALESCED,
105105 SectionKind::getDataRel());
106106 DataCommonSection
107107 = Ctx->getMachOSection("__DATA","__common",
108 MCSectionMachO::S_ZEROFILL,
108 MachO::S_ZEROFILL,
109109 SectionKind::getBSS());
110110 DataBSSSection
111 = Ctx->getMachOSection("__DATA","__bss", MCSectionMachO::S_ZEROFILL,
111 = Ctx->getMachOSection("__DATA","__bss", MachO::S_ZEROFILL,
112112 SectionKind::getBSS());
113113
114114
115115 LazySymbolPointerSection
116116 = Ctx->getMachOSection("__DATA", "__la_symbol_ptr",
117 MCSectionMachO::S_LAZY_SYMBOL_POINTERS,
117 MachO::S_LAZY_SYMBOL_POINTERS,
118118 SectionKind::getMetadata());
119119 NonLazySymbolPointerSection
120120 = Ctx->getMachOSection("__DATA", "__nl_symbol_ptr",
121 MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
121 MachO::S_NON_LAZY_SYMBOL_POINTERS,
122122 SectionKind::getMetadata());
123123
124124 if (RelocM == Reloc::Static) {
131131 } else {
132132 StaticCtorSection
133133 = Ctx->getMachOSection("__DATA", "__mod_init_func",
134 MCSectionMachO::S_MOD_INIT_FUNC_POINTERS,
134 MachO::S_MOD_INIT_FUNC_POINTERS,
135135 SectionKind::getDataRel());
136136 StaticDtorSection
137137 = Ctx->getMachOSection("__DATA", "__mod_term_func",
138 MCSectionMachO::S_MOD_TERM_FUNC_POINTERS,
138 MachO::S_MOD_TERM_FUNC_POINTERS,
139139 SectionKind::getDataRel());
140140 }
141141
148148 if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6)) {
149149 CompactUnwindSection =
150150 Ctx->getMachOSection("__LD", "__compact_unwind",
151 MCSectionMachO::S_ATTR_DEBUG,
151 MachO::S_ATTR_DEBUG,
152152 SectionKind::getReadOnly());
153153
154154 if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
158158 // Debug Information.
159159 DwarfAccelNamesSection =
160160 Ctx->getMachOSection("__DWARF", "__apple_names",
161 MCSectionMachO::S_ATTR_DEBUG,
161 MachO::S_ATTR_DEBUG,
162162 SectionKind::getMetadata());
163163 DwarfAccelObjCSection =
164164 Ctx->getMachOSection("__DWARF", "__apple_objc",
165 MCSectionMachO::S_ATTR_DEBUG,
165 MachO::S_ATTR_DEBUG,
166166 SectionKind::getMetadata());
167167 // 16 character section limit...
168168 DwarfAccelNamespaceSection =
169169 Ctx->getMachOSection("__DWARF", "__apple_namespac",
170 MCSectionMachO::S_ATTR_DEBUG,
170 MachO::S_ATTR_DEBUG,
171171 SectionKind::getMetadata());
172172 DwarfAccelTypesSection =
173173 Ctx->getMachOSection("__DWARF", "__apple_types",
174 MCSectionMachO::S_ATTR_DEBUG,
174 MachO::S_ATTR_DEBUG,
175175 SectionKind::getMetadata());
176176
177177 DwarfAbbrevSection =
178178 Ctx->getMachOSection("__DWARF", "__debug_abbrev",
179 MCSectionMachO::S_ATTR_DEBUG,
179 MachO::S_ATTR_DEBUG,
180180 SectionKind::getMetadata());
181181 DwarfInfoSection =
182182 Ctx->getMachOSection("__DWARF", "__debug_info",
183 MCSectionMachO::S_ATTR_DEBUG,
183 MachO::S_ATTR_DEBUG,
184184 SectionKind::getMetadata());
185185 DwarfLineSection =
186186 Ctx->getMachOSection("__DWARF", "__debug_line",
187 MCSectionMachO::S_ATTR_DEBUG,
187 MachO::S_ATTR_DEBUG,
188188 SectionKind::getMetadata());
189189 DwarfFrameSection =
190190 Ctx->getMachOSection("__DWARF", "__debug_frame",
191 MCSectionMachO::S_ATTR_DEBUG,
191 MachO::S_ATTR_DEBUG,
192192 SectionKind::getMetadata());
193193 DwarfPubNamesSection =
194194 Ctx->getMachOSection("__DWARF", "__debug_pubnames",
195 MCSectionMachO::S_ATTR_DEBUG,
195 MachO::S_ATTR_DEBUG,
196196 SectionKind::getMetadata());
197197 DwarfPubTypesSection =
198198 Ctx->getMachOSection("__DWARF", "__debug_pubtypes",
199 MCSectionMachO::S_ATTR_DEBUG,
199 MachO::S_ATTR_DEBUG,
200200 SectionKind::getMetadata());
201201 DwarfGnuPubNamesSection =
202202 Ctx->getMachOSection("__DWARF", "__debug_gnu_pubn",
203 MCSectionMachO::S_ATTR_DEBUG,
203 MachO::S_ATTR_DEBUG,
204204 SectionKind::getMetadata());
205205 DwarfGnuPubTypesSection =
206206 Ctx->getMachOSection("__DWARF", "__debug_gnu_pubt",
207 MCSectionMachO::S_ATTR_DEBUG,
207 MachO::S_ATTR_DEBUG,
208208 SectionKind::getMetadata());
209209 DwarfStrSection =
210210 Ctx->getMachOSection("__DWARF", "__debug_str",
211 MCSectionMachO::S_ATTR_DEBUG,
211 MachO::S_ATTR_DEBUG,
212212 SectionKind::getMetadata());
213213 DwarfLocSection =
214214 Ctx->getMachOSection("__DWARF", "__debug_loc",
215 MCSectionMachO::S_ATTR_DEBUG,
215 MachO::S_ATTR_DEBUG,
216216 SectionKind::getMetadata());
217217 DwarfARangesSection =
218218 Ctx->getMachOSection("__DWARF", "__debug_aranges",
219 MCSectionMachO::S_ATTR_DEBUG,
219 MachO::S_ATTR_DEBUG,
220220 SectionKind::getMetadata());
221221 DwarfRangesSection =
222222 Ctx->getMachOSection("__DWARF", "__debug_ranges",
223 MCSectionMachO::S_ATTR_DEBUG,
223 MachO::S_ATTR_DEBUG,
224224 SectionKind::getMetadata());
225225 DwarfMacroInfoSection =
226226 Ctx->getMachOSection("__DWARF", "__debug_macinfo",
227 MCSectionMachO::S_ATTR_DEBUG,
227 MachO::S_ATTR_DEBUG,
228228 SectionKind::getMetadata());
229229 DwarfDebugInlineSection =
230230 Ctx->getMachOSection("__DWARF", "__debug_inlined",
231 MCSectionMachO::S_ATTR_DEBUG,
231 MachO::S_ATTR_DEBUG,
232232 SectionKind::getMetadata());
233233 StackMapSection =
234234 Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps", 0,
764764 if (Env == IsMachO)
765765 EHFrameSection =
766766 Ctx->getMachOSection("__TEXT", "__eh_frame",
767 MCSectionMachO::S_COALESCED |
768 MCSectionMachO::S_ATTR_NO_TOC |
769 MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
770 MCSectionMachO::S_ATTR_LIVE_SUPPORT,
767 MachO::S_COALESCED |
768 MachO::S_ATTR_NO_TOC |
769 MachO::S_ATTR_STRIP_STATIC_SYMS |
770 MachO::S_ATTR_LIVE_SUPPORT,
771771 SectionKind::getReadOnly());
772772 else if (Env == IsELF)
773773 EHFrameSection =
194194 }
195195 bool ParseSectionDirectiveCString(StringRef, SMLoc) {
196196 return ParseSectionSwitch("__TEXT","__cstring",
197 MCSectionMachO::S_CSTRING_LITERALS);
197 MachO::S_CSTRING_LITERALS);
198198 }
199199 bool ParseSectionDirectiveLiteral4(StringRef, SMLoc) {
200200 return ParseSectionSwitch("__TEXT", "__literal4",
201 MCSectionMachO::S_4BYTE_LITERALS, 4);
201 MachO::S_4BYTE_LITERALS, 4);
202202 }
203203 bool ParseSectionDirectiveLiteral8(StringRef, SMLoc) {
204204 return ParseSectionSwitch("__TEXT", "__literal8",
205 MCSectionMachO::S_8BYTE_LITERALS, 8);
205 MachO::S_8BYTE_LITERALS, 8);
206206 }
207207 bool ParseSectionDirectiveLiteral16(StringRef, SMLoc) {
208208 return ParseSectionSwitch("__TEXT","__literal16",
209 MCSectionMachO::S_16BYTE_LITERALS, 16);
209 MachO::S_16BYTE_LITERALS, 16);
210210 }
211211 bool ParseSectionDirectiveConstructor(StringRef, SMLoc) {
212212 return ParseSectionSwitch("__TEXT","__constructor");
222222 }
223223 bool ParseSectionDirectiveSymbolStub(StringRef, SMLoc) {
224224 return ParseSectionSwitch("__TEXT","__symbol_stub",
225 MCSectionMachO::S_SYMBOL_STUBS |
226 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
225 MachO::S_SYMBOL_STUBS |
226 MachO::S_ATTR_PURE_INSTRUCTIONS,
227227 // FIXME: Different on PPC and ARM.
228228 0, 16);
229229 }
230230 bool ParseSectionDirectivePICSymbolStub(StringRef, SMLoc) {
231231 return ParseSectionSwitch("__TEXT","__picsymbol_stub",
232 MCSectionMachO::S_SYMBOL_STUBS |
233 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26);
232 MachO::S_SYMBOL_STUBS |
233 MachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26);
234234 }
235235 bool ParseSectionDirectiveData(StringRef, SMLoc) {
236236 return ParseSectionSwitch("__DATA", "__data");
240240 }
241241 bool ParseSectionDirectiveNonLazySymbolPointers(StringRef, SMLoc) {
242242 return ParseSectionSwitch("__DATA", "__nl_symbol_ptr",
243 MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS, 4);
243 MachO::S_NON_LAZY_SYMBOL_POINTERS, 4);
244244 }
245245 bool ParseSectionDirectiveLazySymbolPointers(StringRef, SMLoc) {
246246 return ParseSectionSwitch("__DATA", "__la_symbol_ptr",
247 MCSectionMachO::S_LAZY_SYMBOL_POINTERS, 4);
247 MachO::S_LAZY_SYMBOL_POINTERS, 4);
248248 }
249249 bool ParseSectionDirectiveDyld(StringRef, SMLoc) {
250250 return ParseSectionSwitch("__DATA", "__dyld");
251251 }
252252 bool ParseSectionDirectiveModInitFunc(StringRef, SMLoc) {
253253 return ParseSectionSwitch("__DATA", "__mod_init_func",
254 MCSectionMachO::S_MOD_INIT_FUNC_POINTERS, 4);
254 MachO::S_MOD_INIT_FUNC_POINTERS, 4);
255255 }
256256 bool ParseSectionDirectiveModTermFunc(StringRef, SMLoc) {
257257 return ParseSectionSwitch("__DATA", "__mod_term_func",
258 MCSectionMachO::S_MOD_TERM_FUNC_POINTERS, 4);
258 MachO::S_MOD_TERM_FUNC_POINTERS, 4);
259259 }
260260 bool ParseSectionDirectiveConstData(StringRef, SMLoc) {
261261 return ParseSectionSwitch("__DATA", "__const");
262262 }
263263 bool ParseSectionDirectiveObjCClass(StringRef, SMLoc) {
264264 return ParseSectionSwitch("__OBJC", "__class",
265 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
265 MachO::S_ATTR_NO_DEAD_STRIP);
266266 }
267267 bool ParseSectionDirectiveObjCMetaClass(StringRef, SMLoc) {
268268 return ParseSectionSwitch("__OBJC", "__meta_class",
269 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
269 MachO::S_ATTR_NO_DEAD_STRIP);
270270 }
271271 bool ParseSectionDirectiveObjCCatClsMeth(StringRef, SMLoc) {
272272 return ParseSectionSwitch("__OBJC", "__cat_cls_meth",
273 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
273 MachO::S_ATTR_NO_DEAD_STRIP);
274274 }
275275 bool ParseSectionDirectiveObjCCatInstMeth(StringRef, SMLoc) {
276276 return ParseSectionSwitch("__OBJC", "__cat_inst_meth",
277 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
277 MachO::S_ATTR_NO_DEAD_STRIP);
278278 }
279279 bool ParseSectionDirectiveObjCProtocol(StringRef, SMLoc) {
280280 return ParseSectionSwitch("__OBJC", "__protocol",
281 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
281 MachO::S_ATTR_NO_DEAD_STRIP);
282282 }
283283 bool ParseSectionDirectiveObjCStringObject(StringRef, SMLoc) {
284284 return ParseSectionSwitch("__OBJC", "__string_object",
285 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
285 MachO::S_ATTR_NO_DEAD_STRIP);
286286 }
287287 bool ParseSectionDirectiveObjCClsMeth(StringRef, SMLoc) {
288288 return ParseSectionSwitch("__OBJC", "__cls_meth",
289 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
289 MachO::S_ATTR_NO_DEAD_STRIP);
290290 }
291291 bool ParseSectionDirectiveObjCInstMeth(StringRef, SMLoc) {
292292 return ParseSectionSwitch("__OBJC", "__inst_meth",
293 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
293 MachO::S_ATTR_NO_DEAD_STRIP);
294294 }
295295 bool ParseSectionDirectiveObjCClsRefs(StringRef, SMLoc) {
296296 return ParseSectionSwitch("__OBJC", "__cls_refs",
297 MCSectionMachO::S_ATTR_NO_DEAD_STRIP |
298 MCSectionMachO::S_LITERAL_POINTERS, 4);
297 MachO::S_ATTR_NO_DEAD_STRIP |
298 MachO::S_LITERAL_POINTERS, 4);
299299 }
300300 bool ParseSectionDirectiveObjCMessageRefs(StringRef, SMLoc) {
301301 return ParseSectionSwitch("__OBJC", "__message_refs",
302 MCSectionMachO::S_ATTR_NO_DEAD_STRIP |
303 MCSectionMachO::S_LITERAL_POINTERS, 4);
302 MachO::S_ATTR_NO_DEAD_STRIP |
303 MachO::S_LITERAL_POINTERS, 4);
304304 }
305305 bool ParseSectionDirectiveObjCSymbols(StringRef, SMLoc) {
306306 return ParseSectionSwitch("__OBJC", "__symbols",
307 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
307 MachO::S_ATTR_NO_DEAD_STRIP);
308308 }
309309 bool ParseSectionDirectiveObjCCategory(StringRef, SMLoc) {
310310 return ParseSectionSwitch("__OBJC", "__category",
311 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
311 MachO::S_ATTR_NO_DEAD_STRIP);
312312 }
313313 bool ParseSectionDirectiveObjCClassVars(StringRef, SMLoc) {
314314 return ParseSectionSwitch("__OBJC", "__class_vars",
315 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
315 MachO::S_ATTR_NO_DEAD_STRIP);
316316 }
317317 bool ParseSectionDirectiveObjCInstanceVars(StringRef, SMLoc) {
318318 return ParseSectionSwitch("__OBJC", "__instance_vars",
319 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
319 MachO::S_ATTR_NO_DEAD_STRIP);
320320 }
321321 bool ParseSectionDirectiveObjCModuleInfo(StringRef, SMLoc) {
322322 return ParseSectionSwitch("__OBJC", "__module_info",
323 MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
323 MachO::S_ATTR_NO_DEAD_STRIP);
324324 }
325325 bool ParseSectionDirectiveObjCClassNames(StringRef, SMLoc) {
326326 return ParseSectionSwitch("__TEXT", "__cstring",
327 MCSectionMachO::S_CSTRING_LITERALS);
327 MachO::S_CSTRING_LITERALS);
328328 }
329329 bool ParseSectionDirectiveObjCMethVarTypes(StringRef, SMLoc) {
330330 return ParseSectionSwitch("__TEXT", "__cstring",
331 MCSectionMachO::S_CSTRING_LITERALS);
331 MachO::S_CSTRING_LITERALS);
332332 }
333333 bool ParseSectionDirectiveObjCMethVarNames(StringRef, SMLoc) {
334334 return ParseSectionSwitch("__TEXT", "__cstring",
335 MCSectionMachO::S_CSTRING_LITERALS);
335 MachO::S_CSTRING_LITERALS);
336336 }
337337 bool ParseSectionDirectiveObjCSelectorStrs(StringRef, SMLoc) {
338338 return ParseSectionSwitch("__OBJC", "__selector_strs",
339 MCSectionMachO::S_CSTRING_LITERALS);
339 MachO::S_CSTRING_LITERALS);
340340 }
341341 bool ParseSectionDirectiveTData(StringRef, SMLoc) {
342342 return ParseSectionSwitch("__DATA", "__thread_data",
343 MCSectionMachO::S_THREAD_LOCAL_REGULAR);
343 MachO::S_THREAD_LOCAL_REGULAR);
344344 }
345345 bool ParseSectionDirectiveText(StringRef, SMLoc) {
346346 return ParseSectionSwitch("__TEXT", "__text",
347 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS);
347 MachO::S_ATTR_PURE_INSTRUCTIONS);
348348 }
349349 bool ParseSectionDirectiveTLV(StringRef, SMLoc) {
350350 return ParseSectionSwitch("__DATA", "__thread_vars",
351 MCSectionMachO::S_THREAD_LOCAL_VARIABLES);
351 MachO::S_THREAD_LOCAL_VARIABLES);
352352 }
353353 bool ParseSectionDirectiveIdent(StringRef, SMLoc) {
354354 // Darwin silently ignores the .ident directive.
357357 }
358358 bool ParseSectionDirectiveThreadInitFunc(StringRef, SMLoc) {
359359 return ParseSectionSwitch("__DATA", "__thread_init",
360 MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
360 MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
361361 }
362362
363363 };
373373 Lex();
374374
375375 // FIXME: Arch specific.
376 bool isText = TAA & MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS;
376 bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS;
377377 getStreamer().SwitchSection(getContext().getMachOSection(
378378 Segment, Section, TAA, StubSize,
379379 isText ? SectionKind::getText()
428428 const MCSectionMachO *Current = static_cast(
429429 getStreamer().getCurrentSection().first);
430430 unsigned SectionType = Current->getType();
431 if (SectionType != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS &&
432 SectionType != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
433 SectionType != MCSectionMachO::S_SYMBOL_STUBS)
431 if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
432 SectionType != MachO::S_LAZY_SYMBOL_POINTERS &&
433 SectionType != MachO::S_SYMBOL_STUBS)
434434 return Error(Loc, "indirect symbol not in a symbol pointer or stub "
435435 "section");
436436
728728
729729 getStreamer().EmitTBSSSymbol(getContext().getMachOSection(
730730 "__DATA", "__thread_bss",
731 MCSectionMachO::S_THREAD_LOCAL_ZEROFILL,
731 MachO::S_THREAD_LOCAL_ZEROFILL,
732732 0, SectionKind::getThreadBSS()),
733733 Sym, Size, 1 << Pow2Alignment);
734734
757757 if (getLexer().is(AsmToken::EndOfStatement)) {
758758 // Create the zerofill section but no symbol
759759 getStreamer().EmitZerofill(getContext().getMachOSection(
760 Segment, Section, MCSectionMachO::S_ZEROFILL,
760 Segment, Section, MachO::S_ZEROFILL,
761761 0, SectionKind::getBSS()));
762762 return false;
763763 }
815815 //
816816 // FIXME: Arch specific.
817817 getStreamer().EmitZerofill(getContext().getMachOSection(
818 Segment, Section, MCSectionMachO::S_ZEROFILL,
818 Segment, Section, MachO::S_ZEROFILL,
819819 0, SectionKind::getBSS()),
820820 Sym, Size, 1 << Pow2Alignment);
821821
1717 /// section type list.
1818 static const struct {
1919 const char *AssemblerName, *EnumName;
20 } SectionTypeDescriptors[MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1] = {
20 } SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1] = {
2121 { "regular", "S_REGULAR" }, // 0x00
2222 { 0, "S_ZEROFILL" }, // 0x01
2323 { "cstring_literals", "S_CSTRING_LITERALS" }, // 0x02
5454 const char *AssemblerName, *EnumName;
5555 } SectionAttrDescriptors[] = {
5656 #define ENTRY(ASMNAME, ENUM) \
57 { MCSectionMachO::ENUM, ASMNAME, #ENUM },
57 { MachO::ENUM, ASMNAME, #ENUM },
5858 ENTRY("pure_instructions", S_ATTR_PURE_INSTRUCTIONS)
5959 ENTRY("no_toc", S_ATTR_NO_TOC)
6060 ENTRY("strip_static_syms", S_ATTR_STRIP_STATIC_SYMS)
101101 return;
102102 }
103103
104 unsigned SectionType = TAA & MCSectionMachO::SECTION_TYPE;
105 assert(SectionType <= MCSectionMachO::LAST_KNOWN_SECTION_TYPE &&
104 unsigned SectionType = getType();
105 assert(SectionType <= MachO::LAST_KNOWN_SECTION_TYPE &&
106106 "Invalid SectionType specified!");
107107
108108 if (SectionTypeDescriptors[SectionType].AssemblerName) {
115115 }
116116
117117 // If we don't have any attributes, we're done.
118 unsigned SectionAttrs = TAA & MCSectionMachO::SECTION_ATTRIBUTES;
118 unsigned SectionAttrs = TAA & MachO::SECTION_ATTRIBUTES;
119119 if (SectionAttrs == 0) {
120120 // If we have a S_SYMBOL_STUBS size specified, print it along with 'none' as
121121 // the attribute specifier.
154154 }
155155
156156 bool MCSectionMachO::UseCodeAlign() const {
157 return hasAttribute(MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS);
157 return hasAttribute(MachO::S_ATTR_PURE_INSTRUCTIONS);
158158 }
159159
160160 bool MCSectionMachO::isVirtualSection() const {
161 return (getType() == MCSectionMachO::S_ZEROFILL ||
162 getType() == MCSectionMachO::S_GB_ZEROFILL ||
163 getType() == MCSectionMachO::S_THREAD_LOCAL_ZEROFILL);
161 return (getType() == MachO::S_ZEROFILL ||
162 getType() == MachO::S_GB_ZEROFILL ||
163 getType() == MachO::S_THREAD_LOCAL_ZEROFILL);
164164 }
165165
166166 /// StripSpaces - This removes leading and trailing spaces from the StringRef.
227227
228228 // Figure out which section type it is.
229229 unsigned TypeID;
230 for (TypeID = 0; TypeID !=MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1; ++TypeID)
230 for (TypeID = 0; TypeID != MachO::LAST_KNOWN_SECTION_TYPE + 1; ++TypeID)
231231 if (SectionTypeDescriptors[TypeID].AssemblerName &&
232232 SectionType == SectionTypeDescriptors[TypeID].AssemblerName)
233233 break;
234234
235235 // If we didn't find the section type, reject it.
236 if (TypeID > MCSectionMachO::LAST_KNOWN_SECTION_TYPE)
236 if (TypeID > MachO::LAST_KNOWN_SECTION_TYPE)
237237 return "mach-o section specifier uses an unknown section type";
238238
239239 // Remember the TypeID.
243243 // If we have no comma after the section type, there are no attributes.
244244 if (Comma.second.empty()) {
245245 // S_SYMBOL_STUBS always require a symbol stub size specifier.
246 if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
246 if (TAA == MachO::S_SYMBOL_STUBS)
247247 return "mach-o section specifier of type 'symbol_stubs' requires a size "
248248 "specifier";
249249 return "";
280280 // Okay, we've parsed the section attributes, see if we have a stub size spec.
281281 if (Comma.second.empty()) {
282282 // S_SYMBOL_STUBS always require a symbol stub size specifier.
283 if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
283 if (TAA == MachO::S_SYMBOL_STUBS)
284284 return "mach-o section specifier of type 'symbol_stubs' requires a size "
285285 "specifier";
286286 return "";
287287 }
288288
289289 // If we have a stub size spec, we must have a sectiontype of S_SYMBOL_STUBS.
290 if ((TAA & MCSectionMachO::SECTION_TYPE) != MCSectionMachO::S_SYMBOL_STUBS)
290 if ((TAA & MachO::SECTION_TYPE) != MachO::S_SYMBOL_STUBS)
291291 return "mach-o section specifier cannot have a stub size specified because "
292292 "it does not have type 'symbol_stubs'";
293293
228228
229229 unsigned Flags = Section.getTypeAndAttributes();
230230 if (SD.hasInstructions())
231 Flags |= MCSectionMachO::S_ATTR_SOME_INSTRUCTIONS;
231 Flags |= MachO::S_ATTR_SOME_INSTRUCTIONS;
232232
233233 assert(isPowerOf2_32(SD.getAlignment()) && "Invalid alignment!");
234234 Write32(Log2_32(SD.getAlignment()));
436436 const MCSectionMachO &Section =
437437 cast(it->SectionData->getSection());
438438
439 if (Section.getType() != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS &&
440 Section.getType() != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
441 Section.getType() != MCSectionMachO::S_SYMBOL_STUBS) {
439 if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
440 Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
441 Section.getType() != MachO::S_SYMBOL_STUBS) {
442442 MCSymbol &Symbol = *it->Symbol;
443443 report_fatal_error("indirect symbol '" + Symbol.getName() +
444444 "' not in a symbol pointer or stub section");
452452 const MCSectionMachO &Section =
453453 cast(it->SectionData->getSection());
454454
455 if (Section.getType() != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS)
455 if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS)
456456 continue;
457457
458458 // Initialize the section indirect symbol base, if necessary.
468468 const MCSectionMachO &Section =
469469 cast(it->SectionData->getSection());
470470
471 if (Section.getType() != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
472 Section.getType() != MCSectionMachO::S_SYMBOL_STUBS)
471 if (Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
472 Section.getType() != MachO::S_SYMBOL_STUBS)
473473 continue;
474474
475475 // Initialize the section indirect symbol base, if necessary.
920920 // special handling.
921921 const MCSectionMachO &Section =
922922 static_cast(it->SectionData->getSection());
923 if (Section.getType() == MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS) {
923 if (Section.getType() == MachO::S_NON_LAZY_SYMBOL_POINTERS) {
924924 // If this symbol is defined and internal, mark it as such.
925925 if (it->Symbol->isDefined() &&
926926 !Asm.getSymbolData(*it->Symbol).isExternal()) {
421421 if (RelocM == Reloc::DynamicNoPIC) {
422422 const MCSection *sect =
423423 OutContext.getMachOSection("__TEXT", "__symbol_stub4",
424 MCSectionMachO::S_SYMBOL_STUBS,
424 MachO::S_SYMBOL_STUBS,
425425 12, SectionKind::getText());
426426 OutStreamer.SwitchSection(sect);
427427 } else {
428428 const MCSection *sect =
429429 OutContext.getMachOSection("__TEXT", "__picsymbolstub4",
430 MCSectionMachO::S_SYMBOL_STUBS,
430 MachO::S_SYMBOL_STUBS,
431431 16, SectionKind::getText());
432432 OutStreamer.SwitchSection(sect);
433433 }
434434 const MCSection *StaticInitSect =
435435 OutContext.getMachOSection("__TEXT", "__StaticInit",
436 MCSectionMachO::S_REGULAR |
437 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
436 MachO::S_REGULAR |
437 MachO::S_ATTR_PURE_INSTRUCTIONS,
438438 SectionKind::getText());
439439 OutStreamer.SwitchSection(StaticInitSect);
440440 }
864864 if (TM.getRelocationModel() == Reloc::PIC_) {
865865 OutStreamer.SwitchSection(
866866 OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
867 MCSectionMachO::S_SYMBOL_STUBS |
868 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
867 MachO::S_SYMBOL_STUBS |
868 MachO::S_ATTR_PURE_INSTRUCTIONS,
869869 32, SectionKind::getText()));
870870 } else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) {
871871 OutStreamer.SwitchSection(
872872 OutContext.getMachOSection("__TEXT","__symbol_stub1",
873 MCSectionMachO::S_SYMBOL_STUBS |
874 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
873 MachO::S_SYMBOL_STUBS |
874 MachO::S_ATTR_PURE_INSTRUCTIONS,
875875 16, SectionKind::getText()));
876876 }
877877 OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
903903 if (TM.getRelocationModel() == Reloc::PIC_) {
904904 const MCSection *StubSection =
905905 OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
906 MCSectionMachO::S_SYMBOL_STUBS |
907 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
906 MachO::S_SYMBOL_STUBS |
907 MachO::S_ATTR_PURE_INSTRUCTIONS,
908908 32, SectionKind::getText());
909909 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
910910 OutStreamer.SwitchSection(StubSection);
971971
972972 const MCSection *StubSection =
973973 OutContext.getMachOSection("__TEXT","__symbol_stub1",
974 MCSectionMachO::S_SYMBOL_STUBS |
975 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
974 MachO::S_SYMBOL_STUBS |
975 MachO::S_ATTR_PURE_INSTRUCTIONS,
976976 16, SectionKind::getText());
977977 for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
978978 MCSymbol *Stub = Stubs[i].first;
757757 //
758758 // See .
759759 const MCSectionMachO &SMO = static_cast(Section);
760 return SMO.getType() == MCSectionMachO::S_CSTRING_LITERALS;
760 return SMO.getType() == MachO::S_CSTRING_LITERALS;
761761 }
762762
763763 virtual bool isSectionAtomizable(const MCSection &Section) const {
767767 default:
768768 return true;
769769
770 case MCSectionMachO::S_4BYTE_LITERALS:
771 case MCSectionMachO::S_8BYTE_LITERALS:
772 case MCSectionMachO::S_16BYTE_LITERALS:
773 case MCSectionMachO::S_LITERAL_POINTERS:
774 case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:
775 case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:
776 case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:
777 case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:
778 case MCSectionMachO::S_INTERPOSING:
770 case MachO::S_4BYTE_LITERALS:
771 case MachO::S_8BYTE_LITERALS:
772 case MachO::S_16BYTE_LITERALS:
773 case MachO::S_LITERAL_POINTERS:
774 case MachO::S_NON_LAZY_SYMBOL_POINTERS:
775 case MachO::S_LAZY_SYMBOL_POINTERS:
776 case MachO::S_MOD_INIT_FUNC_POINTERS:
777 case MachO::S_MOD_TERM_FUNC_POINTERS:
778 case MachO::S_INTERPOSING:
779779 return false;
780780 }
781781 }
229229 if (Symbol->isInSection()) {
230230 const MCSectionMachO &Section = static_cast(
231231 Fragment->getParent()->getSection());
232 if (Section.hasAttribute(MCSectionMachO::S_ATTR_DEBUG))
232 if (Section.hasAttribute(MachO::S_ATTR_DEBUG))
233233 Base = 0;
234234 }
235235
540540 if (!Stubs.empty()) {
541541 const MCSection *TheSection =
542542 OutContext.getMachOSection("__IMPORT", "__jump_table",
543 MCSectionMachO::S_SYMBOL_STUBS |
544 MCSectionMachO::S_ATTR_SELF_MODIFYING_CODE |
545 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
543 MachO::S_SYMBOL_STUBS |
544 MachO::S_ATTR_SELF_MODIFYING_CODE |
545 MachO::S_ATTR_PURE_INSTRUCTIONS,
546546 5, SectionKind::getMetadata());
547547 OutStreamer.SwitchSection(TheSection);
548548
566566 if (!Stubs.empty()) {
567567 const MCSection *TheSection =
568568 OutContext.getMachOSection("__IMPORT", "__pointers",
569 MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
569 MachO::S_NON_LAZY_SYMBOL_POINTERS,
570570 SectionKind::getMetadata());
571571 OutStreamer.SwitchSection(TheSection);
572572