LLVM  5.0.0
MCObjectFileInfo.cpp
Go to the documentation of this file.
1 //===-- MCObjectFileInfo.cpp - Object File Information --------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/ADT/StringExtras.h"
12 #include "llvm/ADT/Triple.h"
13 #include "llvm/BinaryFormat/COFF.h"
14 #include "llvm/BinaryFormat/ELF.h"
15 #include "llvm/MC/MCAsmInfo.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCSection.h"
18 #include "llvm/MC/MCSectionCOFF.h"
19 #include "llvm/MC/MCSectionELF.h"
20 #include "llvm/MC/MCSectionMachO.h"
21 #include "llvm/MC/MCSectionWasm.h"
22 
23 using namespace llvm;
24 
25 static bool useCompactUnwind(const Triple &T) {
26  // Only on darwin.
27  if (!T.isOSDarwin())
28  return false;
29 
30  // aarch64 always has it.
31  if (T.getArch() == Triple::aarch64)
32  return true;
33 
34  // armv7k always has it.
35  if (T.isWatchABI())
36  return true;
37 
38  // Use it on newer version of OS X.
39  if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
40  return true;
41 
42  // And the iOS simulator.
43  if (T.isiOS() &&
44  (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86))
45  return true;
46 
47  return false;
48 }
49 
50 void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
51  // MachO
53 
55  "__TEXT", "__eh_frame",
59 
60  if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
62 
63  if (T.isWatchABI())
65 
71 
72  // .comm doesn't support alignment before Leopard.
73  if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
75 
76  TextSection // .text
77  = Ctx->getMachOSection("__TEXT", "__text",
80  DataSection // .data
81  = Ctx->getMachOSection("__DATA", "__data", 0, SectionKind::getData());
82 
83  // BSSSection might not be expected initialized on msvc.
84  BSSSection = nullptr;
85 
86  TLSDataSection // .tdata
87  = Ctx->getMachOSection("__DATA", "__thread_data",
90  TLSBSSSection // .tbss
91  = Ctx->getMachOSection("__DATA", "__thread_bss",
94 
95  // TODO: Verify datarel below.
96  TLSTLVSection // .tlv
97  = Ctx->getMachOSection("__DATA", "__thread_vars",
100 
102  "__DATA", "__thread_init", MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
104 
105  CStringSection // .cstring
106  = Ctx->getMachOSection("__TEXT", "__cstring",
110  = Ctx->getMachOSection("__TEXT","__ustring", 0,
112  FourByteConstantSection // .literal4
113  = Ctx->getMachOSection("__TEXT", "__literal4",
116  EightByteConstantSection // .literal8
117  = Ctx->getMachOSection("__TEXT", "__literal8",
120 
121  SixteenByteConstantSection // .literal16
122  = Ctx->getMachOSection("__TEXT", "__literal16",
125 
126  ReadOnlySection // .const
127  = Ctx->getMachOSection("__TEXT", "__const", 0,
129 
130  // If the target is not powerpc, map the coal sections to the non-coal
131  // sections.
132  //
133  // "__TEXT/__textcoal_nt" => section "__TEXT/__text"
134  // "__TEXT/__const_coal" => section "__TEXT/__const"
135  // "__DATA/__datacoal_nt" => section "__DATA/__data"
136  Triple::ArchType ArchTy = T.getArch();
137 
138  if (ArchTy == Triple::ppc || ArchTy == Triple::ppc64) {
140  = Ctx->getMachOSection("__TEXT", "__textcoal_nt",
145  = Ctx->getMachOSection("__TEXT", "__const_coal",
149  "__DATA", "__datacoal_nt", MachO::S_COALESCED, SectionKind::getData());
150  } else {
154  }
155 
156  ConstDataSection // .const_data
157  = Ctx->getMachOSection("__DATA", "__const", 0,
160  = Ctx->getMachOSection("__DATA","__common",
164  = Ctx->getMachOSection("__DATA","__bss", MachO::S_ZEROFILL,
166 
167 
169  = Ctx->getMachOSection("__DATA", "__la_symbol_ptr",
173  = Ctx->getMachOSection("__DATA", "__nl_symbol_ptr",
176 
178  = Ctx->getMachOSection("__DATA", "__thread_ptr",
181 
182  // Exception Handling.
183  LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
185 
186  COFFDebugSymbolsSection = nullptr;
187  COFFDebugTypesSection = nullptr;
188 
189  if (useCompactUnwind(T)) {
191  Ctx->getMachOSection("__LD", "__compact_unwind", MachO::S_ATTR_DEBUG,
193 
194  if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
195  CompactUnwindDwarfEHFrameOnly = 0x04000000; // UNWIND_X86_64_MODE_DWARF
196  else if (T.getArch() == Triple::aarch64)
197  CompactUnwindDwarfEHFrameOnly = 0x03000000; // UNWIND_ARM64_MODE_DWARF
198  else if (T.getArch() == Triple::arm || T.getArch() == Triple::thumb)
199  CompactUnwindDwarfEHFrameOnly = 0x04000000; // UNWIND_ARM_MODE_DWARF
200  }
201 
202  // Debug Information.
204  Ctx->getMachOSection("__DWARF", "__apple_names", MachO::S_ATTR_DEBUG,
205  SectionKind::getMetadata(), "names_begin");
207  Ctx->getMachOSection("__DWARF", "__apple_objc", MachO::S_ATTR_DEBUG,
208  SectionKind::getMetadata(), "objc_begin");
209  // 16 character section limit...
211  Ctx->getMachOSection("__DWARF", "__apple_namespac", MachO::S_ATTR_DEBUG,
212  SectionKind::getMetadata(), "namespac_begin");
214  Ctx->getMachOSection("__DWARF", "__apple_types", MachO::S_ATTR_DEBUG,
215  SectionKind::getMetadata(), "types_begin");
216 
218  Ctx->getMachOSection("__DWARF", "__debug_abbrev", MachO::S_ATTR_DEBUG,
219  SectionKind::getMetadata(), "section_abbrev");
221  Ctx->getMachOSection("__DWARF", "__debug_info", MachO::S_ATTR_DEBUG,
222  SectionKind::getMetadata(), "section_info");
224  Ctx->getMachOSection("__DWARF", "__debug_line", MachO::S_ATTR_DEBUG,
225  SectionKind::getMetadata(), "section_line");
227  Ctx->getMachOSection("__DWARF", "__debug_frame", MachO::S_ATTR_DEBUG,
230  Ctx->getMachOSection("__DWARF", "__debug_pubnames", MachO::S_ATTR_DEBUG,
233  Ctx->getMachOSection("__DWARF", "__debug_pubtypes", MachO::S_ATTR_DEBUG,
236  Ctx->getMachOSection("__DWARF", "__debug_gnu_pubn", MachO::S_ATTR_DEBUG,
239  Ctx->getMachOSection("__DWARF", "__debug_gnu_pubt", MachO::S_ATTR_DEBUG,
242  Ctx->getMachOSection("__DWARF", "__debug_str", MachO::S_ATTR_DEBUG,
243  SectionKind::getMetadata(), "info_string");
245  Ctx->getMachOSection("__DWARF", "__debug_str_offs", MachO::S_ATTR_DEBUG,
246  SectionKind::getMetadata(), "section_str_off");
248  Ctx->getMachOSection("__DWARF", "__debug_loc", MachO::S_ATTR_DEBUG,
249  SectionKind::getMetadata(), "section_debug_loc");
251  Ctx->getMachOSection("__DWARF", "__debug_aranges", MachO::S_ATTR_DEBUG,
254  Ctx->getMachOSection("__DWARF", "__debug_ranges", MachO::S_ATTR_DEBUG,
255  SectionKind::getMetadata(), "debug_range");
257  Ctx->getMachOSection("__DWARF", "__debug_macinfo", MachO::S_ATTR_DEBUG,
258  SectionKind::getMetadata(), "debug_macinfo");
260  Ctx->getMachOSection("__DWARF", "__debug_inlined", MachO::S_ATTR_DEBUG,
263  Ctx->getMachOSection("__DWARF", "__debug_cu_index", MachO::S_ATTR_DEBUG,
266  Ctx->getMachOSection("__DWARF", "__debug_tu_index", MachO::S_ATTR_DEBUG,
268  StackMapSection = Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps",
270 
271  FaultMapSection = Ctx->getMachOSection("__LLVM_FAULTMAPS", "__llvm_faultmaps",
273 
275 }
276 
277 void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T) {
278  switch (T.getArch()) {
279  case Triple::mips:
280  case Triple::mipsel:
282  break;
283  case Triple::mips64:
284  case Triple::mips64el:
286  break;
287  case Triple::x86_64:
291  break;
292  case Triple::bpfel:
293  case Triple::bpfeb:
295  break;
296  default:
298  break;
299  }
300 
301  switch (T.getArch()) {
302  case Triple::arm:
303  case Triple::armeb:
304  case Triple::thumb:
305  case Triple::thumbeb:
307  break;
308  // Fallthrough if not using EHABI
310  case Triple::ppc:
311  case Triple::x86:
312  PersonalityEncoding = PositionIndependent
317  LSDAEncoding = PositionIndependent
320  TTypeEncoding = PositionIndependent
324  break;
325  case Triple::x86_64:
326  if (PositionIndependent) {
328  ((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
331  (CMModel == CodeModel::Small
334  ((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
335  ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
336  } else {
338  (CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
340  LSDAEncoding = (CMModel == CodeModel::Small)
342  TTypeEncoding = (CMModel == CodeModel::Small)
344  }
345  break;
346  case Triple::hexagon:
351  if (PositionIndependent) {
356  }
357  break;
358  case Triple::aarch64:
359  case Triple::aarch64_be:
360  // The small model guarantees static code/data size < 4GB, but not where it
361  // will be in memory. Most of these could end up >2GB away so even a signed
362  // pc-relative 32-bit address is insufficient, theoretically.
363  if (PositionIndependent) {
369  } else {
373  }
374  break;
375  case Triple::lanai:
379  break;
380  case Triple::mips:
381  case Triple::mipsel:
382  case Triple::mips64:
383  case Triple::mips64el:
384  // MIPS uses indirect pointer to refer personality functions and types, so
385  // that the eh_frame section can be read-only. DW.ref.personality will be
386  // generated for relocation.
388  // FIXME: The N64 ABI probably ought to use DW_EH_PE_sdata8 but we can't
389  // identify N64 from just a triple.
392  // We don't support PC-relative LSDA references in GAS so we use the default
393  // DW_EH_PE_absptr for those.
394 
395  // FreeBSD must be explicit about the data size and using pcrel since it's
396  // assembler/linker won't do the automatic conversion that the Linux tools
397  // do.
398  if (T.isOSFreeBSD()) {
401  }
402  break;
403  case Triple::ppc64:
404  case Triple::ppc64le:
410  break;
411  case Triple::sparcel:
412  case Triple::sparc:
413  if (PositionIndependent) {
419  } else {
423  }
424  break;
425  case Triple::sparcv9:
427  if (PositionIndependent) {
432  } else {
435  }
436  break;
437  case Triple::systemz:
438  // All currently-defined code models guarantee that 4-byte PC-relative
439  // values will be in range.
440  if (PositionIndependent) {
446  } else {
450  }
451  break;
452  default:
453  break;
454  }
455 
456  unsigned EHSectionType = T.getArch() == Triple::x86_64
459 
460  // Solaris requires different flags for .eh_frame to seemingly every other
461  // platform.
462  unsigned EHSectionFlags = ELF::SHF_ALLOC;
463  if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
464  EHSectionFlags |= ELF::SHF_WRITE;
465 
466  // ELF
469 
472 
475 
478 
480  Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
482 
485 
486  DataRelROSection = Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
488 
490  Ctx->getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
491  ELF::SHF_ALLOC | ELF::SHF_MERGE, 4, "");
492 
494  Ctx->getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
495  ELF::SHF_ALLOC | ELF::SHF_MERGE, 8, "");
496 
498  Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
499  ELF::SHF_ALLOC | ELF::SHF_MERGE, 16, "");
500 
502  Ctx->getELFSection(".rodata.cst32", ELF::SHT_PROGBITS,
503  ELF::SHF_ALLOC | ELF::SHF_MERGE, 32, "");
504 
505  // Exception Handling Sections.
506 
507  // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
508  // it contains relocatable pointers. In PIC mode, this is probably a big
509  // runtime hit for C++ apps. Either the contents of the LSDA need to be
510  // adjusted or this should be a data section.
511  LSDASection = Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
513 
514  COFFDebugSymbolsSection = nullptr;
515  COFFDebugTypesSection = nullptr;
516 
517  unsigned DebugSecType = ELF::SHT_PROGBITS;
518 
519  // MIPS .debug_* sections should have SHT_MIPS_DWARF section type
520  // to distinguish among sections contain DWARF and ECOFF debug formats.
521  // Sections with ECOFF debug format are obsoleted and marked by SHT_PROGBITS.
522  if (T.getArch() == Triple::mips || T.getArch() == Triple::mipsel ||
524  DebugSecType = ELF::SHT_MIPS_DWARF;
525 
526  // Debug Info Sections.
528  Ctx->getELFSection(".debug_abbrev", DebugSecType, 0);
529  DwarfInfoSection = Ctx->getELFSection(".debug_info", DebugSecType, 0);
530  DwarfLineSection = Ctx->getELFSection(".debug_line", DebugSecType, 0);
531  DwarfFrameSection = Ctx->getELFSection(".debug_frame", DebugSecType, 0);
533  Ctx->getELFSection(".debug_pubnames", DebugSecType, 0);
535  Ctx->getELFSection(".debug_pubtypes", DebugSecType, 0);
537  Ctx->getELFSection(".debug_gnu_pubnames", DebugSecType, 0);
539  Ctx->getELFSection(".debug_gnu_pubtypes", DebugSecType, 0);
541  Ctx->getELFSection(".debug_str", DebugSecType,
543  DwarfLocSection = Ctx->getELFSection(".debug_loc", DebugSecType, 0);
545  Ctx->getELFSection(".debug_aranges", DebugSecType, 0);
547  Ctx->getELFSection(".debug_ranges", DebugSecType, 0);
549  Ctx->getELFSection(".debug_macinfo", DebugSecType, 0);
550 
551  // DWARF5 Experimental Debug Info
552 
553  // Accelerator Tables
555  Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0);
557  Ctx->getELFSection(".apple_objc", ELF::SHT_PROGBITS, 0);
559  Ctx->getELFSection(".apple_namespaces", ELF::SHT_PROGBITS, 0);
561  Ctx->getELFSection(".apple_types", ELF::SHT_PROGBITS, 0);
562 
563  // String Offset and Address Sections
565  Ctx->getELFSection(".debug_str_offsets", DebugSecType, 0);
566  DwarfAddrSection = Ctx->getELFSection(".debug_addr", DebugSecType, 0);
567 
568  // Fission Sections
570  Ctx->getELFSection(".debug_info.dwo", DebugSecType, 0);
572  Ctx->getELFSection(".debug_types.dwo", DebugSecType, 0);
574  Ctx->getELFSection(".debug_abbrev.dwo", DebugSecType, 0);
576  Ctx->getELFSection(".debug_str.dwo", DebugSecType,
579  Ctx->getELFSection(".debug_line.dwo", DebugSecType, 0);
581  Ctx->getELFSection(".debug_loc.dwo", DebugSecType, 0);
583  Ctx->getELFSection(".debug_str_offsets.dwo", DebugSecType, 0);
584 
585  // DWP Sections
587  Ctx->getELFSection(".debug_cu_index", DebugSecType, 0);
589  Ctx->getELFSection(".debug_tu_index", DebugSecType, 0);
590 
592  Ctx->getELFSection(".llvm_stackmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
593 
595  Ctx->getELFSection(".llvm_faultmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
596 
598  Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
599 }
600 
601 void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
606 
607  // Set the `IMAGE_SCN_MEM_16BIT` flag when compiling for thumb mode. This is
608  // used to indicate to the linker that the text segment contains thumb instructions
609  // and to set the ISA selection bit for calls accordingly.
610  const bool IsThumb = T.getArch() == Triple::thumb;
611 
613 
614  // COFF
615  BSSSection = Ctx->getCOFFSection(
620  ".text",
632 
633  // FIXME: We're emitting LSDA info into a readonly section on COFF, even
634  // though it contains relocatable pointers. In PIC mode, this is probably a
635  // big runtime hit for C++ apps. Either the contents of the LSDA need to be
636  // adjusted or this should be a data section.
637  if (T.getArch() == Triple::x86_64) {
638  // On Windows 64 with SEH, the LSDA is emitted into the .xdata section
639  LSDASection = nullptr;
640  } else {
641  LSDASection = Ctx->getCOFFSection(".gcc_except_table",
645  }
646 
647  // Debug info.
658 
660  ".debug_abbrev",
663  SectionKind::getMetadata(), "section_abbrev");
665  ".debug_info",
668  SectionKind::getMetadata(), "section_info");
670  ".debug_line",
673  SectionKind::getMetadata(), "section_line");
674 
676  ".debug_frame",
681  ".debug_pubnames",
686  ".debug_pubtypes",
691  ".debug_gnu_pubnames",
696  ".debug_gnu_pubtypes",
701  ".debug_str",
704  SectionKind::getMetadata(), "info_string");
706  ".debug_str_offsets",
709  SectionKind::getMetadata(), "section_str_off");
711  ".debug_loc",
714  SectionKind::getMetadata(), "section_debug_loc");
716  ".debug_aranges",
721  ".debug_ranges",
724  SectionKind::getMetadata(), "debug_range");
726  ".debug_macinfo",
729  SectionKind::getMetadata(), "debug_macinfo");
731  ".debug_info.dwo",
734  SectionKind::getMetadata(), "section_info_dwo");
736  ".debug_types.dwo",
739  SectionKind::getMetadata(), "section_types_dwo");
741  ".debug_abbrev.dwo",
744  SectionKind::getMetadata(), "section_abbrev_dwo");
746  ".debug_str.dwo",
749  SectionKind::getMetadata(), "skel_string");
751  ".debug_line.dwo",
756  ".debug_loc.dwo",
759  SectionKind::getMetadata(), "skel_loc");
761  ".debug_str_offsets.dwo",
764  SectionKind::getMetadata(), "section_str_off_dwo");
766  ".debug_addr",
769  SectionKind::getMetadata(), "addr_sec");
771  ".debug_cu_index",
776  ".debug_tu_index",
781  ".apple_names",
784  SectionKind::getMetadata(), "names_begin");
786  ".apple_namespaces",
789  SectionKind::getMetadata(), "namespac_begin");
791  ".apple_types",
794  SectionKind::getMetadata(), "types_begin");
796  ".apple_objc",
799  SectionKind::getMetadata(), "objc_begin");
800 
804 
808 
812 
815 
820 
821  StackMapSection = Ctx->getCOFFSection(".llvm_stackmaps",
825 }
826 
827 void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
828  // TODO: Set the section types and flags.
829  TextSection = Ctx->getWasmSection(".text", 0, 0);
830  DataSection = Ctx->getWasmSection(".data", 0, 0);
831 
832  // TODO: Set the section types and flags.
833  DwarfLineSection = Ctx->getWasmSection(".debug_line", 0, 0);
834  DwarfStrSection = Ctx->getWasmSection(".debug_str", 0, 0);
835  DwarfLocSection = Ctx->getWasmSection(".debug_loc", 0, 0);
836  DwarfAbbrevSection = Ctx->getWasmSection(".debug_abbrev", 0, 0, "section_abbrev");
837  DwarfARangesSection = Ctx->getWasmSection(".debug_aranges", 0, 0);
838  DwarfRangesSection = Ctx->getWasmSection(".debug_ranges", 0, 0, "debug_range");
839  DwarfMacinfoSection = Ctx->getWasmSection(".debug_macinfo", 0, 0, "debug_macinfo");
840  DwarfAddrSection = Ctx->getWasmSection(".debug_addr", 0, 0);
841  DwarfCUIndexSection = Ctx->getWasmSection(".debug_cu_index", 0, 0);
842  DwarfTUIndexSection = Ctx->getWasmSection(".debug_tu_index", 0, 0);
843  DwarfInfoSection = Ctx->getWasmSection(".debug_info", 0, 0, "section_info");
844  DwarfFrameSection = Ctx->getWasmSection(".debug_frame", 0, 0);
845  DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", 0, 0);
846  DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", 0, 0);
847 
848  // TODO: Define more sections.
849 }
850 
851 void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
852  CodeModel::Model cm,
853  MCContext &ctx) {
854  PositionIndependent = PIC;
855  CMModel = cm;
856  Ctx = &ctx;
857 
858  // Common.
863 
866 
868 
869  EHFrameSection = nullptr; // Created on demand.
870  CompactUnwindSection = nullptr; // Used only by selected targets.
871  DwarfAccelNamesSection = nullptr; // Used only by selected targets.
872  DwarfAccelObjCSection = nullptr; // Used only by selected targets.
873  DwarfAccelNamespaceSection = nullptr; // Used only by selected targets.
874  DwarfAccelTypesSection = nullptr; // Used only by selected targets.
875 
876  TT = TheTriple;
877 
878  switch (TT.getObjectFormat()) {
879  case Triple::MachO:
880  Env = IsMachO;
881  initMachOMCObjectFileInfo(TT);
882  break;
883  case Triple::COFF:
884  if (!TT.isOSWindows())
886  "Cannot initialize MC for non-Windows COFF object files.");
887 
888  Env = IsCOFF;
889  initCOFFMCObjectFileInfo(TT);
890  break;
891  case Triple::ELF:
892  Env = IsELF;
893  initELFMCObjectFileInfo(TT);
894  break;
895  case Triple::Wasm:
896  Env = IsWasm;
897  initWasmMCObjectFileInfo(TT);
898  break;
900  report_fatal_error("Cannot initialize MC for unknown object file format.");
901  break;
902  }
903 }
904 
906  return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
907  0, utostr(Hash));
908 }
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
MCSection * MergeableConst4Section
static SectionKind getData()
Definition: SectionKind.h:202
MCSection * DwarfStrOffSection
The DWARF v5 string offset and address table sections.
S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
Definition: MachO.h:132
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:283
MCSectionWasm * getWasmSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:444
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:103
MCSection * DwarfPubTypesSection
MCSection * DwarfGnuPubTypesSection
Section for newer gnu pubtypes.
MCSection * StackMapSection
StackMap section.
MCSection * SixteenByteConstantSection
unsigned PersonalityEncoding
PersonalityEncoding, LSDAEncoding, TTypeEncoding - Some encoding values for EH.
MCSection * TextSection
Section directive for standard text.
MCSection * ConstTextCoalSection
bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isMacOSXVersionLT - Comparison function for checking OS X version compatibility, which handles suppor...
Definition: Triple.h:423
MCSection * LazySymbolPointerSection
static SectionKind getMergeableConst8()
Definition: SectionKind.h:193
static SectionKind getMergeableConst16()
Definition: SectionKind.h:194
static SectionKind getMergeable1ByteCString()
Definition: SectionKind.h:183
S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure data.
Definition: MachO.h:165
setjmp/longjmp based exceptions
MCSection * getDwarfTypesSection(uint64_t Hash) const
static SectionKind getMergeableConst4()
Definition: SectionKind.h:192
static bool useCompactUnwind(const Triple &T)
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
Definition: MCContext.cpp:420
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:551
void InitMCObjectFileInfo(const Triple &TT, bool PIC, CodeModel::Model CM, MCContext &ctx)
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:438
MCSection * MergeableConst32Section
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
Definition: MachO.h:192
S_4BYTE_LITERALS - Section with 4 byte literals.
Definition: MachO.h:126
static SectionKind getBSS()
Definition: SectionKind.h:198
MCSection * COFFDebugTypesSection
MCSection * MergeableConst16Section
MCSection * DwarfPubNamesSection
S_8BYTE_LITERALS - Section with 8 byte literals.
Definition: MachO.h:128
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:311
MCSection * EightByteConstantSection
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
Context object for machine code objects.
Definition: MCContext.h:59
const MCSection * DwarfDebugInlineSection
MCSectionMachO * getMachOSection(StringRef Segment, StringRef Section, unsigned TypeAndAttributes, unsigned Reserved2, SectionKind K, const char *BeginSymName=nullptr)
Return the MCSection for the specified mach-o section.
Definition: MCContext.cpp:271
MCSection * DrectveSection
COFF specific sections.
static std::string utostr(uint64_t X, bool isNeg=false)
Definition: StringExtras.h:160
MCSection * DwarfAccelNamesSection
DWARF5 Experimental Debug Info Sections DwarfAccelNamesSection, DwarfAccelObjCSection, DwarfAccelNamespaceSection, DwarfAccelTypesSection - If we use the DWARF accelerated hash tables then we want to emit these sections.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:281
MCSection * DataSection
Section directive for standard data.
SectionCharacteristics
Definition: COFF.h:281
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:447
MCSection * ThreadLocalPointerSection
MCSection * TLSTLVSection
Section for thread local structure information.
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
Definition: MachO.h:162
MCSection * DwarfAccelNamespaceSection
ExceptionHandling getExceptionHandlingType() const
Definition: MCAsmInfo.h:554
S_THREAD_LOCAL_REGULAR - Thread local data section.
Definition: MachO.h:160
bool SupportsCompactUnwindWithoutEHFrame
True if the target object file supports emitting a compact unwind section without an associated EH fr...
S_CSTRING_LITERALS - Section with literal C strings.
Definition: MachO.h:124
bool CommDirectiveSupportsAlignment
True if .comm supports alignment.
bool isOSSolaris() const
Definition: Triple.h:488
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
MCSection * COFFDebugSymbolsSection
MCSection * DwarfAbbrevSection
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:466
MCSection * EHFrameSection
EH frame section.
S_ATTR_DEBUG - A debug section.
Definition: MachO.h:197
S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
Definition: MachO.h:134
MCSection * DwarfTypesDWOSection
static SectionKind getThreadBSS()
Definition: SectionKind.h:196
MCSection * DwarfRangesSection
S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread local structures.
Definition: MachO.h:168
static SectionKind getMetadata()
Definition: SectionKind.h:179
static SectionKind getReadOnlyWithRel()
Definition: SectionKind.h:203
MCSection * DwarfARangesSection
MCSection * CompactUnwindSection
If exception handling is supported by the target and the target can support a compact representation ...
MCSection * DwarfAccelTypesSection
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local variable initialization pointers to...
Definition: MachO.h:171
MCSection * DwarfStrOffDWOSection
S_16BYTE_LITERALS - Section with only 16 byte literals.
Definition: MachO.h:153
MCSection * DwarfGnuPubNamesSection
Section for newer gnu pubnames.
MCSection * DwarfAbbrevDWOSection
MCSection * FaultMapSection
FaultMap section.
bool OmitDwarfIfHaveCompactUnwind
OmitDwarfIfHaveCompactUnwind - True if the target object file supports having some functions with com...
MCSection * FourByteConstantSection
bool isWatchABI() const
Definition: Triple.h:461
static SectionKind getMergeable2ByteCString()
Definition: SectionKind.h:186
MCSection * LSDASection
If exception handling is supported by the target, this is the section the Language Specific Data Area...
S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section in files with the MY_DYLDLINK f...
Definition: MachO.h:188
MCSection * TLSExtraDataSection
Extra TLS Variable Data section.
unsigned CompactUnwindDwarfEHFrameOnly
Compact unwind encoding indicating that we should emit only an EH frame.
bool isOSFreeBSD() const
Definition: Triple.h:478
MCSection * DwarfAccelObjCSection
S_COALESCED - Section contains symbols that are to be coalesced.
Definition: MachO.h:145
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
MCSection * NonLazySymbolPointerSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:379
const MCSection * TLSThreadInitSection
Section for thread local data initialization functions.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:235
bool SupportsWeakOmittedEHFrame
True if target object file supports a weak_definition of constant 0 for an omitted EH frame...
std::string Hash(const Unit &U)
Definition: FuzzerSHA1.cpp:216
MCSection * BSSSection
Section that is default initialized to zero.
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
S_ZEROFILL - Zero fill on demand section.
Definition: MachO.h:122
MCSection * DwarfMacinfoSection
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
Definition: MachO.h:182
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents...
Definition: MachO.h:185
static SectionKind getReadOnly()
Definition: SectionKind.h:182
static SectionKind getText()
Definition: SectionKind.h:180
MCSection * MergeableConst8Section