LLVM  14.0.0git
MCObjectFileInfo.cpp
Go to the documentation of this file.
1 //===-- MCObjectFileInfo.cpp - Object File Information --------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/StringExtras.h"
11 #include "llvm/ADT/Triple.h"
12 #include "llvm/BinaryFormat/COFF.h"
13 #include "llvm/BinaryFormat/ELF.h"
14 #include "llvm/BinaryFormat/Wasm.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/MCSectionGOFF.h"
21 #include "llvm/MC/MCSectionMachO.h"
22 #include "llvm/MC/MCSectionWasm.h"
23 #include "llvm/MC/MCSectionXCOFF.h"
24 
25 using namespace llvm;
26 
27 static bool useCompactUnwind(const Triple &T) {
28  // Only on darwin.
29  if (!T.isOSDarwin())
30  return false;
31 
32  // aarch64 always has it.
33  if (T.getArch() == Triple::aarch64 || T.getArch() == Triple::aarch64_32)
34  return true;
35 
36  // armv7k always has it.
37  if (T.isWatchABI())
38  return true;
39 
40  // Use it on newer version of OS X.
41  if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
42  return true;
43 
44  // And the iOS simulator.
45  if (T.isiOS() && T.isX86())
46  return true;
47 
48  return false;
49 }
50 
51 void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
52  // MachO
54 
56  "__TEXT", "__eh_frame",
60 
61  if (T.isOSDarwin() &&
62  (T.getArch() == Triple::aarch64 || T.getArch() == Triple::aarch64_32))
64 
65  if (T.isWatchABI())
67 
69 
70  // .comm doesn't support alignment before Leopard.
71  if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
73 
74  TextSection // .text
75  = Ctx->getMachOSection("__TEXT", "__text",
78  DataSection // .data
79  = Ctx->getMachOSection("__DATA", "__data", 0, SectionKind::getData());
80 
81  // BSSSection might not be expected initialized on msvc.
82  BSSSection = nullptr;
83 
84  TLSDataSection // .tdata
85  = Ctx->getMachOSection("__DATA", "__thread_data",
88  TLSBSSSection // .tbss
89  = Ctx->getMachOSection("__DATA", "__thread_bss",
92 
93  // TODO: Verify datarel below.
94  TLSTLVSection // .tlv
95  = Ctx->getMachOSection("__DATA", "__thread_vars",
98 
100  "__DATA", "__thread_init", MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
102 
103  CStringSection // .cstring
104  = Ctx->getMachOSection("__TEXT", "__cstring",
108  = Ctx->getMachOSection("__TEXT","__ustring", 0,
110  FourByteConstantSection // .literal4
111  = Ctx->getMachOSection("__TEXT", "__literal4",
114  EightByteConstantSection // .literal8
115  = Ctx->getMachOSection("__TEXT", "__literal8",
118 
119  SixteenByteConstantSection // .literal16
120  = Ctx->getMachOSection("__TEXT", "__literal16",
123 
124  ReadOnlySection // .const
125  = Ctx->getMachOSection("__TEXT", "__const", 0,
127 
128  // If the target is not powerpc, map the coal sections to the non-coal
129  // sections.
130  //
131  // "__TEXT/__textcoal_nt" => section "__TEXT/__text"
132  // "__TEXT/__const_coal" => section "__TEXT/__const"
133  // "__DATA/__datacoal_nt" => section "__DATA/__data"
134  Triple::ArchType ArchTy = T.getArch();
135 
136  ConstDataSection // .const_data
137  = Ctx->getMachOSection("__DATA", "__const", 0,
139 
140  if (ArchTy == Triple::ppc || ArchTy == Triple::ppc64) {
142  = Ctx->getMachOSection("__TEXT", "__textcoal_nt",
147  = Ctx->getMachOSection("__TEXT", "__const_coal",
151  "__DATA", "__datacoal_nt", MachO::S_COALESCED, SectionKind::getData());
153  } else {
158  }
159 
161  = Ctx->getMachOSection("__DATA","__common",
165  = Ctx->getMachOSection("__DATA","__bss", MachO::S_ZEROFILL,
167 
168 
170  = Ctx->getMachOSection("__DATA", "__la_symbol_ptr",
174  = Ctx->getMachOSection("__DATA", "__nl_symbol_ptr",
177 
179  = Ctx->getMachOSection("__DATA", "__thread_ptr",
182 
183  // Exception Handling.
184  LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
186 
187  COFFDebugSymbolsSection = nullptr;
188  COFFDebugTypesSection = nullptr;
189  COFFGlobalTypeHashesSection = nullptr;
190 
191  if (useCompactUnwind(T)) {
193  Ctx->getMachOSection("__LD", "__compact_unwind", MachO::S_ATTR_DEBUG,
195 
196  if (T.isX86())
197  CompactUnwindDwarfEHFrameOnly = 0x04000000; // UNWIND_X86_64_MODE_DWARF
198  else if (T.getArch() == Triple::aarch64 || T.getArch() == Triple::aarch64_32)
199  CompactUnwindDwarfEHFrameOnly = 0x03000000; // UNWIND_ARM64_MODE_DWARF
200  else if (T.getArch() == Triple::arm || T.getArch() == Triple::thumb)
201  CompactUnwindDwarfEHFrameOnly = 0x04000000; // UNWIND_ARM_MODE_DWARF
202  }
203 
204  // Debug Information.
206  Ctx->getMachOSection("__DWARF", "__debug_names", MachO::S_ATTR_DEBUG,
207  SectionKind::getMetadata(), "debug_names_begin");
209  Ctx->getMachOSection("__DWARF", "__apple_names", MachO::S_ATTR_DEBUG,
210  SectionKind::getMetadata(), "names_begin");
212  Ctx->getMachOSection("__DWARF", "__apple_objc", MachO::S_ATTR_DEBUG,
213  SectionKind::getMetadata(), "objc_begin");
214  // 16 character section limit...
216  Ctx->getMachOSection("__DWARF", "__apple_namespac", MachO::S_ATTR_DEBUG,
217  SectionKind::getMetadata(), "namespac_begin");
219  Ctx->getMachOSection("__DWARF", "__apple_types", MachO::S_ATTR_DEBUG,
220  SectionKind::getMetadata(), "types_begin");
221 
223  Ctx->getMachOSection("__DWARF", "__swift_ast", MachO::S_ATTR_DEBUG,
225 
227  Ctx->getMachOSection("__DWARF", "__debug_abbrev", MachO::S_ATTR_DEBUG,
228  SectionKind::getMetadata(), "section_abbrev");
230  Ctx->getMachOSection("__DWARF", "__debug_info", MachO::S_ATTR_DEBUG,
231  SectionKind::getMetadata(), "section_info");
233  Ctx->getMachOSection("__DWARF", "__debug_line", MachO::S_ATTR_DEBUG,
234  SectionKind::getMetadata(), "section_line");
236  Ctx->getMachOSection("__DWARF", "__debug_line_str", MachO::S_ATTR_DEBUG,
237  SectionKind::getMetadata(), "section_line_str");
239  Ctx->getMachOSection("__DWARF", "__debug_frame", MachO::S_ATTR_DEBUG,
242  Ctx->getMachOSection("__DWARF", "__debug_pubnames", MachO::S_ATTR_DEBUG,
245  Ctx->getMachOSection("__DWARF", "__debug_pubtypes", MachO::S_ATTR_DEBUG,
248  Ctx->getMachOSection("__DWARF", "__debug_gnu_pubn", MachO::S_ATTR_DEBUG,
251  Ctx->getMachOSection("__DWARF", "__debug_gnu_pubt", MachO::S_ATTR_DEBUG,
254  Ctx->getMachOSection("__DWARF", "__debug_str", MachO::S_ATTR_DEBUG,
255  SectionKind::getMetadata(), "info_string");
257  Ctx->getMachOSection("__DWARF", "__debug_str_offs", MachO::S_ATTR_DEBUG,
258  SectionKind::getMetadata(), "section_str_off");
260  Ctx->getMachOSection("__DWARF", "__debug_addr", MachO::S_ATTR_DEBUG,
261  SectionKind::getMetadata(), "section_info");
263  Ctx->getMachOSection("__DWARF", "__debug_loc", MachO::S_ATTR_DEBUG,
264  SectionKind::getMetadata(), "section_debug_loc");
266  Ctx->getMachOSection("__DWARF", "__debug_loclists", MachO::S_ATTR_DEBUG,
267  SectionKind::getMetadata(), "section_debug_loc");
268 
270  Ctx->getMachOSection("__DWARF", "__debug_aranges", MachO::S_ATTR_DEBUG,
273  Ctx->getMachOSection("__DWARF", "__debug_ranges", MachO::S_ATTR_DEBUG,
274  SectionKind::getMetadata(), "debug_range");
276  Ctx->getMachOSection("__DWARF", "__debug_rnglists", MachO::S_ATTR_DEBUG,
277  SectionKind::getMetadata(), "debug_range");
279  Ctx->getMachOSection("__DWARF", "__debug_macinfo", MachO::S_ATTR_DEBUG,
280  SectionKind::getMetadata(), "debug_macinfo");
282  Ctx->getMachOSection("__DWARF", "__debug_macro", MachO::S_ATTR_DEBUG,
283  SectionKind::getMetadata(), "debug_macro");
285  Ctx->getMachOSection("__DWARF", "__debug_inlined", MachO::S_ATTR_DEBUG,
288  Ctx->getMachOSection("__DWARF", "__debug_cu_index", MachO::S_ATTR_DEBUG,
291  Ctx->getMachOSection("__DWARF", "__debug_tu_index", MachO::S_ATTR_DEBUG,
293  StackMapSection = Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps",
295 
296  FaultMapSection = Ctx->getMachOSection("__LLVM_FAULTMAPS", "__llvm_faultmaps",
298 
300  "__LLVM", "__remarks", MachO::S_ATTR_DEBUG, SectionKind::getMetadata());
301 
303 }
304 
305 void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
306  switch (T.getArch()) {
307  case Triple::mips:
308  case Triple::mipsel:
309  case Triple::mips64:
310  case Triple::mips64el:
311  // We cannot use DW_EH_PE_sdata8 for the large PositionIndependent case
312  // since there is no R_MIPS_PC64 relocation (only a 32-bit version).
313  if (PositionIndependent && !Large)
315  else
319  break;
320  case Triple::ppc64:
321  case Triple::ppc64le:
322  case Triple::aarch64:
323  case Triple::aarch64_be:
324  case Triple::x86_64:
327  break;
328  case Triple::bpfel:
329  case Triple::bpfeb:
331  break;
332  case Triple::hexagon:
334  PositionIndependent ? dwarf::DW_EH_PE_pcrel : dwarf::DW_EH_PE_absptr;
335  break;
336  default:
338  break;
339  }
340 
341  unsigned EHSectionType = T.getArch() == Triple::x86_64
344 
345  // Solaris requires different flags for .eh_frame to seemingly every other
346  // platform.
347  unsigned EHSectionFlags = ELF::SHF_ALLOC;
348  if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
349  EHSectionFlags |= ELF::SHF_WRITE;
350 
351  // ELF
354 
357 
360 
363 
365  Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
367 
370 
371  DataRelROSection = Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
373 
375  Ctx->getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
377 
379  Ctx->getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
381 
383  Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
385 
387  Ctx->getELFSection(".rodata.cst32", ELF::SHT_PROGBITS,
389 
390  // Exception Handling Sections.
391 
392  // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
393  // it contains relocatable pointers. In PIC mode, this is probably a big
394  // runtime hit for C++ apps. Either the contents of the LSDA need to be
395  // adjusted or this should be a data section.
396  LSDASection = Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
398 
399  COFFDebugSymbolsSection = nullptr;
400  COFFDebugTypesSection = nullptr;
401 
402  unsigned DebugSecType = ELF::SHT_PROGBITS;
403 
404  // MIPS .debug_* sections should have SHT_MIPS_DWARF section type
405  // to distinguish among sections contain DWARF and ECOFF debug formats.
406  // Sections with ECOFF debug format are obsoleted and marked by SHT_PROGBITS.
407  if (T.isMIPS())
408  DebugSecType = ELF::SHT_MIPS_DWARF;
409 
410  // Debug Info Sections.
412  Ctx->getELFSection(".debug_abbrev", DebugSecType, 0);
413  DwarfInfoSection = Ctx->getELFSection(".debug_info", DebugSecType, 0);
414  DwarfLineSection = Ctx->getELFSection(".debug_line", DebugSecType, 0);
416  Ctx->getELFSection(".debug_line_str", DebugSecType,
418  DwarfFrameSection = Ctx->getELFSection(".debug_frame", DebugSecType, 0);
420  Ctx->getELFSection(".debug_pubnames", DebugSecType, 0);
422  Ctx->getELFSection(".debug_pubtypes", DebugSecType, 0);
424  Ctx->getELFSection(".debug_gnu_pubnames", DebugSecType, 0);
426  Ctx->getELFSection(".debug_gnu_pubtypes", DebugSecType, 0);
428  Ctx->getELFSection(".debug_str", DebugSecType,
430  DwarfLocSection = Ctx->getELFSection(".debug_loc", DebugSecType, 0);
432  Ctx->getELFSection(".debug_aranges", DebugSecType, 0);
434  Ctx->getELFSection(".debug_ranges", DebugSecType, 0);
436  Ctx->getELFSection(".debug_macinfo", DebugSecType, 0);
437  DwarfMacroSection = Ctx->getELFSection(".debug_macro", DebugSecType, 0);
438 
439  // DWARF5 Experimental Debug Info
440 
441  // Accelerator Tables
443  Ctx->getELFSection(".debug_names", ELF::SHT_PROGBITS, 0);
445  Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0);
447  Ctx->getELFSection(".apple_objc", ELF::SHT_PROGBITS, 0);
449  Ctx->getELFSection(".apple_namespaces", ELF::SHT_PROGBITS, 0);
451  Ctx->getELFSection(".apple_types", ELF::SHT_PROGBITS, 0);
452 
453  // String Offset and Address Sections
455  Ctx->getELFSection(".debug_str_offsets", DebugSecType, 0);
456  DwarfAddrSection = Ctx->getELFSection(".debug_addr", DebugSecType, 0);
457  DwarfRnglistsSection = Ctx->getELFSection(".debug_rnglists", DebugSecType, 0);
458  DwarfLoclistsSection = Ctx->getELFSection(".debug_loclists", DebugSecType, 0);
459 
460  // Fission Sections
462  Ctx->getELFSection(".debug_info.dwo", DebugSecType, ELF::SHF_EXCLUDE);
464  Ctx->getELFSection(".debug_types.dwo", DebugSecType, ELF::SHF_EXCLUDE);
466  Ctx->getELFSection(".debug_abbrev.dwo", DebugSecType, ELF::SHF_EXCLUDE);
468  ".debug_str.dwo", DebugSecType,
471  Ctx->getELFSection(".debug_line.dwo", DebugSecType, ELF::SHF_EXCLUDE);
473  Ctx->getELFSection(".debug_loc.dwo", DebugSecType, ELF::SHF_EXCLUDE);
474  DwarfStrOffDWOSection = Ctx->getELFSection(".debug_str_offsets.dwo",
475  DebugSecType, ELF::SHF_EXCLUDE);
477  Ctx->getELFSection(".debug_rnglists.dwo", DebugSecType, ELF::SHF_EXCLUDE);
479  Ctx->getELFSection(".debug_macinfo.dwo", DebugSecType, ELF::SHF_EXCLUDE);
481  Ctx->getELFSection(".debug_macro.dwo", DebugSecType, ELF::SHF_EXCLUDE);
482 
484  Ctx->getELFSection(".debug_loclists.dwo", DebugSecType, ELF::SHF_EXCLUDE);
485 
486  // DWP Sections
488  Ctx->getELFSection(".debug_cu_index", DebugSecType, 0);
490  Ctx->getELFSection(".debug_tu_index", DebugSecType, 0);
491 
493  Ctx->getELFSection(".llvm_stackmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
494 
496  Ctx->getELFSection(".llvm_faultmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
497 
499  Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
500 
501  StackSizesSection = Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, 0);
502 
503  PseudoProbeSection = Ctx->getELFSection(".pseudo_probe", DebugSecType, 0);
505  Ctx->getELFSection(".pseudo_probe_desc", DebugSecType, 0);
506 }
507 
508 void MCObjectFileInfo::initGOFFMCObjectFileInfo(const Triple &T) {
511 }
512 
513 void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
518 
519  // Set the `IMAGE_SCN_MEM_16BIT` flag when compiling for thumb mode. This is
520  // used to indicate to the linker that the text segment contains thumb instructions
521  // and to set the ISA selection bit for calls accordingly.
522  const bool IsThumb = T.getArch() == Triple::thumb;
523 
525 
526  // COFF
527  BSSSection = Ctx->getCOFFSection(
532  ".text",
544 
545  if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::aarch64) {
546  // On Windows 64 with SEH, the LSDA is emitted into the .xdata section
547  LSDASection = nullptr;
548  } else {
549  LSDASection = Ctx->getCOFFSection(".gcc_except_table",
553  }
554 
555  // Debug info.
567  ".debug$H",
571 
573  ".debug_abbrev",
576  SectionKind::getMetadata(), "section_abbrev");
578  ".debug_info",
581  SectionKind::getMetadata(), "section_info");
583  ".debug_line",
586  SectionKind::getMetadata(), "section_line");
588  ".debug_line_str",
591  SectionKind::getMetadata(), "section_line_str");
593  ".debug_frame",
598  ".debug_pubnames",
603  ".debug_pubtypes",
608  ".debug_gnu_pubnames",
613  ".debug_gnu_pubtypes",
618  ".debug_str",
621  SectionKind::getMetadata(), "info_string");
623  ".debug_str_offsets",
626  SectionKind::getMetadata(), "section_str_off");
628  ".debug_loc",
631  SectionKind::getMetadata(), "section_debug_loc");
633  ".debug_loclists",
636  SectionKind::getMetadata(), "section_debug_loclists");
638  ".debug_aranges",
643  ".debug_ranges",
646  SectionKind::getMetadata(), "debug_range");
648  ".debug_rnglists",
651  SectionKind::getMetadata(), "debug_rnglists");
653  ".debug_macinfo",
656  SectionKind::getMetadata(), "debug_macinfo");
658  ".debug_macro",
661  SectionKind::getMetadata(), "debug_macro");
663  ".debug_macinfo.dwo",
666  SectionKind::getMetadata(), "debug_macinfo.dwo");
668  ".debug_macro.dwo",
671  SectionKind::getMetadata(), "debug_macro.dwo");
673  ".debug_info.dwo",
676  SectionKind::getMetadata(), "section_info_dwo");
678  ".debug_types.dwo",
681  SectionKind::getMetadata(), "section_types_dwo");
683  ".debug_abbrev.dwo",
686  SectionKind::getMetadata(), "section_abbrev_dwo");
688  ".debug_str.dwo",
691  SectionKind::getMetadata(), "skel_string");
693  ".debug_line.dwo",
698  ".debug_loc.dwo",
701  SectionKind::getMetadata(), "skel_loc");
703  ".debug_str_offsets.dwo",
706  SectionKind::getMetadata(), "section_str_off_dwo");
708  ".debug_addr",
711  SectionKind::getMetadata(), "addr_sec");
713  ".debug_cu_index",
718  ".debug_tu_index",
723  ".debug_names",
726  SectionKind::getMetadata(), "debug_names_begin");
728  ".apple_names",
731  SectionKind::getMetadata(), "names_begin");
733  ".apple_namespaces",
736  SectionKind::getMetadata(), "namespac_begin");
738  ".apple_types",
741  SectionKind::getMetadata(), "types_begin");
743  ".apple_objc",
746  SectionKind::getMetadata(), "objc_begin");
747 
751 
755 
759 
762 
763  GEHContSection = Ctx->getCOFFSection(".gehcont$y",
767 
768  GFIDsSection = Ctx->getCOFFSection(".gfids$y",
772 
773  GIATsSection = Ctx->getCOFFSection(".giats$y",
777 
778  GLJMPSection = Ctx->getCOFFSection(".gljmp$y",
782 
787 
788  StackMapSection = Ctx->getCOFFSection(".llvm_stackmaps",
792 }
793 
794 void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
797 
799  Ctx->getWasmSection(".debug_line", SectionKind::getMetadata());
801  Ctx->getWasmSection(".debug_line_str", SectionKind::getMetadata(),
806  Ctx->getWasmSection(".debug_loc", SectionKind::getMetadata());
808  Ctx->getWasmSection(".debug_abbrev", SectionKind::getMetadata());
809  DwarfARangesSection = Ctx->getWasmSection(".debug_aranges", SectionKind::getMetadata());
811  Ctx->getWasmSection(".debug_ranges", SectionKind::getMetadata());
813  Ctx->getWasmSection(".debug_macinfo", SectionKind::getMetadata());
815  Ctx->getWasmSection(".debug_macro", SectionKind::getMetadata());
816  DwarfCUIndexSection = Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata());
817  DwarfTUIndexSection = Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata());
819  Ctx->getWasmSection(".debug_info", SectionKind::getMetadata());
821  DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata());
822  DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata());
824  Ctx->getWasmSection(".debug_gnu_pubnames", SectionKind::getMetadata());
826  Ctx->getWasmSection(".debug_gnu_pubtypes", SectionKind::getMetadata());
827 
829  Ctx->getWasmSection(".debug_names", SectionKind::getMetadata());
831  Ctx->getWasmSection(".debug_str_offsets", SectionKind::getMetadata());
833  Ctx->getWasmSection(".debug_addr", SectionKind::getMetadata());
835  Ctx->getWasmSection(".debug_rnglists", SectionKind::getMetadata());
837  Ctx->getWasmSection(".debug_loclists", SectionKind::getMetadata());
838 
839  // Fission Sections
841  Ctx->getWasmSection(".debug_info.dwo", SectionKind::getMetadata());
843  Ctx->getWasmSection(".debug_types.dwo", SectionKind::getMetadata());
845  Ctx->getWasmSection(".debug_abbrev.dwo", SectionKind::getMetadata());
847  Ctx->getWasmSection(".debug_str.dwo", SectionKind::getMetadata(),
850  Ctx->getWasmSection(".debug_line.dwo", SectionKind::getMetadata());
852  Ctx->getWasmSection(".debug_loc.dwo", SectionKind::getMetadata());
854  Ctx->getWasmSection(".debug_str_offsets.dwo", SectionKind::getMetadata());
856  Ctx->getWasmSection(".debug_rnglists.dwo", SectionKind::getMetadata());
858  Ctx->getWasmSection(".debug_macinfo.dwo", SectionKind::getMetadata());
860  Ctx->getWasmSection(".debug_macro.dwo", SectionKind::getMetadata());
861 
863  Ctx->getWasmSection(".debug_loclists.dwo", SectionKind::getMetadata());
864 
865  // DWP Sections
867  Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata());
869  Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata());
870 
871  // Wasm use data section for LSDA.
872  // TODO Consider putting each function's exception table in a separate
873  // section, as in -function-sections, to facilitate lld's --gc-section.
874  LSDASection = Ctx->getWasmSection(".rodata.gcc_except_table",
876 
877  // TODO: Define more sections.
878 }
879 
880 void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
881  // The default csect for program code. Functions without a specified section
882  // get placed into this csect. The choice of csect name is not a property of
883  // the ABI or object file format. For example, the XL compiler uses an unnamed
884  // csect for program code.
886  ".text", SectionKind::getText(),
888  /* MultiSymbolsAllowed*/ true);
889 
891  ".data", SectionKind::getData(),
893  /* MultiSymbolsAllowed*/ true);
894 
896  ".rodata", SectionKind::getReadOnly(),
898  /* MultiSymbolsAllowed*/ true);
900 
902  ".rodata.8", SectionKind::getReadOnly(),
904  /* MultiSymbolsAllowed*/ true);
906 
908  ".rodata.16", SectionKind::getReadOnly(),
910  /* MultiSymbolsAllowed*/ true);
912 
914  ".tdata", SectionKind::getThreadData(),
916  /* MultiSymbolsAllowed*/ true);
917 
919  "TOC", SectionKind::getData(),
921  XCOFF::XTY_SD));
922 
923  // The TOC-base always has 0 size, but 4 byte alignment.
925 
927  ".gcc_except_table", SectionKind::getReadOnly(),
929  XCOFF::XTY_SD));
930 
932  ".eh_info_table", SectionKind::getData(),
934  XCOFF::XTY_SD));
935 
936  // DWARF sections for XCOFF are not csects. They are special STYP_DWARF
937  // sections, and the individual DWARF sections are distinguished by their
938  // section subtype.
940  ".dwabrev", SectionKind::getMetadata(), /* CsectProperties */ None,
941  /* MultiSymbolsAllowed */ true, ".dwabrev", XCOFF::SSUBTYP_DWABREV);
942 
944  ".dwinfo", SectionKind::getMetadata(), /* CsectProperties */ None,
945  /* MultiSymbolsAllowed */ true, ".dwinfo", XCOFF::SSUBTYP_DWINFO);
946 
948  ".dwline", SectionKind::getMetadata(), /* CsectProperties */ None,
949  /* MultiSymbolsAllowed */ true, ".dwline", XCOFF::SSUBTYP_DWLINE);
950 
952  ".dwframe", SectionKind::getMetadata(), /* CsectProperties */ None,
953  /* MultiSymbolsAllowed */ true, ".dwframe", XCOFF::SSUBTYP_DWFRAME);
954 
956  ".dwpbnms", SectionKind::getMetadata(), /* CsectProperties */ None,
957  /* MultiSymbolsAllowed */ true, ".dwpbnms", XCOFF::SSUBTYP_DWPBNMS);
958 
960  ".dwpbtyp", SectionKind::getMetadata(), /* CsectProperties */ None,
961  /* MultiSymbolsAllowed */ true, ".dwpbtyp", XCOFF::SSUBTYP_DWPBTYP);
962 
964  ".dwstr", SectionKind::getMetadata(), /* CsectProperties */ None,
965  /* MultiSymbolsAllowed */ true, ".dwstr", XCOFF::SSUBTYP_DWSTR);
966 
968  ".dwloc", SectionKind::getMetadata(), /* CsectProperties */ None,
969  /* MultiSymbolsAllowed */ true, ".dwloc", XCOFF::SSUBTYP_DWLOC);
970 
972  ".dwarnge", SectionKind::getMetadata(), /* CsectProperties */ None,
973  /* MultiSymbolsAllowed */ true, ".dwarnge", XCOFF::SSUBTYP_DWARNGE);
974 
976  ".dwrnges", SectionKind::getMetadata(), /* CsectProperties */ None,
977  /* MultiSymbolsAllowed */ true, ".dwrnges", XCOFF::SSUBTYP_DWRNGES);
978 
980  ".dwmac", SectionKind::getMetadata(), /* CsectProperties */ None,
981  /* MultiSymbolsAllowed */ true, ".dwmac", XCOFF::SSUBTYP_DWMAC);
982 }
983 
985 
987  bool LargeCodeModel) {
988  PositionIndependent = PIC;
989  Ctx = &MCCtx;
990 
991  // Common.
996 
998 
1000 
1001  EHFrameSection = nullptr; // Created on demand.
1002  CompactUnwindSection = nullptr; // Used only by selected targets.
1003  DwarfAccelNamesSection = nullptr; // Used only by selected targets.
1004  DwarfAccelObjCSection = nullptr; // Used only by selected targets.
1005  DwarfAccelNamespaceSection = nullptr; // Used only by selected targets.
1006  DwarfAccelTypesSection = nullptr; // Used only by selected targets.
1007 
1008  Triple TheTriple = Ctx->getTargetTriple();
1009  switch (Ctx->getObjectFileType()) {
1010  case MCContext::IsMachO:
1011  initMachOMCObjectFileInfo(TheTriple);
1012  break;
1013  case MCContext::IsCOFF:
1014  initCOFFMCObjectFileInfo(TheTriple);
1015  break;
1016  case MCContext::IsELF:
1017  initELFMCObjectFileInfo(TheTriple, LargeCodeModel);
1018  break;
1019  case MCContext::IsGOFF:
1020  initGOFFMCObjectFileInfo(TheTriple);
1021  break;
1022  case MCContext::IsWasm:
1023  initWasmMCObjectFileInfo(TheTriple);
1024  break;
1025  case MCContext::IsXCOFF:
1026  initXCOFFMCObjectFileInfo(TheTriple);
1027  break;
1028  }
1029 }
1030 
1031 MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name,
1032  uint64_t Hash) const {
1033  switch (Ctx->getTargetTriple().getObjectFormat()) {
1034  case Triple::ELF:
1036  utostr(Hash), /*IsComdat=*/true);
1037  case Triple::Wasm:
1038  return Ctx->getWasmSection(Name, SectionKind::getMetadata(), 0,
1039  utostr(Hash), MCContext::GenericSectionID);
1040  case Triple::MachO:
1041  case Triple::COFF:
1042  case Triple::GOFF:
1043  case Triple::XCOFF:
1045  report_fatal_error("Cannot get DWARF comdat section for this object file "
1046  "format: not implemented.");
1047  break;
1048  }
1049  llvm_unreachable("Unknown ObjectFormatType");
1050 }
1051 
1052 MCSection *
1054  if (Ctx->getObjectFileType() != MCContext::IsELF)
1055  return StackSizesSection;
1056 
1057  const MCSectionELF &ElfSec = static_cast<const MCSectionELF &>(TextSec);
1058  unsigned Flags = ELF::SHF_LINK_ORDER;
1059  StringRef GroupName;
1060  if (const MCSymbol *Group = ElfSec.getGroup()) {
1061  GroupName = Group->getName();
1062  Flags |= ELF::SHF_GROUP;
1063  }
1064 
1065  return Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, Flags, 0,
1066  GroupName, true, ElfSec.getUniqueID(),
1067  cast<MCSymbolELF>(TextSec.getBeginSymbol()));
1068 }
1069 
1070 MCSection *
1072  if (Ctx->getObjectFileType() != MCContext::IsELF)
1073  return nullptr;
1074 
1075  const MCSectionELF &ElfSec = static_cast<const MCSectionELF &>(TextSec);
1076  unsigned Flags = ELF::SHF_LINK_ORDER;
1077  StringRef GroupName;
1078  if (const MCSymbol *Group = ElfSec.getGroup()) {
1079  GroupName = Group->getName();
1080  Flags |= ELF::SHF_GROUP;
1081  }
1082 
1083  // Use the text section's begin symbol and unique ID to create a separate
1084  // .llvm_bb_addr_map section associated with every unique text section.
1085  return Ctx->getELFSection(".llvm_bb_addr_map", ELF::SHT_LLVM_BB_ADDR_MAP,
1086  Flags, 0, GroupName, true, ElfSec.getUniqueID(),
1087  cast<MCSymbolELF>(TextSec.getBeginSymbol()));
1088 }
1089 
1090 MCSection *
1092  if (Ctx->getObjectFileType() == MCContext::IsELF) {
1093  const auto *ElfSec = static_cast<const MCSectionELF *>(TextSec);
1094  // Create a separate section for probes that comes with a comdat function.
1095  if (const MCSymbol *Group = ElfSec->getGroup()) {
1096  auto *S = static_cast<MCSectionELF *>(PseudoProbeSection);
1097  auto Flags = S->getFlags() | ELF::SHF_GROUP;
1098  return Ctx->getELFSection(S->getName(), S->getType(), Flags,
1099  S->getEntrySize(), Group->getName(),
1100  /*IsComdat=*/true);
1101  }
1102  }
1103  return PseudoProbeSection;
1104 }
1105 
1106 MCSection *
1108  if (Ctx->getObjectFileType() == MCContext::IsELF) {
1109  // Create a separate comdat group for each function's descriptor in order
1110  // for the linker to deduplicate. The duplication, must be from different
1111  // tranlation unit, can come from:
1112  // 1. Inline functions defined in header files;
1113  // 2. ThinLTO imported funcions;
1114  // 3. Weak-linkage definitions.
1115  // Use a concatenation of the section name and the function name as the
1116  // group name so that descriptor-only groups won't be folded with groups of
1117  // code.
1118  if (Ctx->getTargetTriple().supportsCOMDAT() && !FuncName.empty()) {
1119  auto *S = static_cast<MCSectionELF *>(PseudoProbeDescSection);
1120  auto Flags = S->getFlags() | ELF::SHF_GROUP;
1121  return Ctx->getELFSection(S->getName(), S->getType(), Flags,
1122  S->getEntrySize(),
1123  S->getName() + "_" + FuncName,
1124  /*IsComdat=*/true);
1125  }
1126  }
1127  return PseudoProbeDescSection;
1128 }
llvm::MachO::S_CSTRING_LITERALS
@ S_CSTRING_LITERALS
S_CSTRING_LITERALS - Section with literal C strings.
Definition: MachO.h:129
llvm::ELF::SHF_GROUP
@ SHF_GROUP
Definition: ELF.h:1016
llvm::MCObjectFileInfo::TextCoalSection
MCSection * TextCoalSection
Definition: MCObjectFileInfo.h:202
llvm::MCObjectFileInfo::DwarfLineDWOSection
MCSection * DwarfLineDWOSection
Definition: MCObjectFileInfo.h:112
llvm::MCObjectFileInfo::CompactUnwindSection
MCSection * CompactUnwindSection
If exception handling is supported by the target and the target can support a compact representation ...
Definition: MCObjectFileInfo.h:76
llvm::MachO::S_ATTR_STRIP_STATIC_SYMS
@ S_ATTR_STRIP_STATIC_SYMS
S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section in files with the MY_DYLDLINK f...
Definition: MachO.h:193
llvm::MCObjectFileInfo::ConstTextCoalSection
MCSection * ConstTextCoalSection
Definition: MCObjectFileInfo.h:203
llvm::MCObjectFileInfo::DwarfSwiftASTSection
MCSection * DwarfSwiftASTSection
Definition: MCObjectFileInfo.h:140
llvm::MCSectionELF::getUniqueID
unsigned getUniqueID() const
Definition: MCSectionELF.h:89
llvm::Triple::Wasm
@ Wasm
Definition: Triple.h:241
llvm::MCObjectFileInfo::~MCObjectFileInfo
virtual ~MCObjectFileInfo()
Definition: MCObjectFileInfo.cpp:984
llvm::MCObjectFileInfo::CompactUnwindDwarfEHFrameOnly
unsigned CompactUnwindDwarfEHFrameOnly
Compact unwind encoding indicating that we should emit only an EH frame.
Definition: MCObjectFileInfo.h:52
llvm::SectionKind::getReadOnlyWithRel
static SectionKind getReadOnlyWithRel()
Definition: SectionKind.h:207
llvm::SectionKind::getMergeable2ByteCString
static SectionKind getMergeable2ByteCString()
Definition: SectionKind.h:189
llvm::MachO::S_ATTR_DEBUG
@ S_ATTR_DEBUG
S_ATTR_DEBUG - A debug section.
Definition: MachO.h:202
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCObjectFileInfo::DwarfAbbrevDWOSection
MCSection * DwarfAbbrevDWOSection
Definition: MCObjectFileInfo.h:110
llvm::MCObjectFileInfo::XDataSection
MCSection * XDataSection
Definition: MCObjectFileInfo.h:219
llvm::XCOFF::SSUBTYP_DWARNGE
@ SSUBTYP_DWARNGE
DWARF aranges section.
Definition: XCOFF.h:102
llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA
@ IMAGE_SCN_CNT_UNINITIALIZED_DATA
Definition: COFF.h:290
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MCObjectFileInfo::DwarfRnglistsDWOSection
MCSection * DwarfRnglistsDWOSection
The DWARF v5 range and location list sections for fission.
Definition: MCObjectFileInfo.h:127
llvm::dwarf::DW_EH_PE_sdata4
@ DW_EH_PE_sdata4
Definition: Dwarf.h:440
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::Triple::bpfeb
@ bpfeb
Definition: Triple.h:58
llvm::MCObjectFileInfo::OmitDwarfIfHaveCompactUnwind
bool OmitDwarfIfHaveCompactUnwind
OmitDwarfIfHaveCompactUnwind - True if the target object file supports having some functions with com...
Definition: MCObjectFileInfo.h:43
llvm::SectionKind::getMetadata
static SectionKind getMetadata()
Definition: SectionKind.h:182
llvm::MCObjectFileInfo::EightByteConstantSection
MCSection * EightByteConstantSection
Definition: MCObjectFileInfo.h:210
llvm::MCObjectFileInfo::MergeableConst16Section
MCSection * MergeableConst16Section
Definition: MCObjectFileInfo.h:185
llvm::MCObjectFileInfo::ReadOnlySection
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
Definition: MCObjectFileInfo.h:67
llvm::ELF::SHF_TLS
@ SHF_TLS
Definition: ELF.h:1019
T
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::MCObjectFileInfo::NonLazySymbolPointerSection
MCSection * NonLazySymbolPointerSection
Definition: MCObjectFileInfo.h:213
llvm::ELF::SHF_STRINGS
@ SHF_STRINGS
Definition: ELF.h:1003
llvm::MCObjectFileInfo::DwarfLineSection
MCSection * DwarfLineSection
Definition: MCObjectFileInfo.h:82
llvm::XCOFF::SSUBTYP_DWLOC
@ SSUBTYP_DWLOC
DWARF loc section.
Definition: XCOFF.h:106
llvm::ELF::SHT_X86_64_UNWIND
@ SHT_X86_64_UNWIND
Definition: ELF.h:972
llvm::MCObjectFileInfo::GFIDsSection
MCSection * GFIDsSection
Definition: MCObjectFileInfo.h:222
llvm::MCObjectFileInfo::DwarfLocDWOSection
MCSection * DwarfLocDWOSection
Definition: MCObjectFileInfo.h:113
MCSectionELF.h
llvm::MCContext::GenericSectionID
@ GenericSectionID
Pass this value as the UniqueID during section creation to get the generic section with the given nam...
Definition: MCContext.h:523
llvm::MCSection::getBeginSymbol
MCSymbol * getBeginSymbol()
Definition: MCSection.h:127
llvm::MCObjectFileInfo::SixteenByteConstantSection
MCSection * SixteenByteConstantSection
Definition: MCObjectFileInfo.h:211
llvm::MCObjectFileInfo::DwarfAddrSection
MCSection * DwarfAddrSection
Definition: MCObjectFileInfo.h:120
llvm::MCObjectFileInfo::CommDirectiveSupportsAlignment
bool CommDirectiveSupportsAlignment
True if .comm supports alignment.
Definition: MCObjectFileInfo.h:30
llvm::MCObjectFileInfo::FourByteConstantSection
MCSection * FourByteConstantSection
Definition: MCObjectFileInfo.h:209
llvm::COFF::IMAGE_SCN_MEM_DISCARDABLE
@ IMAGE_SCN_MEM_DISCARDABLE
Definition: COFF.h:316
MCSectionCOFF.h
llvm::XCOFF::SSUBTYP_DWPBTYP
@ SSUBTYP_DWPBTYP
DWARF pubtypes section.
Definition: XCOFF.h:101
llvm::XCOFF::SSUBTYP_DWLINE
@ SSUBTYP_DWLINE
DWARF line section.
Definition: XCOFF.h:99
llvm::XCOFF::XMC_PR
@ XMC_PR
Program Code.
Definition: XCOFF.h:48
llvm::MCObjectFileInfo::ThreadLocalPointerSection
MCSection * ThreadLocalPointerSection
Definition: MCObjectFileInfo.h:214
llvm::MCSectionELF::getGroup
const MCSymbolELF * getGroup() const
Definition: MCSectionELF.h:78
llvm::dwarf::DW_EH_PE_sdata8
@ DW_EH_PE_sdata8
Definition: Dwarf.h:441
llvm::MCObjectFileInfo::DataBSSSection
MCSection * DataBSSSection
Definition: MCObjectFileInfo.h:208
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
COFF.h
MCObjectFileInfo.h
llvm::MCObjectFileInfo::DwarfAbbrevSection
MCSection * DwarfAbbrevSection
Definition: MCObjectFileInfo.h:80
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:84
llvm::MCObjectFileInfo::DwarfDebugNamesSection
MCSection * DwarfDebugNamesSection
Accelerator table sections.
Definition: MCObjectFileInfo.h:101
llvm::SectionKind::getMergeableConst16
static SectionKind getMergeableConst16()
Definition: SectionKind.h:197
PIC
PassInstrumentationCallbacks PIC
Definition: PassBuilderBindings.cpp:55
llvm::MCObjectFileInfo::DwarfTUIndexSection
MCSection * DwarfTUIndexSection
Definition: MCObjectFileInfo.h:132
llvm::Triple::ppc
@ ppc
Definition: Triple.h:67
llvm::MCAsmInfo::getCodePointerSize
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition: MCAsmInfo.h:536
llvm::MCObjectFileInfo::getPseudoProbeSection
MCSection * getPseudoProbeSection(const MCSection *TextSec) const
Definition: MCObjectFileInfo.cpp:1091
llvm::XCOFF::SSUBTYP_DWRNGES
@ SSUBTYP_DWRNGES
DWARF ranges section.
Definition: XCOFF.h:105
llvm::Triple::hexagon
@ hexagon
Definition: Triple.h:60
llvm::Triple::XCOFF
@ XCOFF
Definition: Triple.h:242
llvm::MachO::S_ZEROFILL
@ S_ZEROFILL
S_ZEROFILL - Zero fill on demand section.
Definition: MachO.h:127
llvm::MCObjectFileInfo::ConstDataCoalSection
MCSection * ConstDataCoalSection
Definition: MCObjectFileInfo.h:206
llvm::MCObjectFileInfo::LazySymbolPointerSection
MCSection * LazySymbolPointerSection
Definition: MCObjectFileInfo.h:212
llvm::MCObjectFileInfo::TLSExtraDataSection
MCSection * TLSExtraDataSection
Extra TLS Variable Data section.
Definition: MCObjectFileInfo.h:150
llvm::MCContext::IsMachO
@ IsMachO
Definition: MCContext.h:78
llvm::MCSectionELF
This represents a section on linux, lots of unix variants and some bare metal systems.
Definition: MCSectionELF.h:28
llvm::MCObjectFileInfo::DwarfPubNamesSection
MCSection * DwarfPubNamesSection
Definition: MCObjectFileInfo.h:95
llvm::MCObjectFileInfo::DwarfPubTypesSection
MCSection * DwarfPubTypesSection
Definition: MCObjectFileInfo.h:85
llvm::MachO::S_8BYTE_LITERALS
@ S_8BYTE_LITERALS
S_8BYTE_LITERALS - Section with 8 byte literals.
Definition: MachO.h:133
llvm::MCObjectFileInfo::SXDataSection
MCSection * SXDataSection
Definition: MCObjectFileInfo.h:220
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:54
llvm::XCOFF::SSUBTYP_DWMAC
@ SSUBTYP_DWMAC
DWARF macinfo section.
Definition: XCOFF.h:108
llvm::Triple::mips64
@ mips64
Definition: Triple.h:64
llvm::ELF::SHF_EXECINSTR
@ SHF_EXECINSTR
Definition: ELF.h:997
llvm::MCObjectFileInfo::DwarfFrameSection
MCSection * DwarfFrameSection
Definition: MCObjectFileInfo.h:84
llvm::MachO::S_ATTR_NO_TOC
@ S_ATTR_NO_TOC
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents.
Definition: MachO.h:190
llvm::MCObjectFileInfo::DwarfARangesSection
MCSection * DwarfARangesSection
Definition: MCObjectFileInfo.h:89
llvm::MCObjectFileInfo::DwarfStrSection
MCSection * DwarfStrSection
Definition: MCObjectFileInfo.h:87
llvm::XCOFF::CsectProperties
Definition: XCOFF.h:412
llvm::MCContext::getMachOSection
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:420
llvm::MachO::S_ATTR_PURE_INSTRUCTIONS
@ S_ATTR_PURE_INSTRUCTIONS
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
Definition: MachO.h:187
llvm::MCObjectFileInfo::ReadOnly8Section
MCSection * ReadOnly8Section
Definition: MCObjectFileInfo.h:228
llvm::SectionKind::getReadOnly
static SectionKind getReadOnly()
Definition: SectionKind.h:185
llvm::MCContext::IsWasm
@ IsWasm
Definition: MCContext.h:78
llvm::MCObjectFileInfo::LSDASection
MCSection * LSDASection
If exception handling is supported by the target, this is the section the Language Specific Data Area...
Definition: MCObjectFileInfo.h:71
llvm::COFF::IMAGE_SCN_LNK_INFO
@ IMAGE_SCN_LNK_INFO
Definition: COFF.h:292
llvm::MCContext::IsXCOFF
@ IsXCOFF
Definition: MCContext.h:78
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
@ IMAGE_SCN_CNT_INITIALIZED_DATA
Definition: COFF.h:289
llvm::MachO::S_COALESCED
@ S_COALESCED
S_COALESCED - Section contains symbols that are to be coalesced.
Definition: MachO.h:150
llvm::SectionKind::getThreadBSS
static SectionKind getThreadBSS()
Definition: SectionKind.h:199
ELF.h
llvm::XCOFF::XMC_RO
@ XMC_RO
Read Only Constant.
Definition: XCOFF.h:49
llvm::Triple::ArchType
ArchType
Definition: Triple.h:47
llvm::XCOFF::SSUBTYP_DWPBNMS
@ SSUBTYP_DWPBNMS
DWARF pubnames section.
Definition: XCOFF.h:100
llvm::COFF::IMAGE_SCN_LNK_REMOVE
@ IMAGE_SCN_LNK_REMOVE
Definition: COFF.h:293
llvm::ELF::SHF_EXCLUDE
@ SHF_EXCLUDE
Definition: ELF.h:1028
llvm::MCObjectFileInfo::SupportsCompactUnwindWithoutEHFrame
bool SupportsCompactUnwindWithoutEHFrame
True if the target object file supports emitting a compact unwind section without an associated EH fr...
Definition: MCObjectFileInfo.h:38
llvm::MCObjectFileInfo::MergeableConst8Section
MCSection * MergeableConst8Section
Definition: MCObjectFileInfo.h:184
llvm::Triple::mips64el
@ mips64el
Definition: Triple.h:65
MCContext.h
llvm::COFF::IMAGE_SCN_MEM_READ
@ IMAGE_SCN_MEM_READ
Definition: COFF.h:321
MCSectionMachO.h
llvm::MCContext::getGOFFSection
MCSectionGOFF * getGOFFSection(StringRef Section, SectionKind Kind)
Definition: MCContext.cpp:619
llvm::MCObjectFileInfo::FDECFIEncoding
unsigned FDECFIEncoding
FDE CFI encoding.
Definition: MCObjectFileInfo.h:49
llvm::MCObjectFileInfo::TLSThreadInitSection
const MCSection * TLSThreadInitSection
Section for thread local data initialization functions.
Definition: MCObjectFileInfo.h:198
llvm::MCContext::getELFSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:540
llvm::SectionKind::getBSS
static SectionKind getBSS()
Definition: SectionKind.h:202
llvm::MCObjectFileInfo::DwarfAccelTypesSection
MCSection * DwarfAccelTypesSection
Definition: MCObjectFileInfo.h:105
llvm::Triple::supportsCOMDAT
bool supportsCOMDAT() const
Tests whether the target supports comdat.
Definition: Triple.h:818
llvm::MCContext::getObjectFileType
Environment getObjectFileType() const
Definition: MCContext.h:407
llvm::MCObjectFileInfo::DwarfStrOffDWOSection
MCSection * DwarfStrOffDWOSection
Definition: MCObjectFileInfo.h:114
llvm::Triple::ppc64
@ ppc64
Definition: Triple.h:69
llvm::MCObjectFileInfo::getStackSizesSection
MCSection * getStackSizesSection(const MCSection &TextSec) const
Definition: MCObjectFileInfo.cpp:1053
llvm::MCObjectFileInfo::GLJMPSection
MCSection * GLJMPSection
Definition: MCObjectFileInfo.h:224
llvm::MCObjectFileInfo::DwarfStrDWOSection
MCSection * DwarfStrDWOSection
Definition: MCObjectFileInfo.h:111
llvm::Triple::getObjectFormat
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:340
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
llvm::MCContext::getXCOFFSection
MCSectionXCOFF * getXCOFFSection(StringRef Section, SectionKind K, Optional< XCOFF::CsectProperties > CsectProp=None, bool MultiSymbolsAllowed=false, const char *BeginSymName=nullptr, Optional< XCOFF::DwarfSectionSubtypeFlags > DwarfSubtypeFlags=None)
Definition: MCContext.cpp:735
llvm::MCObjectFileInfo::PDataSection
MCSection * PDataSection
Definition: MCObjectFileInfo.h:218
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::SectionKind::getText
static SectionKind getText()
Definition: SectionKind.h:183
llvm::XCOFF::XTY_SD
@ XTY_SD
Csect definition for initialized storage.
Definition: XCOFF.h:185
llvm::XCOFF::SSUBTYP_DWABREV
@ SSUBTYP_DWABREV
DWARF abbrev section.
Definition: XCOFF.h:103
llvm::MCObjectFileInfo::TLSDataSection
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
Definition: MCObjectFileInfo.h:153
llvm::MCObjectFileInfo::DwarfRangesSection
MCSection * DwarfRangesSection
Definition: MCObjectFileInfo.h:90
llvm::MachO::S_LAZY_SYMBOL_POINTERS
@ S_LAZY_SYMBOL_POINTERS
S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
Definition: MachO.h:139
llvm::Triple::GOFF
@ GOFF
Definition: Triple.h:239
MCSectionXCOFF.h
llvm::MCContext::getTargetTriple
const Triple & getTargetTriple() const
Definition: MCContext.h:409
llvm::None
const NoneType None
Definition: None.h:23
llvm::MCObjectFileInfo::ConstDataSection
MCSection * ConstDataSection
Definition: MCObjectFileInfo.h:204
llvm::MCContext::getWasmSection
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K, unsigned Flags=0)
Definition: MCContext.h:621
llvm::MCObjectFileInfo::DwarfLoclistsSection
MCSection * DwarfLoclistsSection
The DWARF v5 locations list section.
Definition: MCObjectFileInfo.h:124
llvm::MCObjectFileInfo::getPseudoProbeDescSection
MCSection * getPseudoProbeDescSection(StringRef FuncName) const
Definition: MCObjectFileInfo.cpp:1107
llvm::MCObjectFileInfo::COFFGlobalTypeHashesSection
MCSection * COFFGlobalTypeHashesSection
Definition: MCObjectFileInfo.h:144
llvm::MachO::S_NON_LAZY_SYMBOL_POINTERS
@ S_NON_LAZY_SYMBOL_POINTERS
S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
Definition: MachO.h:137
llvm::Triple::ppc64le
@ ppc64le
Definition: Triple.h:70
llvm::SectionKind::getMergeable1ByteCString
static SectionKind getMergeable1ByteCString()
Definition: SectionKind.h:186
llvm::Triple::ELF
@ ELF
Definition: Triple.h:238
llvm::MCObjectFileInfo::FaultMapSection
MCSection * FaultMapSection
FaultMap section.
Definition: MCObjectFileInfo.h:164
llvm::MCObjectFileInfo::DwarfMacinfoSection
MCSection * DwarfMacinfoSection
Definition: MCObjectFileInfo.h:91
uint64_t
llvm::dwarf::DW_EH_PE_pcrel
@ DW_EH_PE_pcrel
Definition: Dwarf.h:443
llvm::MCContext::getAsmInfo
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:423
llvm::MCObjectFileInfo::UStringSection
MCSection * UStringSection
Definition: MCObjectFileInfo.h:201
llvm::MCContext::IsELF
@ IsELF
Definition: MCContext.h:78
llvm::ELF::SHT_PROGBITS
@ SHT_PROGBITS
Definition: ELF.h:916
llvm::MCObjectFileInfo::CStringSection
MCSection * CStringSection
Definition: MCObjectFileInfo.h:200
llvm::MCObjectFileInfo::DwarfMacroSection
MCSection * DwarfMacroSection
Definition: MCObjectFileInfo.h:92
llvm::XCOFF::XMC_TL
@ XMC_TL
Initialized thread-local variable.
Definition: XCOFF.h:69
llvm::ELF::SHF_ALLOC
@ SHF_ALLOC
Definition: ELF.h:994
MCSectionGOFF.h
StringExtras.h
llvm::MCObjectFileInfo::SupportsWeakOmittedEHFrame
bool SupportsWeakOmittedEHFrame
True if target object file supports a weak_definition of constant 0 for an omitted EH frame.
Definition: MCObjectFileInfo.h:34
llvm::MCObjectFileInfo::DwarfLineStrSection
MCSection * DwarfLineStrSection
Definition: MCObjectFileInfo.h:83
llvm::MachO::S_4BYTE_LITERALS
@ S_4BYTE_LITERALS
S_4BYTE_LITERALS - Section with 4 byte literals.
Definition: MachO.h:131
llvm::MCObjectFileInfo::DwarfLocSection
MCSection * DwarfLocSection
Definition: MCObjectFileInfo.h:88
llvm::MachO::S_THREAD_LOCAL_VARIABLES
@ S_THREAD_LOCAL_VARIABLES
S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure data.
Definition: MachO.h:170
llvm::MachO::S_THREAD_LOCAL_REGULAR
@ S_THREAD_LOCAL_REGULAR
S_THREAD_LOCAL_REGULAR - Thread local data section.
Definition: MachO.h:165
llvm::MCContext::IsGOFF
@ IsGOFF
Definition: MCContext.h:78
llvm::Triple::bpfel
@ bpfel
Definition: Triple.h:57
llvm::SectionKind::getThreadData
static SectionKind getThreadData()
Definition: SectionKind.h:200
llvm::MCObjectFileInfo::initMCObjectFileInfo
void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel=false)
Definition: MCObjectFileInfo.cpp:986
llvm::MCObjectFileInfo::PseudoProbeDescSection
MCSection * PseudoProbeDescSection
Definition: MCObjectFileInfo.h:179
MCSection.h
llvm::MCObjectFileInfo::DwarfInfoSection
MCSection * DwarfInfoSection
Definition: MCObjectFileInfo.h:81
Triple.h
llvm::ELF::SHT_MIPS_DWARF
@ SHT_MIPS_DWARF
Definition: ELF.h:976
llvm::MCObjectFileInfo::DwarfMacroDWOSection
MCSection * DwarfMacroDWOSection
Definition: MCObjectFileInfo.h:116
llvm::Triple::arm
@ arm
Definition: Triple.h:50
MCAsmInfo.h
llvm::MCObjectFileInfo::DwarfLoclistsDWOSection
MCSection * DwarfLoclistsDWOSection
Definition: MCObjectFileInfo.h:128
llvm::Triple::aarch64_be
@ aarch64_be
Definition: Triple.h:53
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::MCObjectFileInfo::getBBAddrMapSection
MCSection * getBBAddrMapSection(const MCSection &TextSec) const
Definition: MCObjectFileInfo.cpp:1071
llvm::Triple::thumb
@ thumb
Definition: Triple.h:81
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MCContext::getCOFFSection
MCSectionCOFF * getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, unsigned UniqueID=GenericSectionID, const char *BeginSymName=nullptr)
Definition: MCContext.cpp:628
llvm::MachO::S_16BYTE_LITERALS
@ S_16BYTE_LITERALS
S_16BYTE_LITERALS - Section with only 16 byte literals.
Definition: MachO.h:158
llvm::ELF::SHT_LLVM_BB_ADDR_MAP
@ SHT_LLVM_BB_ADDR_MAP
Definition: ELF.h:949
llvm::MCContext::IsCOFF
@ IsCOFF
Definition: MCContext.h:78
llvm::MCObjectFileInfo::RemarksSection
MCSection * RemarksSection
Remarks section.
Definition: MCObjectFileInfo.h:167
llvm::MCObjectFileInfo::DwarfInfoDWOSection
MCSection * DwarfInfoDWOSection
Definition: MCObjectFileInfo.h:108
llvm::MCObjectFileInfo::GEHContSection
MCSection * GEHContSection
Definition: MCObjectFileInfo.h:221
llvm::MCObjectFileInfo::DrectveSection
MCSection * DrectveSection
COFF specific sections.
Definition: MCObjectFileInfo.h:217
llvm::MCObjectFileInfo::DwarfStrOffSection
MCSection * DwarfStrOffSection
The DWARF v5 string offset and address table sections.
Definition: MCObjectFileInfo.h:119
llvm::XCOFF::SSUBTYP_DWINFO
@ SSUBTYP_DWINFO
DWARF info section.
Definition: XCOFF.h:98
llvm::MCSection::setAlignment
void setAlignment(Align Value)
Definition: MCSection.h:139
llvm::MCObjectFileInfo::DataRelROSection
MCSection * DataRelROSection
Definition: MCObjectFileInfo.h:182
llvm::SectionKind::getData
static SectionKind getData()
Definition: SectionKind.h:206
llvm::MCObjectFileInfo::TOCBaseSection
MCSection * TOCBaseSection
Definition: MCObjectFileInfo.h:227
llvm::dwarf::DW_EH_PE_absptr
@ DW_EH_PE_absptr
Definition: Dwarf.h:432
llvm::SectionKind::getMergeableConst8
static SectionKind getMergeableConst8()
Definition: SectionKind.h:196
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::MCObjectFileInfo::DwarfRnglistsSection
MCSection * DwarfRnglistsSection
The DWARF v5 range list section.
Definition: MCObjectFileInfo.h:122
llvm::MCObjectFileInfo::DataSection
MCSection * DataSection
Section directive for standard data.
Definition: MCObjectFileInfo.h:58
llvm::MCObjectFileInfo::DwarfAccelNamespaceSection
MCSection * DwarfAccelNamespaceSection
Definition: MCObjectFileInfo.h:104
llvm::ELF::SHF_MERGE
@ SHF_MERGE
Definition: ELF.h:1000
llvm::MachO::S_THREAD_LOCAL_VARIABLE_POINTERS
@ S_THREAD_LOCAL_VARIABLE_POINTERS
S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread local structures.
Definition: MachO.h:173
llvm::MCObjectFileInfo::MergeableConst32Section
MCSection * MergeableConst32Section
Definition: MCObjectFileInfo.h:186
llvm::MCObjectFileInfo::GIATsSection
MCSection * GIATsSection
Definition: MCObjectFileInfo.h:223
llvm::COFF::IMAGE_SCN_CNT_CODE
@ IMAGE_SCN_CNT_CODE
Definition: COFF.h:288
llvm::MCObjectFileInfo::DwarfDebugInlineSection
const MCSection * DwarfDebugInlineSection
Definition: MCObjectFileInfo.h:86
llvm::Triple::MachO
@ MachO
Definition: Triple.h:240
llvm::MCObjectFileInfo::EHFrameSection
MCSection * EHFrameSection
EH frame section.
Definition: MCObjectFileInfo.h:172
llvm::Triple::mipsel
@ mipsel
Definition: Triple.h:63
llvm::XCOFF::XMC_TC0
@ XMC_TC0
TOC Anchor for TOC Addressability.
Definition: XCOFF.h:61
llvm::MCObjectFileInfo::COFFDebugTypesSection
MCSection * COFFDebugTypesSection
Definition: MCObjectFileInfo.h:143
Wasm.h
llvm::MachO::S_THREAD_LOCAL_ZEROFILL
@ S_THREAD_LOCAL_ZEROFILL
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
Definition: MachO.h:167
llvm::MCObjectFileInfo::DataCoalSection
MCSection * DataCoalSection
Definition: MCObjectFileInfo.h:205
llvm::CodeModel::Large
@ Large
Definition: CodeGen.h:28
llvm::MCObjectFileInfo::DwarfAccelObjCSection
MCSection * DwarfAccelObjCSection
Definition: MCObjectFileInfo.h:103
llvm::Triple::COFF
@ COFF
Definition: Triple.h:237
llvm::MCObjectFileInfo::DwarfGnuPubTypesSection
MCSection * DwarfGnuPubTypesSection
Section for newer gnu pubtypes.
Definition: MCObjectFileInfo.h:137
llvm::XCOFF::XMC_RW
@ XMC_RW
Read Write Data.
Definition: XCOFF.h:60
llvm::MCObjectFileInfo::DwarfTypesDWOSection
MCSection * DwarfTypesDWOSection
Definition: MCObjectFileInfo.h:109
llvm::SectionKind::getMergeableConst4
static SectionKind getMergeableConst4()
Definition: SectionKind.h:195
llvm::MCObjectFileInfo::DwarfAccelNamesSection
MCSection * DwarfAccelNamesSection
Definition: MCObjectFileInfo.h:102
llvm::MCObjectFileInfo::ReadOnly16Section
MCSection * ReadOnly16Section
Definition: MCObjectFileInfo.h:229
llvm::MCObjectFileInfo::BSSSection
MCSection * BSSSection
Section that is default initialized to zero.
Definition: MCObjectFileInfo.h:61
llvm::MCObjectFileInfo::MergeableConst4Section
MCSection * MergeableConst4Section
Definition: MCObjectFileInfo.h:183
llvm::MCObjectFileInfo::TLSBSSSection
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
Definition: MCObjectFileInfo.h:158
llvm::MCObjectFileInfo::StackSizesSection
MCSection * StackSizesSection
Section containing metadata on function stack sizes.
Definition: MCObjectFileInfo.h:175
llvm::MCObjectFileInfo::DwarfGnuPubNamesSection
MCSection * DwarfGnuPubNamesSection
Section for newer gnu pubnames.
Definition: MCObjectFileInfo.h:135
llvm::MachO::S_ATTR_LIVE_SUPPORT
@ S_ATTR_LIVE_SUPPORT
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
Definition: MachO.h:197
llvm::MCObjectFileInfo::DwarfMacinfoDWOSection
MCSection * DwarfMacinfoDWOSection
Definition: MCObjectFileInfo.h:115
llvm::XCOFF::SSUBTYP_DWFRAME
@ SSUBTYP_DWFRAME
DWARF frame section.
Definition: XCOFF.h:107
llvm::COFF::IMAGE_SCN_MEM_EXECUTE
@ IMAGE_SCN_MEM_EXECUTE
Definition: COFF.h:320
llvm::MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
@ S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local variable initialization pointers to...
Definition: MachO.h:176
llvm::ELF::SHF_LINK_ORDER
@ SHF_LINK_ORDER
Definition: ELF.h:1009
llvm::MCObjectFileInfo::StackMapSection
MCSection * StackMapSection
StackMap section.
Definition: MCObjectFileInfo.h:161
llvm::MCObjectFileInfo::PseudoProbeSection
MCSection * PseudoProbeSection
Section for pseudo probe information used by AutoFDO.
Definition: MCObjectFileInfo.h:178
llvm::ELF::SHF_WRITE
@ SHF_WRITE
Definition: ELF.h:991
llvm::COFF::IMAGE_SCN_MEM_16BIT
@ IMAGE_SCN_MEM_16BIT
Definition: COFF.h:297
llvm::MCObjectFileInfo::DataCommonSection
MCSection * DataCommonSection
Definition: MCObjectFileInfo.h:207
llvm::MCObjectFileInfo::DwarfCUIndexSection
MCSection * DwarfCUIndexSection
Definition: MCObjectFileInfo.h:131
llvm::ELF::SHT_NOBITS
@ SHT_NOBITS
Definition: ELF.h:923
useCompactUnwind
static bool useCompactUnwind(const Triple &T)
Definition: MCObjectFileInfo.cpp:27
llvm::MCObjectFileInfo::TLSTLVSection
MCSection * TLSTLVSection
Section for thread local structure information.
Definition: MCObjectFileInfo.h:194
llvm::XCOFF::SSUBTYP_DWSTR
@ SSUBTYP_DWSTR
DWARF str section.
Definition: XCOFF.h:104
llvm::COFF::SectionCharacteristics
SectionCharacteristics
Definition: COFF.h:283
llvm::MCObjectFileInfo::COFFDebugSymbolsSection
MCSection * COFFDebugSymbolsSection
Definition: MCObjectFileInfo.h:142
llvm::wasm::WASM_SEG_FLAG_STRINGS
@ WASM_SEG_FLAG_STRINGS
Definition: Wasm.h:378
llvm::Triple::mips
@ mips
Definition: Triple.h:62
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:52
llvm::COFF::IMAGE_SCN_MEM_WRITE
@ IMAGE_SCN_MEM_WRITE
Definition: COFF.h:322
MCSectionWasm.h
llvm::MCObjectFileInfo::TextSection
MCSection * TextSection
Section directive for standard text.
Definition: MCObjectFileInfo.h:55
llvm::Triple::UnknownObjectFormat
@ UnknownObjectFormat
Definition: Triple.h:235