1 //===-- MObjectFileInfo.cpp - Object File Information ---------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCObjectFileInfo.h"
11 #include "llvm/MC/MCContext.h"
12 #include "llvm/MC/MCSection.h"
13 #include "llvm/MC/MCSectionCOFF.h"
14 #include "llvm/MC/MCSectionELF.h"
15 #include "llvm/MC/MCSectionMachO.h"
16 #include "llvm/ADT/Triple.h"
19 void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
21 IsFunctionEHFrameSymbolPrivate = false;
22 SupportsWeakOmittedEHFrame = false;
24 PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel
25 | dwarf::DW_EH_PE_sdata4;
26 LSDAEncoding = FDEEncoding = FDECFIEncoding = dwarf::DW_EH_PE_pcrel;
27 TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
28 dwarf::DW_EH_PE_sdata4;
30 // .comm doesn't support alignment before Leopard.
31 if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
32 CommDirectiveSupportsAlignment = false;
35 = Ctx->getMachOSection("__TEXT", "__text",
36 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
37 SectionKind::getText());
39 = Ctx->getMachOSection("__DATA", "__data", 0,
40 SectionKind::getDataRel());
42 TLSDataSection // .tdata
43 = Ctx->getMachOSection("__DATA", "__thread_data",
44 MCSectionMachO::S_THREAD_LOCAL_REGULAR,
45 SectionKind::getDataRel());
46 TLSBSSSection // .tbss
47 = Ctx->getMachOSection("__DATA", "__thread_bss",
48 MCSectionMachO::S_THREAD_LOCAL_ZEROFILL,
49 SectionKind::getThreadBSS());
51 // TODO: Verify datarel below.
53 = Ctx->getMachOSection("__DATA", "__thread_vars",
54 MCSectionMachO::S_THREAD_LOCAL_VARIABLES,
55 SectionKind::getDataRel());
58 = Ctx->getMachOSection("__DATA", "__thread_init",
59 MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
60 SectionKind::getDataRel());
62 CStringSection // .cstring
63 = Ctx->getMachOSection("__TEXT", "__cstring",
64 MCSectionMachO::S_CSTRING_LITERALS,
65 SectionKind::getMergeable1ByteCString());
67 = Ctx->getMachOSection("__TEXT","__ustring", 0,
68 SectionKind::getMergeable2ByteCString());
69 FourByteConstantSection // .literal4
70 = Ctx->getMachOSection("__TEXT", "__literal4",
71 MCSectionMachO::S_4BYTE_LITERALS,
72 SectionKind::getMergeableConst4());
73 EightByteConstantSection // .literal8
74 = Ctx->getMachOSection("__TEXT", "__literal8",
75 MCSectionMachO::S_8BYTE_LITERALS,
76 SectionKind::getMergeableConst8());
78 // ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back
79 // to using it in -static mode.
80 SixteenByteConstantSection = 0;
81 if (RelocM != Reloc::Static &&
82 T.getArch() != Triple::x86_64 && T.getArch() != Triple::ppc64)
83 SixteenByteConstantSection = // .literal16
84 Ctx->getMachOSection("__TEXT", "__literal16",
85 MCSectionMachO::S_16BYTE_LITERALS,
86 SectionKind::getMergeableConst16());
88 ReadOnlySection // .const
89 = Ctx->getMachOSection("__TEXT", "__const", 0,
90 SectionKind::getReadOnly());
93 = Ctx->getMachOSection("__TEXT", "__textcoal_nt",
94 MCSectionMachO::S_COALESCED |
95 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
96 SectionKind::getText());
98 = Ctx->getMachOSection("__TEXT", "__const_coal",
99 MCSectionMachO::S_COALESCED,
100 SectionKind::getReadOnly());
101 ConstDataSection // .const_data
102 = Ctx->getMachOSection("__DATA", "__const", 0,
103 SectionKind::getReadOnlyWithRel());
105 = Ctx->getMachOSection("__DATA","__datacoal_nt",
106 MCSectionMachO::S_COALESCED,
107 SectionKind::getDataRel());
109 = Ctx->getMachOSection("__DATA","__common",
110 MCSectionMachO::S_ZEROFILL,
111 SectionKind::getBSS());
113 = Ctx->getMachOSection("__DATA","__bss", MCSectionMachO::S_ZEROFILL,
114 SectionKind::getBSS());
117 LazySymbolPointerSection
118 = Ctx->getMachOSection("__DATA", "__la_symbol_ptr",
119 MCSectionMachO::S_LAZY_SYMBOL_POINTERS,
120 SectionKind::getMetadata());
121 NonLazySymbolPointerSection
122 = Ctx->getMachOSection("__DATA", "__nl_symbol_ptr",
123 MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
124 SectionKind::getMetadata());
126 if (RelocM == Reloc::Static) {
128 = Ctx->getMachOSection("__TEXT", "__constructor", 0,
129 SectionKind::getDataRel());
131 = Ctx->getMachOSection("__TEXT", "__destructor", 0,
132 SectionKind::getDataRel());
135 = Ctx->getMachOSection("__DATA", "__mod_init_func",
136 MCSectionMachO::S_MOD_INIT_FUNC_POINTERS,
137 SectionKind::getDataRel());
139 = Ctx->getMachOSection("__DATA", "__mod_term_func",
140 MCSectionMachO::S_MOD_TERM_FUNC_POINTERS,
141 SectionKind::getDataRel());
144 // Exception Handling.
146 Ctx->getMachOSection("__TEXT", "__eh_frame",
147 MCSectionMachO::S_COALESCED |
148 MCSectionMachO::S_ATTR_NO_TOC |
149 MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
150 MCSectionMachO::S_ATTR_LIVE_SUPPORT,
151 SectionKind::getReadOnly());
153 LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
154 SectionKind::getReadOnlyWithRel());
156 if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
157 CompactUnwindSection =
158 Ctx->getMachOSection("__LD", "__compact_unwind",
159 MCSectionMachO::S_ATTR_DEBUG,
160 SectionKind::getReadOnly());
162 // Debug Information.
163 DwarfAccelNamesSection =
164 Ctx->getMachOSection("__DWARF", "__apple_names",
165 MCSectionMachO::S_ATTR_DEBUG,
166 SectionKind::getMetadata());
167 DwarfAccelObjCSection =
168 Ctx->getMachOSection("__DWARF", "__apple_objc",
169 MCSectionMachO::S_ATTR_DEBUG,
170 SectionKind::getMetadata());
171 // 16 character section limit...
172 DwarfAccelNamespaceSection =
173 Ctx->getMachOSection("__DWARF", "__apple_namespac",
174 MCSectionMachO::S_ATTR_DEBUG,
175 SectionKind::getMetadata());
176 DwarfAccelTypesSection =
177 Ctx->getMachOSection("__DWARF", "__apple_types",
178 MCSectionMachO::S_ATTR_DEBUG,
179 SectionKind::getMetadata());
182 Ctx->getMachOSection("__DWARF", "__debug_abbrev",
183 MCSectionMachO::S_ATTR_DEBUG,
184 SectionKind::getMetadata());
186 Ctx->getMachOSection("__DWARF", "__debug_info",
187 MCSectionMachO::S_ATTR_DEBUG,
188 SectionKind::getMetadata());
190 Ctx->getMachOSection("__DWARF", "__debug_line",
191 MCSectionMachO::S_ATTR_DEBUG,
192 SectionKind::getMetadata());
194 Ctx->getMachOSection("__DWARF", "__debug_frame",
195 MCSectionMachO::S_ATTR_DEBUG,
196 SectionKind::getMetadata());
197 DwarfPubTypesSection =
198 Ctx->getMachOSection("__DWARF", "__debug_pubtypes",
199 MCSectionMachO::S_ATTR_DEBUG,
200 SectionKind::getMetadata());
202 Ctx->getMachOSection("__DWARF", "__debug_str",
203 MCSectionMachO::S_ATTR_DEBUG,
204 SectionKind::getMetadata());
206 Ctx->getMachOSection("__DWARF", "__debug_loc",
207 MCSectionMachO::S_ATTR_DEBUG,
208 SectionKind::getMetadata());
209 DwarfARangesSection =
210 Ctx->getMachOSection("__DWARF", "__debug_aranges",
211 MCSectionMachO::S_ATTR_DEBUG,
212 SectionKind::getMetadata());
214 Ctx->getMachOSection("__DWARF", "__debug_ranges",
215 MCSectionMachO::S_ATTR_DEBUG,
216 SectionKind::getMetadata());
217 DwarfMacroInfoSection =
218 Ctx->getMachOSection("__DWARF", "__debug_macinfo",
219 MCSectionMachO::S_ATTR_DEBUG,
220 SectionKind::getMetadata());
221 DwarfDebugInlineSection =
222 Ctx->getMachOSection("__DWARF", "__debug_inlined",
223 MCSectionMachO::S_ATTR_DEBUG,
224 SectionKind::getMetadata());
226 TLSExtraDataSection = TLSTLVSection;
229 void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
230 if (T.getArch() == Triple::x86) {
231 PersonalityEncoding = (RelocM == Reloc::PIC_)
232 ? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
233 : dwarf::DW_EH_PE_absptr;
234 LSDAEncoding = (RelocM == Reloc::PIC_)
235 ? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
236 : dwarf::DW_EH_PE_absptr;
237 FDEEncoding = FDECFIEncoding = (RelocM == Reloc::PIC_)
238 ? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
239 : dwarf::DW_EH_PE_absptr;
240 TTypeEncoding = (RelocM == Reloc::PIC_)
241 ? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
242 : dwarf::DW_EH_PE_absptr;
243 } else if (T.getArch() == Triple::x86_64) {
244 FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
246 if (RelocM == Reloc::PIC_) {
247 PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
248 ((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
249 ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
250 LSDAEncoding = dwarf::DW_EH_PE_pcrel |
251 (CMModel == CodeModel::Small
252 ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
253 FDEEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
254 TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
255 ((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
256 ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
258 PersonalityEncoding =
259 (CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
260 ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
261 LSDAEncoding = (CMModel == CodeModel::Small)
262 ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
263 FDEEncoding = dwarf::DW_EH_PE_udata4;
264 TTypeEncoding = (CMModel == CodeModel::Small)
265 ? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
271 Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
272 ELF::SHF_WRITE | ELF::SHF_ALLOC,
273 SectionKind::getBSS());
276 Ctx->getELFSection(".text", ELF::SHT_PROGBITS,
279 SectionKind::getText());
282 Ctx->getELFSection(".data", ELF::SHT_PROGBITS,
283 ELF::SHF_WRITE |ELF::SHF_ALLOC,
284 SectionKind::getDataRel());
287 Ctx->getELFSection(".rodata", ELF::SHT_PROGBITS,
289 SectionKind::getReadOnly());
292 Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
293 ELF::SHF_ALLOC | ELF::SHF_TLS |
295 SectionKind::getThreadData());
298 Ctx->getELFSection(".tbss", ELF::SHT_NOBITS,
299 ELF::SHF_ALLOC | ELF::SHF_TLS |
301 SectionKind::getThreadBSS());
304 Ctx->getELFSection(".data.rel", ELF::SHT_PROGBITS,
305 ELF::SHF_ALLOC |ELF::SHF_WRITE,
306 SectionKind::getDataRel());
308 DataRelLocalSection =
309 Ctx->getELFSection(".data.rel.local", ELF::SHT_PROGBITS,
310 ELF::SHF_ALLOC |ELF::SHF_WRITE,
311 SectionKind::getDataRelLocal());
314 Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
315 ELF::SHF_ALLOC |ELF::SHF_WRITE,
316 SectionKind::getReadOnlyWithRel());
318 DataRelROLocalSection =
319 Ctx->getELFSection(".data.rel.ro.local", ELF::SHT_PROGBITS,
320 ELF::SHF_ALLOC |ELF::SHF_WRITE,
321 SectionKind::getReadOnlyWithRelLocal());
323 MergeableConst4Section =
324 Ctx->getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
325 ELF::SHF_ALLOC |ELF::SHF_MERGE,
326 SectionKind::getMergeableConst4());
328 MergeableConst8Section =
329 Ctx->getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
330 ELF::SHF_ALLOC |ELF::SHF_MERGE,
331 SectionKind::getMergeableConst8());
333 MergeableConst16Section =
334 Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
335 ELF::SHF_ALLOC |ELF::SHF_MERGE,
336 SectionKind::getMergeableConst16());
339 Ctx->getELFSection(".ctors", ELF::SHT_PROGBITS,
340 ELF::SHF_ALLOC |ELF::SHF_WRITE,
341 SectionKind::getDataRel());
344 Ctx->getELFSection(".dtors", ELF::SHT_PROGBITS,
345 ELF::SHF_ALLOC |ELF::SHF_WRITE,
346 SectionKind::getDataRel());
348 // Exception Handling Sections.
350 // Solaris requires different flags for .eh_frame to seemingly every other
352 unsigned EHSectionFlags = ELF::SHF_ALLOC;
353 if (T.getOS() == Triple::Solaris)
354 EHSectionFlags |= ELF::SHF_WRITE;
357 Ctx->getELFSection(".eh_frame", ELF::SHT_PROGBITS,
359 SectionKind::getDataRel());
361 // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
362 // it contains relocatable pointers. In PIC mode, this is probably a big
363 // runtime hit for C++ apps. Either the contents of the LSDA need to be
364 // adjusted or this should be a data section.
366 Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
368 SectionKind::getReadOnly());
370 // Debug Info Sections.
372 Ctx->getELFSection(".debug_abbrev", ELF::SHT_PROGBITS, 0,
373 SectionKind::getMetadata());
375 Ctx->getELFSection(".debug_info", ELF::SHT_PROGBITS, 0,
376 SectionKind::getMetadata());
378 Ctx->getELFSection(".debug_line", ELF::SHT_PROGBITS, 0,
379 SectionKind::getMetadata());
381 Ctx->getELFSection(".debug_frame", ELF::SHT_PROGBITS, 0,
382 SectionKind::getMetadata());
383 DwarfPubTypesSection =
384 Ctx->getELFSection(".debug_pubtypes", ELF::SHT_PROGBITS, 0,
385 SectionKind::getMetadata());
387 Ctx->getELFSection(".debug_str", ELF::SHT_PROGBITS,
388 ELF::SHF_MERGE | ELF::SHF_STRINGS,
389 SectionKind::getMergeable1ByteCString());
391 Ctx->getELFSection(".debug_loc", ELF::SHT_PROGBITS, 0,
392 SectionKind::getMetadata());
393 DwarfARangesSection =
394 Ctx->getELFSection(".debug_aranges", ELF::SHT_PROGBITS, 0,
395 SectionKind::getMetadata());
397 Ctx->getELFSection(".debug_ranges", ELF::SHT_PROGBITS, 0,
398 SectionKind::getMetadata());
399 DwarfMacroInfoSection =
400 Ctx->getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0,
401 SectionKind::getMetadata());
405 void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
408 Ctx->getCOFFSection(".text",
409 COFF::IMAGE_SCN_CNT_CODE |
410 COFF::IMAGE_SCN_MEM_EXECUTE |
411 COFF::IMAGE_SCN_MEM_READ,
412 SectionKind::getText());
414 Ctx->getCOFFSection(".data",
415 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
416 COFF::IMAGE_SCN_MEM_READ |
417 COFF::IMAGE_SCN_MEM_WRITE,
418 SectionKind::getDataRel());
420 Ctx->getCOFFSection(".rdata",
421 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
422 COFF::IMAGE_SCN_MEM_READ,
423 SectionKind::getReadOnly());
425 Ctx->getCOFFSection(".ctors",
426 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
427 COFF::IMAGE_SCN_MEM_READ |
428 COFF::IMAGE_SCN_MEM_WRITE,
429 SectionKind::getDataRel());
431 Ctx->getCOFFSection(".dtors",
432 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
433 COFF::IMAGE_SCN_MEM_READ |
434 COFF::IMAGE_SCN_MEM_WRITE,
435 SectionKind::getDataRel());
438 Ctx->getCOFFSection(".eh_frame",
439 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
440 COFF::IMAGE_SCN_MEM_READ |
441 COFF::IMAGE_SCN_MEM_WRITE,
442 SectionKind::getDataRel());
444 // FIXME: We're emitting LSDA info into a readonly section on COFF, even
445 // though it contains relocatable pointers. In PIC mode, this is probably a
446 // big runtime hit for C++ apps. Either the contents of the LSDA need to be
447 // adjusted or this should be a data section.
449 Ctx->getCOFFSection(".gcc_except_table",
450 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
451 COFF::IMAGE_SCN_MEM_READ,
452 SectionKind::getReadOnly());
456 Ctx->getCOFFSection(".debug_abbrev",
457 COFF::IMAGE_SCN_MEM_DISCARDABLE |
458 COFF::IMAGE_SCN_MEM_READ,
459 SectionKind::getMetadata());
461 Ctx->getCOFFSection(".debug_info",
462 COFF::IMAGE_SCN_MEM_DISCARDABLE |
463 COFF::IMAGE_SCN_MEM_READ,
464 SectionKind::getMetadata());
466 Ctx->getCOFFSection(".debug_line",
467 COFF::IMAGE_SCN_MEM_DISCARDABLE |
468 COFF::IMAGE_SCN_MEM_READ,
469 SectionKind::getMetadata());
471 Ctx->getCOFFSection(".debug_frame",
472 COFF::IMAGE_SCN_MEM_DISCARDABLE |
473 COFF::IMAGE_SCN_MEM_READ,
474 SectionKind::getMetadata());
475 DwarfPubTypesSection =
476 Ctx->getCOFFSection(".debug_pubtypes",
477 COFF::IMAGE_SCN_MEM_DISCARDABLE |
478 COFF::IMAGE_SCN_MEM_READ,
479 SectionKind::getMetadata());
481 Ctx->getCOFFSection(".debug_str",
482 COFF::IMAGE_SCN_MEM_DISCARDABLE |
483 COFF::IMAGE_SCN_MEM_READ,
484 SectionKind::getMetadata());
486 Ctx->getCOFFSection(".debug_loc",
487 COFF::IMAGE_SCN_MEM_DISCARDABLE |
488 COFF::IMAGE_SCN_MEM_READ,
489 SectionKind::getMetadata());
490 DwarfARangesSection =
491 Ctx->getCOFFSection(".debug_aranges",
492 COFF::IMAGE_SCN_MEM_DISCARDABLE |
493 COFF::IMAGE_SCN_MEM_READ,
494 SectionKind::getMetadata());
496 Ctx->getCOFFSection(".debug_ranges",
497 COFF::IMAGE_SCN_MEM_DISCARDABLE |
498 COFF::IMAGE_SCN_MEM_READ,
499 SectionKind::getMetadata());
500 DwarfMacroInfoSection =
501 Ctx->getCOFFSection(".debug_macinfo",
502 COFF::IMAGE_SCN_MEM_DISCARDABLE |
503 COFF::IMAGE_SCN_MEM_READ,
504 SectionKind::getMetadata());
507 Ctx->getCOFFSection(".drectve",
508 COFF::IMAGE_SCN_LNK_INFO,
509 SectionKind::getMetadata());
512 Ctx->getCOFFSection(".pdata",
513 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
514 COFF::IMAGE_SCN_MEM_READ |
515 COFF::IMAGE_SCN_MEM_WRITE,
516 SectionKind::getDataRel());
519 Ctx->getCOFFSection(".xdata",
520 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
521 COFF::IMAGE_SCN_MEM_READ |
522 COFF::IMAGE_SCN_MEM_WRITE,
523 SectionKind::getDataRel());
525 Ctx->getCOFFSection(".tls$",
526 COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
527 COFF::IMAGE_SCN_MEM_READ |
528 COFF::IMAGE_SCN_MEM_WRITE,
529 SectionKind::getDataRel());
532 void MCObjectFileInfo::InitMCObjectFileInfo(StringRef TT, Reloc::Model relocm,
540 CommDirectiveSupportsAlignment = true;
541 SupportsWeakOmittedEHFrame = true;
542 IsFunctionEHFrameSymbolPrivate = true;
544 PersonalityEncoding = LSDAEncoding = FDEEncoding = FDECFIEncoding =
545 TTypeEncoding = dwarf::DW_EH_PE_absptr;
547 EHFrameSection = 0; // Created on demand.
548 CompactUnwindSection = 0; // Used only by selected targets.
549 DwarfAccelNamesSection = 0; // Used only by selected targets.
550 DwarfAccelObjCSection = 0; // Used only by selected targets.
551 DwarfAccelNamespaceSection = 0; // Used only by selected targets.
552 DwarfAccelTypesSection = 0; // Used only by selected targets.
555 Triple::ArchType Arch = T.getArch();
556 // FIXME: Checking for Arch here to filter out bogus triples such as
557 // cellspu-apple-darwin. Perhaps we should fix in Triple?
558 if ((Arch == Triple::x86 || Arch == Triple::x86_64 ||
559 Arch == Triple::arm || Arch == Triple::thumb ||
560 Arch == Triple::ppc || Arch == Triple::ppc64 ||
561 Arch == Triple::UnknownArch) &&
562 (T.isOSDarwin() || T.getEnvironment() == Triple::MachO)) {
564 InitMachOMCObjectFileInfo(T);
565 } else if ((Arch == Triple::x86 || Arch == Triple::x86_64) &&
566 (T.getOS() == Triple::MinGW32 || T.getOS() == Triple::Cygwin ||
567 T.getOS() == Triple::Win32)) {
569 InitCOFFMCObjectFileInfo(T);
572 InitELFMCObjectFileInfo(T);