LLVM  9.0.0svn
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/MC/MCAsmInfo.h"
15 #include "llvm/MC/MCContext.h"
16 #include "llvm/MC/MCSection.h"
17 #include "llvm/MC/MCSectionCOFF.h"
18 #include "llvm/MC/MCSectionELF.h"
19 #include "llvm/MC/MCSectionMachO.h"
20 #include "llvm/MC/MCSectionWasm.h"
21 
22 using namespace llvm;
23 
24 static bool useCompactUnwind(const Triple &T) {
25  // Only on darwin.
26  if (!T.isOSDarwin())
27  return false;
28 
29  // aarch64 always has it.
30  if (T.getArch() == Triple::aarch64)
31  return true;
32 
33  // armv7k always has it.
34  if (T.isWatchABI())
35  return true;
36 
37  // Use it on newer version of OS X.
38  if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6))
39  return true;
40 
41  // And the iOS simulator.
42  if (T.isiOS() &&
43  (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86))
44  return true;
45 
46  return false;
47 }
48 
49 void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
50  // MachO
52 
54  "__TEXT", "__eh_frame",
58 
59  if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
61 
62  if (T.isWatchABI())
64 
66 
67  // .comm doesn't support alignment before Leopard.
68  if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
70 
71  TextSection // .text
72  = Ctx->getMachOSection("__TEXT", "__text",
75  DataSection // .data
76  = Ctx->getMachOSection("__DATA", "__data", 0, SectionKind::getData());
77 
78  // BSSSection might not be expected initialized on msvc.
79  BSSSection = nullptr;
80 
81  TLSDataSection // .tdata
82  = Ctx->getMachOSection("__DATA", "__thread_data",
85  TLSBSSSection // .tbss
86  = Ctx->getMachOSection("__DATA", "__thread_bss",
89 
90  // TODO: Verify datarel below.
91  TLSTLVSection // .tlv
92  = Ctx->getMachOSection("__DATA", "__thread_vars",
95 
97  "__DATA", "__thread_init", MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
99 
100  CStringSection // .cstring
101  = Ctx->getMachOSection("__TEXT", "__cstring",
105  = Ctx->getMachOSection("__TEXT","__ustring", 0,
107  FourByteConstantSection // .literal4
108  = Ctx->getMachOSection("__TEXT", "__literal4",
111  EightByteConstantSection // .literal8
112  = Ctx->getMachOSection("__TEXT", "__literal8",
115 
116  SixteenByteConstantSection // .literal16
117  = Ctx->getMachOSection("__TEXT", "__literal16",
120 
121  ReadOnlySection // .const
122  = Ctx->getMachOSection("__TEXT", "__const", 0,
124 
125  // If the target is not powerpc, map the coal sections to the non-coal
126  // sections.
127  //
128  // "__TEXT/__textcoal_nt" => section "__TEXT/__text"
129  // "__TEXT/__const_coal" => section "__TEXT/__const"
130  // "__DATA/__datacoal_nt" => section "__DATA/__data"
131  Triple::ArchType ArchTy = T.getArch();
132 
133  ConstDataSection // .const_data
134  = Ctx->getMachOSection("__DATA", "__const", 0,
136 
137  if (ArchTy == Triple::ppc || ArchTy == Triple::ppc64) {
139  = Ctx->getMachOSection("__TEXT", "__textcoal_nt",
144  = Ctx->getMachOSection("__TEXT", "__const_coal",
148  "__DATA", "__datacoal_nt", MachO::S_COALESCED, SectionKind::getData());
150  } else {
155  }
156 
158  = Ctx->getMachOSection("__DATA","__common",
162  = Ctx->getMachOSection("__DATA","__bss", MachO::S_ZEROFILL,
164 
165 
167  = Ctx->getMachOSection("__DATA", "__la_symbol_ptr",
171  = Ctx->getMachOSection("__DATA", "__nl_symbol_ptr",
174 
176  = Ctx->getMachOSection("__DATA", "__thread_ptr",
179 
180  // Exception Handling.
181  LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
183 
184  COFFDebugSymbolsSection = nullptr;
185  COFFDebugTypesSection = nullptr;
186  COFFGlobalTypeHashesSection = nullptr;
187 
188  if (useCompactUnwind(T)) {
190  Ctx->getMachOSection("__LD", "__compact_unwind", MachO::S_ATTR_DEBUG,
192 
193  if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
194  CompactUnwindDwarfEHFrameOnly = 0x04000000; // UNWIND_X86_64_MODE_DWARF
195  else if (T.getArch() == Triple::aarch64)
196  CompactUnwindDwarfEHFrameOnly = 0x03000000; // UNWIND_ARM64_MODE_DWARF
197  else if (T.getArch() == Triple::arm || T.getArch() == Triple::thumb)
198  CompactUnwindDwarfEHFrameOnly = 0x04000000; // UNWIND_ARM_MODE_DWARF
199  }
200 
201  // Debug Information.
203  Ctx->getMachOSection("__DWARF", "__debug_names", MachO::S_ATTR_DEBUG,
204  SectionKind::getMetadata(), "debug_names_begin");
206  Ctx->getMachOSection("__DWARF", "__apple_names", MachO::S_ATTR_DEBUG,
207  SectionKind::getMetadata(), "names_begin");
209  Ctx->getMachOSection("__DWARF", "__apple_objc", MachO::S_ATTR_DEBUG,
210  SectionKind::getMetadata(), "objc_begin");
211  // 16 character section limit...
213  Ctx->getMachOSection("__DWARF", "__apple_namespac", MachO::S_ATTR_DEBUG,
214  SectionKind::getMetadata(), "namespac_begin");
216  Ctx->getMachOSection("__DWARF", "__apple_types", MachO::S_ATTR_DEBUG,
217  SectionKind::getMetadata(), "types_begin");
218 
220  Ctx->getMachOSection("__DWARF", "__swift_ast", MachO::S_ATTR_DEBUG,
222 
224  Ctx->getMachOSection("__DWARF", "__debug_abbrev", MachO::S_ATTR_DEBUG,
225  SectionKind::getMetadata(), "section_abbrev");
227  Ctx->getMachOSection("__DWARF", "__debug_info", MachO::S_ATTR_DEBUG,
228  SectionKind::getMetadata(), "section_info");
230  Ctx->getMachOSection("__DWARF", "__debug_line", MachO::S_ATTR_DEBUG,
231  SectionKind::getMetadata(), "section_line");
233  Ctx->getMachOSection("__DWARF", "__debug_line_str", MachO::S_ATTR_DEBUG,
234  SectionKind::getMetadata(), "section_line_str");
236  Ctx->getMachOSection("__DWARF", "__debug_frame", MachO::S_ATTR_DEBUG,
239  Ctx->getMachOSection("__DWARF", "__debug_pubnames", MachO::S_ATTR_DEBUG,
242  Ctx->getMachOSection("__DWARF", "__debug_pubtypes", MachO::S_ATTR_DEBUG,
245  Ctx->getMachOSection("__DWARF", "__debug_gnu_pubn", MachO::S_ATTR_DEBUG,
248  Ctx->getMachOSection("__DWARF", "__debug_gnu_pubt", MachO::S_ATTR_DEBUG,
251  Ctx->getMachOSection("__DWARF", "__debug_str", MachO::S_ATTR_DEBUG,
252  SectionKind::getMetadata(), "info_string");
254  Ctx->getMachOSection("__DWARF", "__debug_str_offs", MachO::S_ATTR_DEBUG,
255  SectionKind::getMetadata(), "section_str_off");
257  Ctx->getMachOSection("__DWARF", "__debug_addr", MachO::S_ATTR_DEBUG,
258  SectionKind::getMetadata(), "section_info");
260  Ctx->getMachOSection("__DWARF", "__debug_loc", MachO::S_ATTR_DEBUG,
261  SectionKind::getMetadata(), "section_debug_loc");
263  Ctx->getMachOSection("__DWARF", "__debug_loclists", MachO::S_ATTR_DEBUG,
264  SectionKind::getMetadata(), "section_debug_loc");
265 
267  Ctx->getMachOSection("__DWARF", "__debug_aranges", MachO::S_ATTR_DEBUG,
270  Ctx->getMachOSection("__DWARF", "__debug_ranges", MachO::S_ATTR_DEBUG,
271  SectionKind::getMetadata(), "debug_range");
273  Ctx->getMachOSection("__DWARF", "__debug_rnglists", MachO::S_ATTR_DEBUG,
274  SectionKind::getMetadata(), "debug_range");
276  Ctx->getMachOSection("__DWARF", "__debug_macinfo", MachO::S_ATTR_DEBUG,
277  SectionKind::getMetadata(), "debug_macinfo");
279  Ctx->getMachOSection("__DWARF", "__debug_inlined", MachO::S_ATTR_DEBUG,
282  Ctx->getMachOSection("__DWARF", "__debug_cu_index", MachO::S_ATTR_DEBUG,
285  Ctx->getMachOSection("__DWARF", "__debug_tu_index", MachO::S_ATTR_DEBUG,
287  StackMapSection = Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps",
289 
290  FaultMapSection = Ctx->getMachOSection("__LLVM_FAULTMAPS", "__llvm_faultmaps",
292 
294 }
295 
296 void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) {
297  switch (T.getArch()) {
298  case Triple::mips:
299  case Triple::mipsel:
300  case Triple::mips64:
301  case Triple::mips64el:
305  break;
306  case Triple::ppc64:
307  case Triple::ppc64le:
308  case Triple::x86_64:
311  break;
312  case Triple::bpfel:
313  case Triple::bpfeb:
315  break;
316  case Triple::hexagon:
318  PositionIndependent ? dwarf::DW_EH_PE_pcrel : dwarf::DW_EH_PE_absptr;
319  break;
320  default:
322  break;
323  }
324 
325  unsigned EHSectionType = T.getArch() == Triple::x86_64
328 
329  // Solaris requires different flags for .eh_frame to seemingly every other
330  // platform.
331  unsigned EHSectionFlags = ELF::SHF_ALLOC;
332  if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
333  EHSectionFlags |= ELF::SHF_WRITE;
334 
335  // ELF
338 
341 
344 
347 
349  Ctx->getELFSection(".tdata", ELF::SHT_PROGBITS,
351 
354 
355  DataRelROSection = Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
357 
359  Ctx->getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
360  ELF::SHF_ALLOC | ELF::SHF_MERGE, 4, "");
361 
363  Ctx->getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
364  ELF::SHF_ALLOC | ELF::SHF_MERGE, 8, "");
365 
367  Ctx->getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
368  ELF::SHF_ALLOC | ELF::SHF_MERGE, 16, "");
369 
371  Ctx->getELFSection(".rodata.cst32", ELF::SHT_PROGBITS,
372  ELF::SHF_ALLOC | ELF::SHF_MERGE, 32, "");
373 
374  // Exception Handling Sections.
375 
376  // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
377  // it contains relocatable pointers. In PIC mode, this is probably a big
378  // runtime hit for C++ apps. Either the contents of the LSDA need to be
379  // adjusted or this should be a data section.
380  LSDASection = Ctx->getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
382 
383  COFFDebugSymbolsSection = nullptr;
384  COFFDebugTypesSection = nullptr;
385 
386  unsigned DebugSecType = ELF::SHT_PROGBITS;
387 
388  // MIPS .debug_* sections should have SHT_MIPS_DWARF section type
389  // to distinguish among sections contain DWARF and ECOFF debug formats.
390  // Sections with ECOFF debug format are obsoleted and marked by SHT_PROGBITS.
391  if (T.isMIPS())
392  DebugSecType = ELF::SHT_MIPS_DWARF;
393 
394  // Debug Info Sections.
396  Ctx->getELFSection(".debug_abbrev", DebugSecType, 0);
397  DwarfInfoSection = Ctx->getELFSection(".debug_info", DebugSecType, 0);
398  DwarfLineSection = Ctx->getELFSection(".debug_line", DebugSecType, 0);
400  Ctx->getELFSection(".debug_line_str", DebugSecType,
402  DwarfFrameSection = Ctx->getELFSection(".debug_frame", DebugSecType, 0);
404  Ctx->getELFSection(".debug_pubnames", DebugSecType, 0);
406  Ctx->getELFSection(".debug_pubtypes", DebugSecType, 0);
408  Ctx->getELFSection(".debug_gnu_pubnames", DebugSecType, 0);
410  Ctx->getELFSection(".debug_gnu_pubtypes", DebugSecType, 0);
412  Ctx->getELFSection(".debug_str", DebugSecType,
414  DwarfLocSection = Ctx->getELFSection(".debug_loc", DebugSecType, 0);
416  Ctx->getELFSection(".debug_aranges", DebugSecType, 0);
418  Ctx->getELFSection(".debug_ranges", DebugSecType, 0);
420  Ctx->getELFSection(".debug_macinfo", DebugSecType, 0);
421 
422  // DWARF5 Experimental Debug Info
423 
424  // Accelerator Tables
426  Ctx->getELFSection(".debug_names", ELF::SHT_PROGBITS, 0);
428  Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0);
430  Ctx->getELFSection(".apple_objc", ELF::SHT_PROGBITS, 0);
432  Ctx->getELFSection(".apple_namespaces", ELF::SHT_PROGBITS, 0);
434  Ctx->getELFSection(".apple_types", ELF::SHT_PROGBITS, 0);
435 
436  // String Offset and Address Sections
438  Ctx->getELFSection(".debug_str_offsets", DebugSecType, 0);
439  DwarfAddrSection = Ctx->getELFSection(".debug_addr", DebugSecType, 0);
440  DwarfRnglistsSection = Ctx->getELFSection(".debug_rnglists", DebugSecType, 0);
441  DwarfLoclistsSection = Ctx->getELFSection(".debug_loclists", DebugSecType, 0);
442 
443  // Fission Sections
445  Ctx->getELFSection(".debug_info.dwo", DebugSecType, ELF::SHF_EXCLUDE);
447  Ctx->getELFSection(".debug_types.dwo", DebugSecType, ELF::SHF_EXCLUDE);
449  Ctx->getELFSection(".debug_abbrev.dwo", DebugSecType, ELF::SHF_EXCLUDE);
451  ".debug_str.dwo", DebugSecType,
454  Ctx->getELFSection(".debug_line.dwo", DebugSecType, ELF::SHF_EXCLUDE);
456  Ctx->getELFSection(".debug_loc.dwo", DebugSecType, ELF::SHF_EXCLUDE);
457  DwarfStrOffDWOSection = Ctx->getELFSection(".debug_str_offsets.dwo",
458  DebugSecType, ELF::SHF_EXCLUDE);
460  Ctx->getELFSection(".debug_rnglists.dwo", DebugSecType, ELF::SHF_EXCLUDE);
461 
462  // DWP Sections
464  Ctx->getELFSection(".debug_cu_index", DebugSecType, 0);
466  Ctx->getELFSection(".debug_tu_index", DebugSecType, 0);
467 
469  Ctx->getELFSection(".llvm_stackmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
470 
472  Ctx->getELFSection(".llvm_faultmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
473 
475  Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
476 
477  StackSizesSection = Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, 0);
478 }
479 
480 void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
485 
486  // Set the `IMAGE_SCN_MEM_16BIT` flag when compiling for thumb mode. This is
487  // used to indicate to the linker that the text segment contains thumb instructions
488  // and to set the ISA selection bit for calls accordingly.
489  const bool IsThumb = T.getArch() == Triple::thumb;
490 
492 
493  // COFF
494  BSSSection = Ctx->getCOFFSection(
499  ".text",
511 
512  if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::aarch64) {
513  // On Windows 64 with SEH, the LSDA is emitted into the .xdata section
514  LSDASection = nullptr;
515  } else {
516  LSDASection = Ctx->getCOFFSection(".gcc_except_table",
520  }
521 
522  // Debug info.
534  ".debug$H",
538 
540  ".debug_abbrev",
543  SectionKind::getMetadata(), "section_abbrev");
545  ".debug_info",
548  SectionKind::getMetadata(), "section_info");
550  ".debug_line",
553  SectionKind::getMetadata(), "section_line");
555  ".debug_line_str",
558  SectionKind::getMetadata(), "section_line_str");
560  ".debug_frame",
565  ".debug_pubnames",
570  ".debug_pubtypes",
575  ".debug_gnu_pubnames",
580  ".debug_gnu_pubtypes",
585  ".debug_str",
588  SectionKind::getMetadata(), "info_string");
590  ".debug_str_offsets",
593  SectionKind::getMetadata(), "section_str_off");
595  ".debug_loc",
598  SectionKind::getMetadata(), "section_debug_loc");
600  ".debug_aranges",
605  ".debug_ranges",
608  SectionKind::getMetadata(), "debug_range");
610  ".debug_macinfo",
613  SectionKind::getMetadata(), "debug_macinfo");
615  ".debug_info.dwo",
618  SectionKind::getMetadata(), "section_info_dwo");
620  ".debug_types.dwo",
623  SectionKind::getMetadata(), "section_types_dwo");
625  ".debug_abbrev.dwo",
628  SectionKind::getMetadata(), "section_abbrev_dwo");
630  ".debug_str.dwo",
633  SectionKind::getMetadata(), "skel_string");
635  ".debug_line.dwo",
640  ".debug_loc.dwo",
643  SectionKind::getMetadata(), "skel_loc");
645  ".debug_str_offsets.dwo",
648  SectionKind::getMetadata(), "section_str_off_dwo");
650  ".debug_addr",
653  SectionKind::getMetadata(), "addr_sec");
655  ".debug_cu_index",
660  ".debug_tu_index",
665  ".debug_names",
668  SectionKind::getMetadata(), "debug_names_begin");
670  ".apple_names",
673  SectionKind::getMetadata(), "names_begin");
675  ".apple_namespaces",
678  SectionKind::getMetadata(), "namespac_begin");
680  ".apple_types",
683  SectionKind::getMetadata(), "types_begin");
685  ".apple_objc",
688  SectionKind::getMetadata(), "objc_begin");
689 
693 
697 
701 
704 
705  GFIDsSection = Ctx->getCOFFSection(".gfids$y",
709 
714 
715  StackMapSection = Ctx->getCOFFSection(".llvm_stackmaps",
719 }
720 
721 void MCObjectFileInfo::initWasmMCObjectFileInfo(const Triple &T) {
724 
726  Ctx->getWasmSection(".debug_line", SectionKind::getMetadata());
728  Ctx->getWasmSection(".debug_line_str", SectionKind::getMetadata());
730  Ctx->getWasmSection(".debug_str", SectionKind::getMetadata());
732  Ctx->getWasmSection(".debug_loc", SectionKind::getMetadata());
734  Ctx->getWasmSection(".debug_abbrev", SectionKind::getMetadata());
735  DwarfARangesSection = Ctx->getWasmSection(".debug_aranges", SectionKind::getMetadata());
737  Ctx->getWasmSection(".debug_ranges", SectionKind::getMetadata());
739  Ctx->getWasmSection(".debug_macinfo", SectionKind::getMetadata());
741  DwarfCUIndexSection = Ctx->getWasmSection(".debug_cu_index", SectionKind::getMetadata());
742  DwarfTUIndexSection = Ctx->getWasmSection(".debug_tu_index", SectionKind::getMetadata());
744  Ctx->getWasmSection(".debug_info", SectionKind::getMetadata());
746  DwarfPubNamesSection = Ctx->getWasmSection(".debug_pubnames", SectionKind::getMetadata());
747  DwarfPubTypesSection = Ctx->getWasmSection(".debug_pubtypes", SectionKind::getMetadata());
748 
749  // Wasm use data section for LSDA.
750  // TODO Consider putting each function's exception table in a separate
751  // section, as in -function-sections, to facilitate lld's --gc-section.
752  LSDASection = Ctx->getWasmSection(".rodata.gcc_except_table",
754 
755  // TODO: Define more sections.
756 }
757 
758 void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple, bool PIC,
759  MCContext &ctx,
760  bool LargeCodeModel) {
761  PositionIndependent = PIC;
762  Ctx = &ctx;
763 
764  // Common.
769 
771 
773 
774  EHFrameSection = nullptr; // Created on demand.
775  CompactUnwindSection = nullptr; // Used only by selected targets.
776  DwarfAccelNamesSection = nullptr; // Used only by selected targets.
777  DwarfAccelObjCSection = nullptr; // Used only by selected targets.
778  DwarfAccelNamespaceSection = nullptr; // Used only by selected targets.
779  DwarfAccelTypesSection = nullptr; // Used only by selected targets.
780 
781  TT = TheTriple;
782 
783  switch (TT.getObjectFormat()) {
784  case Triple::MachO:
785  Env = IsMachO;
786  initMachOMCObjectFileInfo(TT);
787  break;
788  case Triple::COFF:
789  if (!TT.isOSWindows())
791  "Cannot initialize MC for non-Windows COFF object files.");
792 
793  Env = IsCOFF;
794  initCOFFMCObjectFileInfo(TT);
795  break;
796  case Triple::ELF:
797  Env = IsELF;
798  initELFMCObjectFileInfo(TT, LargeCodeModel);
799  break;
800  case Triple::Wasm:
801  Env = IsWasm;
802  initWasmMCObjectFileInfo(TT);
803  break;
805  report_fatal_error("Cannot initialize MC for unknown object file format.");
806  break;
807  }
808 }
809 
810 MCSection *MCObjectFileInfo::getDwarfComdatSection(const char *Name,
811  uint64_t Hash) const {
812  switch (TT.getObjectFormat()) {
813  case Triple::ELF:
814  return Ctx->getELFSection(Name, ELF::SHT_PROGBITS, ELF::SHF_GROUP, 0,
815  utostr(Hash));
816  case Triple::MachO:
817  case Triple::COFF:
818  case Triple::Wasm:
820  report_fatal_error("Cannot get DWARF comdat section for this object file "
821  "format: not implemented.");
822  break;
823  }
824  llvm_unreachable("Unknown ObjectFormatType");
825 }
826 
827 MCSection *
829  if (Env != IsELF)
830  return StackSizesSection;
831 
832  const MCSectionELF &ElfSec = static_cast<const MCSectionELF &>(TextSec);
833  unsigned Flags = ELF::SHF_LINK_ORDER;
834  StringRef GroupName;
835  if (const MCSymbol *Group = ElfSec.getGroup()) {
836  GroupName = Group->getName();
837  Flags |= ELF::SHF_GROUP;
838  }
839 
840  const MCSymbol *Link = TextSec.getBeginSymbol();
842  unsigned UniqueID = It.first->second;
843 
844  return Ctx->getELFSection(".stack_sizes", ELF::SHT_PROGBITS, Flags, 0,
845  GroupName, UniqueID, cast<MCSymbolELF>(Link));
846 }
const MCAsmInfo * getAsmInfo() const
Definition: MCContext.h:292
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
Definition: Triple.h:474
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:38
MCSection * MergeableConst4Section
static SectionKind getData()
Definition: SectionKind.h:201
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:131
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:139
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:446
MCSection * DwarfPubTypesSection
MCSection * DwarfGnuPubTypesSection
Section for newer gnu pubtypes.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
MCSection * StackMapSection
StackMap section.
MCSection * SixteenByteConstantSection
MCSection * DwarfRnglistsSection
The DWARF v5 range list section.
MCSection * TextSection
Section directive for standard text.
MCSection * ConstTextCoalSection
MCSectionWasm * getWasmSection(const Twine &Section, SectionKind K)
Definition: MCContext.h:453
MCSection * LazySymbolPointerSection
static SectionKind getMergeableConst8()
Definition: SectionKind.h:192
static SectionKind getMergeableConst16()
Definition: SectionKind.h:193
static SectionKind getMergeable1ByteCString()
Definition: SectionKind.h:182
S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure data.
Definition: MachO.h:164
static SectionKind getMergeableConst4()
Definition: SectionKind.h:191
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:421
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:221
MCSection * MergeableConst32Section
MCSection * DwarfDebugNamesSection
Accelerator table sections.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
S_4BYTE_LITERALS - Section with 4 byte literals.
Definition: MachO.h:125
static SectionKind getBSS()
Definition: SectionKind.h:197
MCSection * COFFDebugTypesSection
MCSection * MergeableConst16Section
MCSection * DwarfPubNamesSection
S_8BYTE_LITERALS - Section with 8 byte literals.
Definition: MachO.h:127
MCSection * EightByteConstantSection
MCSection * getStackSizesSection(const MCSection &TextSec) const
bool isOSSolaris() const
Definition: Triple.h:500
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
Context object for machine code objects.
Definition: MCContext.h:62
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:272
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:289
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
Definition: MachO.h:181
MCSection * ConstDataCoalSection
MCSection * DrectveSection
COFF specific sections.
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:455
MCSection * DwarfAccelNamesSection
MCSection * DataSection
Section directive for standard data.
SectionCharacteristics
Definition: COFF.h:283
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:566
MCSection * ThreadLocalPointerSection
MCSection * DwarfLineStrSection
const MCSymbolELF * getGroup() const
Definition: MCSectionELF.h:77
MCSection * DwarfSwiftASTSection
MCSection * TLSTLVSection
Section for thread local structure information.
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
Definition: MachO.h:161
bool isWatchABI() const
Definition: Triple.h:469
MCSection * DwarfAccelNamespaceSection
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
Definition: MachO.h:191
S_THREAD_LOCAL_REGULAR - Thread local data section.
Definition: MachO.h:159
unsigned size() const
Definition: DenseMap.h:125
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:123
bool CommDirectiveSupportsAlignment
True if .comm supports alignment.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
MCSection * COFFDebugSymbolsSection
MCSection * DwarfAbbrevSection
MCSection * EHFrameSection
EH frame section.
MCSection * DwarfLoclistsSection
The DWARF v5 locations list section.
S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
Definition: MachO.h:133
MCSection * DwarfTypesDWOSection
static SectionKind getThreadBSS()
Definition: SectionKind.h:195
MCSection * DwarfRangesSection
S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread local structures.
Definition: MachO.h:167
static SectionKind getMetadata()
Definition: SectionKind.h:178
static SectionKind getReadOnlyWithRel()
Definition: SectionKind.h:202
MCSymbol * getBeginSymbol()
Definition: MCSection.h:109
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:170
DenseMap< const MCSymbol *, unsigned > StackSizesUniquing
std::string utostr(uint64_t X, bool isNeg=false)
Definition: StringExtras.h:223
MCSection * DwarfStrOffDWOSection
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents...
Definition: MachO.h:184
S_16BYTE_LITERALS - Section with only 16 byte literals.
Definition: MachO.h:152
MCSection * DwarfGnuPubNamesSection
Section for newer gnu pubnames.
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
Definition: Triple.h:689
MCSection * DwarfAbbrevDWOSection
MCSection * FaultMapSection
FaultMap section.
bool OmitDwarfIfHaveCompactUnwind
OmitDwarfIfHaveCompactUnwind - True if the target object file supports having some functions with com...
MCSection * FourByteConstantSection
static SectionKind getMergeable2ByteCString()
Definition: SectionKind.h:185
void InitMCObjectFileInfo(const Triple &TT, bool PIC, MCContext &ctx, bool LargeCodeModel=false)
unsigned FDECFIEncoding
FDE CFI encoding.
S_ATTR_DEBUG - A debug section.
Definition: MachO.h:196
MCSection * LSDASection
If exception handling is supported by the target, this is the section the Language Specific Data Area...
MCSection * TLSExtraDataSection
Extra TLS Variable Data section.
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
Definition: Triple.h:319
unsigned CompactUnwindDwarfEHFrameOnly
Compact unwind encoding indicating that we should emit only an EH frame.
MCSection * StackSizesSection
Section containing metadata on function stack sizes.
This represents a section on linux, lots of unix variants and some bare metal systems.
Definition: MCSectionELF.h:27
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:431
MCSection * DwarfAccelObjCSection
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
Definition: MCAsmInfo.h:395
S_COALESCED - Section contains symbols that are to be coalesced.
Definition: MachO.h:144
MCSection * COFFGlobalTypeHashesSection
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
MCSection * NonLazySymbolPointerSection
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
Definition: MCContext.h:388
const MCSection * TLSThreadInitSection
Section for thread local data initialization functions.
MCSection * DwarfRnglistsDWOSection
The DWARF v5 range list section for fission.
bool SupportsWeakOmittedEHFrame
True if target object file supports a weak_definition of constant 0 for an omitted EH frame...
MCSection * BSSSection
Section that is default initialized to zero.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section in files with the MY_DYLDLINK f...
Definition: MachO.h:187
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
S_ZEROFILL - Zero fill on demand section.
Definition: MachO.h:121
MCSection * DwarfMacinfoSection
static SectionKind getReadOnly()
Definition: SectionKind.h:181
static SectionKind getText()
Definition: SectionKind.h:179
MCSection * MergeableConst8Section