48 if (
T.isMacOSX() && !
T.isMacOSXVersionLT(10, 6))
52 if (
T.isiOS() &&
T.isX86())
56 if (
T.isSimulatorEnvironment())
66void MCObjectFileInfo::initMachOMCObjectFileInfo(
const Triple &
T) {
68 "__TEXT",
"__eh_frame",
75 T.isSimulatorEnvironment()))
78 switch (Ctx->emitDwarfUnwindInfo()) {
95 = Ctx->getMachOSection(
"__TEXT",
"__text",
105 = Ctx->getMachOSection(
"__DATA",
"__thread_data",
109 = Ctx->getMachOSection(
"__DATA",
"__thread_bss",
115 = Ctx->getMachOSection(
"__DATA",
"__thread_vars",
124 = Ctx->getMachOSection(
"__TEXT",
"__cstring",
128 = Ctx->getMachOSection(
"__TEXT",
"__ustring", 0,
131 = Ctx->getMachOSection(
"__TEXT",
"__literal4",
135 = Ctx->getMachOSection(
"__TEXT",
"__literal8",
140 = Ctx->getMachOSection(
"__TEXT",
"__literal16",
145 = Ctx->getMachOSection(
"__TEXT",
"__const", 0,
157 = Ctx->getMachOSection(
"__DATA",
"__const", 0,
162 = Ctx->getMachOSection(
"__TEXT",
"__textcoal_nt",
167 = Ctx->getMachOSection(
"__TEXT",
"__const_coal",
181 = Ctx->getMachOSection(
"__DATA",
"__common",
190 = Ctx->getMachOSection(
"__DATA",
"__la_symbol_ptr",
194 = Ctx->getMachOSection(
"__DATA",
"__nl_symbol_ptr",
199 = Ctx->getMachOSection(
"__DATA",
"__thread_ptr",
203 AddrSigSection = Ctx->getMachOSection(
"__DATA",
"__llvm_addrsig", 0,
207 LSDASection = Ctx->getMachOSection(
"__TEXT",
"__gcc_except_tab", 0,
316 StackMapSection = Ctx->getMachOSection(
"__LLVM_STACKMAPS",
"__llvm_stackmaps",
319 FaultMapSection = Ctx->getMachOSection(
"__LLVM_FAULTMAPS",
"__llvm_faultmaps",
326 Ctx->getMachOSection(
"__PSEUDO_PROBE",
"__probes",
330 Ctx->getMachOSection(
"__PSEUDO_PROBE",
"__probe_descs",
337 if (!Ctx->getSwift5ReflectionSegmentName().empty()) {
338#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) \
339 Swift5ReflectionSections \
340 [llvm::binaryformat::Swift5ReflectionSectionKind::KIND] = \
341 Ctx->getMachOSection(Ctx->getSwift5ReflectionSegmentName().data(), \
342 MACHO, 0, SectionKind::getMetadata());
343#include "llvm/BinaryFormat/Swift.def"
349void MCObjectFileInfo::initELFMCObjectFileInfo(
const Triple &
T,
bool Large) {
350 switch (
T.getArch()) {
359 if (PositionIndependent)
372 ((
Large || Ctx->getTargetOptions().LargeEHEncoding)
395 switch (
T.getArch()) {
439 StringRef CstPrefix =
".rodata";
442 CstPrefix =
".lrodata";
479 Ctx->getELFSection(
".debug_abbrev", DebugSecType, 0);
483 Ctx->getELFSection(
".debug_line_str", DebugSecType,
487 Ctx->getELFSection(
".debug_pubnames", DebugSecType, 0);
489 Ctx->getELFSection(
".debug_pubtypes", DebugSecType, 0);
491 Ctx->getELFSection(
".debug_gnu_pubnames", DebugSecType, 0);
493 Ctx->getELFSection(
".debug_gnu_pubtypes", DebugSecType, 0);
495 Ctx->getELFSection(
".debug_str", DebugSecType,
499 Ctx->getELFSection(
".debug_aranges", DebugSecType, 0);
501 Ctx->getELFSection(
".debug_ranges", DebugSecType, 0);
503 Ctx->getELFSection(
".debug_macinfo", DebugSecType, 0);
522 Ctx->getELFSection(
".debug_str_offsets", DebugSecType, 0);
535 ".debug_str.dwo", DebugSecType,
555 Ctx->getELFSection(
".debug_cu_index", DebugSecType, 0);
557 Ctx->getELFSection(
".debug_tu_index", DebugSecType, 0);
566 Ctx->getELFSection(
".eh_frame", EHSectionType, EHSectionFlags);
578 Ctx->getELFSection(
".pseudo_probe_desc", DebugSecType, 0);
583void MCObjectFileInfo::initGOFFMCObjectFileInfo(
const Triple &
T) {
584 MCSectionGOFF *RootSDSection = Ctx->getGOFFSection(
588 MCSectionGOFF *ADAEDSection = Ctx->getGOFFSection(
609 MCSectionGOFF *PPA2ListEDSection = Ctx->getGOFFSection(
631 auto InitDebugSection = [
this,
632 RootSDSection](StringRef EDName,
633 StringRef LDName) -> MCSectionGOFF * {
634 MCSectionGOFF *ED = Ctx->getGOFFSection(
651 LD->setExternal(
false);
654 assert(
LD->getName() == LDName &&
"Wrong label name");
680 InitDebugSection(
"D_GPTYPES",
".debug_gnu_pubtypes");
685 InitDebugSection(
"D_APPLNMSP",
".apple_namespaces");
690void MCObjectFileInfo::initCOFFMCObjectFileInfo(
const Triple &
T) {
721 LSDASection = Ctx->getCOFFSection(
".gcc_except_table",
958void MCObjectFileInfo::initSPIRVMCObjectFileInfo(
const Triple &
T) {
963void MCObjectFileInfo::initWasmMCObjectFileInfo(
const Triple &
T) {
1043 LSDASection = Ctx->getWasmSection(
".rodata.gcc_except_table",
1049void MCObjectFileInfo::initXCOFFMCObjectFileInfo(
const Triple &
T) {
1061 MCSectionXCOFF *TS =
static_cast<MCSectionXCOFF *
>(
TextSection);
1165void MCObjectFileInfo::initDXContainerObjectFileInfo(
const Triple &
T) {
1173 bool LargeCodeModel) {
1174 PositionIndependent =
PIC;
1193 const Triple &TheTriple = Ctx->getTargetTriple();
1194 switch (Ctx->getObjectFileType()) {
1196 initMachOMCObjectFileInfo(TheTriple);
1199 initCOFFMCObjectFileInfo(TheTriple);
1202 initELFMCObjectFileInfo(TheTriple, LargeCodeModel);
1205 initGOFFMCObjectFileInfo(TheTriple);
1208 initSPIRVMCObjectFileInfo(TheTriple);
1211 initWasmMCObjectFileInfo(TheTriple);
1214 initXCOFFMCObjectFileInfo(TheTriple);
1217 initDXContainerObjectFileInfo(TheTriple);
1222MCSection *MCObjectFileInfo::getDwarfComdatSection(
const char *Name,
1224 switch (Ctx->getTargetTriple().getObjectFormat()) {
1239 "format: not implemented.");
1254 GroupName = Group->getName();
1258 return Ctx->getELFSection(
1267 Ctx->getTargetTriple().isPS4())
1274 GroupName = Group->getName();
1278 return Ctx->getELFSection(
1292 GroupName = Group->getName();
1298 return Ctx->getELFSection(
1308 const auto &COFFSec =
static_cast<const MCSectionCOFF &
>(TextSec);
1309 if (
const MCSymbol *COMDATSym = COFFSec.getCOMDATSymbol()) {
1310 if (!Ctx->getAsmInfo().hasCOFFAssociativeComdats())
1312 "support for COMDAT functions");
1313 COMDATSymName = COMDATSym->getName();
1317 return Ctx->getCOFFSection(Name, Characteristics, COMDATSymName,
Selection,
1318 COFFSec.getUniqueID());
1333 GroupName = Group->getName();
1337 return Ctx->getELFSection(
1345 auto ObjFileType = Ctx->getObjectFileType();
1347 const auto &ElfSec =
static_cast<const MCSectionELF &
>(TextSec);
1350 if (
const MCSymbol *Group = ElfSec.getGroup()) {
1351 GroupName = Group->getName();
1354 return Ctx->getELFSection(
1356 true, ElfSec.getUniqueID(),
1361 unsigned Characteristics =
1363 const auto &COFFSec =
static_cast<const MCSectionCOFF &
>(TextSec);
1364 if (
const MCSymbol *COMDATSym = COFFSec.getCOMDATSymbol()) {
1366 COMDATSymName = COMDATSym->getName();
1371 COMDATSymName,
Selection, COFFSec.getUniqueID());
1380 if (!Ctx->getTargetTriple().supportsCOMDAT() || FuncName.
empty())
1395 auto ObjFileType = Ctx->getObjectFileType();
1399 return Ctx->getELFSection(
1400 S->getName(), S->getType(), Flags, S->getEntrySize(),
1405 unsigned Characteristics =
1407 std::string COMDATSymName =
1410 return Ctx->getCOFFSection(S->getName(), Characteristics, COMDATSymName,
1433 const auto &ElfSec =
static_cast<const MCSectionELF &
>(*TextSec);
1434 if (
const MCSymbol *Group = ElfSec.getGroup()) {
1435 GroupName = Group->getName();
1438 return Ctx->getELFSection(
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
amdgpu AMDGPU DAG DAG Pattern Instruction Selection
static bool useCompactUnwind(const Triple &T)
This file declares the MCSectionGOFF class, which contains all of the necessary machine code sections...
This file contains the MCSymbolGOFF class.
PassInstrumentationCallbacks PIC
This file contains data-structure definitions and constants to support unwinding based on ....
Context object for machine code objects.
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
MCSection * NonLazySymbolPointerSection
MCSection * TLSBSSSection
Section directive for Thread Local uninitialized data.
MCSection * CallGraphSection
Section containing call graph metadata.
MCSection * DwarfDebugNamesSection
Accelerator table sections.
MCSection * DwarfAddrSection
const MCSection * TLSThreadInitSection
Section for thread local data initialization functions.
MCSection * GEHContSection
MCSection * DwarfStrOffSection
The DWARF v5 string offset and address table sections.
MCSection * DwarfARangesSection
MCSection * DwarfStrSection
MCSection * MergeableConst16Section
MCSection * COFFGlobalTypeHashesSection
MCSection * SFrameSection
SFrame section.
MCSection * DwarfLocDWOSection
MCSection * MergeableConst4Section
MCSection * DwarfMacinfoSection
MCSection * DwarfPubNamesSection
MCSection * DwarfGnuPubTypesSection
Section for newer gnu pubtypes.
MCSection * getLLVMStatsSection() const
MCSection * DwarfCUIndexSection
MCSection * TextSection
Section directive for standard text.
MCSection * ConstDataCoalSection
MCSection * LLVMStatsSection
MCSection * ConstTextCoalSection
MCSection * TLSDataSection
Section directive for Thread Local data. ELF, MachO, COFF, and Wasm.
MCSection * MergeableConst8Section
MCSection * AddrSigSection
MCSection * DwarfInfoSection
MCSection * ThreadLocalPointerSection
MCSection * LSDASection
If exception handling is supported by the target, this is the section the Language Specific Data Area...
MCSection * CompactUnwindSection
If exception handling is supported by the target and the target can support a compact representation ...
MCSection * COFFDebugSymbolsSection
MCSection * DwarfStrDWOSection
MCSection * getPseudoProbeDescSection(StringRef FuncName, uint64_t FuncHash) const
MCSection * DwarfLoclistsSection
The DWARF v5 locations list section.
MCSection * ReadOnly16Section
MCSection * DwarfLocSection
MCSection * PseudoProbeSection
Section for pseudo probe information used by AutoFDO.
MCSection * FourByteConstantSection
MCSection * DwarfAccelNamesSection
MCSection * ReadOnly8Section
MCSection * getStackSizesSection(const MCSection &TextSec) const
MCSection * DwarfRnglistsSection
The DWARF v5 range list section.
const MCSection * DwarfDebugInlineSection
MCSection * DataBSSSection
MCSection * DwarfAbbrevDWOSection
MCSection * getBBAddrMapSection(const MCSection &TextSec) const
MCSection * COFFDebugTypesSection
MCSection * LazySymbolPointerSection
MCSection * RemarksSection
Remarks section.
MCSection * getPseudoProbeSection(const MCSection &TextSec) const
MCSection * TextCoalSection
MCSection * PseudoProbeDescSection
MCSection * DwarfPubTypesSection
MCSection * DwarfRangesSection
MCSection * DwarfStrOffDWOSection
MCSection * TLSExtraDataSection
Extra TLS Variable Data section.
MCSection * DataRelROSection
MCSection * EHFrameSection
EH frame section.
bool OmitDwarfIfHaveCompactUnwind
OmitDwarfIfHaveCompactUnwind - True if the target object file supports having some functions with com...
MCSection * CStringSection
MCSection * DrectveSection
COFF specific sections.
MCSection * FaultMapSection
FaultMap section.
MCSection * getKCFITrapSection(const MCSection &TextSec) const
MCSection * DwarfAccelObjCSection
MCSection * TLSTLVSection
Section for thread local structure information.
MCSection * DwarfSwiftASTSection
MCSection * DwarfMacroSection
void initMCObjectFileInfo(MCContext &MCCtx, bool PIC, bool LargeCodeModel=false)
MCSection * DataCoalSection
MCSection * DwarfFrameSection
MCSection * SXDataSection
MCSection * UStringSection
MCSection * DwarfRnglistsDWOSection
The DWARF v5 range and location list sections for fission.
MCSection * ImportCallSection
If import call optimization is supported by the target, this is the section to emit import call data ...
MCSection * MergeableConst32Section
MCSection * SixteenByteConstantSection
virtual ~MCObjectFileInfo()
MCSection * DataCommonSection
MCSection * getPCSection(StringRef Name, const MCSection *TextSec) const
std::optional< sframe::ABI > SFrameABIArch
SFrame ABI architecture byte.
MCSection * DwarfLineStrSection
bool SupportsCompactUnwindWithoutEHFrame
True if the target object file supports emitting a compact unwind section without an associated EH fr...
MCSection * ReadOnlySection
Section that is readonly and can contain arbitrary initialized data.
MCSection * DwarfLineDWOSection
MCSection * DwarfAbbrevSection
MCSection * DwarfLineSection
MCSection * TOCBaseSection
unsigned FDECFIEncoding
FDE CFI encoding.
MCSection * DwarfTUIndexSection
MCSection * DwarfLoclistsDWOSection
MCSection * getCallGraphSection(const MCSection &TextSec) const
MCSection * DwarfInfoDWOSection
MCSection * BSSSection
Section that is default initialized to zero.
MCSection * PPA2ListSection
MCSection * EightByteConstantSection
MCSection * StackSizesSection
Section containing metadata on function stack sizes.
unsigned CompactUnwindDwarfEHFrameOnly
Compact unwind encoding indicating that we should emit only an EH frame.
MCSection * getTextSection() const
MCSection * DwarfTypesDWOSection
MCSection * DwarfGnuPubNamesSection
Section for newer gnu pubnames.
MCSection * ConstDataSection
MCSection * StackMapSection
StackMap section.
MCSection * DwarfMacroDWOSection
MCSection * DwarfMacinfoDWOSection
MCContext & getContext() const
MCSection * DwarfAccelNamespaceSection
MCSection * DwarfAccelTypesSection
MCSection * DataSection
Section directive for standard data.
This represents a section on Windows.
This represents a section on linux, lots of unix variants and some bare metal systems.
unsigned getFlags() const
unsigned getUniqueID() const
const MCSymbolELF * getGroup() const
void setSymbolTableName(StringRef STN)
MCSymbolXCOFF * getQualNameSymbol() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
void setAlignment(Align Value)
static constexpr unsigned NonUniqueID
void setBeginSymbol(MCSymbol *Sym)
MCSymbol * getBeginSymbol()
void setSymbolTableName(StringRef STN)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static SectionKind getThreadData()
static SectionKind getMetadata()
static SectionKind getMergeable2ByteCString()
static SectionKind getMergeableConst4()
static SectionKind getText()
static SectionKind getReadOnlyWithRel()
static SectionKind getData()
static SectionKind getMergeableConst8()
static SectionKind getBSS()
static SectionKind getThreadBSS()
static SectionKind getMergeableConst16()
static SectionKind getMergeable1ByteCString()
static SectionKind getReadOnly()
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
Triple - Helper class for working with autoconf configuration names.
static Twine utohexstr(uint64_t Val)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
@ IMAGE_SCN_CNT_UNINITIALIZED_DATA
@ IMAGE_SCN_MEM_DISCARDABLE
@ IMAGE_SCN_CNT_INITIALIZED_DATA
@ IMAGE_COMDAT_SELECT_ASSOCIATIVE
@ IMAGE_COMDAT_SELECT_EXACT_MATCH
constexpr StringLiteral CLASS_WSA
constexpr StringLiteral CLASS_PPA2
constexpr StringLiteral CLASS_CODE
@ S_THREAD_LOCAL_VARIABLE_POINTERS
S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread local structures.
@ S_16BYTE_LITERALS
S_16BYTE_LITERALS - Section with only 16 byte literals.
@ S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local variable initialization pointers to...
@ S_COALESCED
S_COALESCED - Section contains symbols that are to be coalesced.
@ S_THREAD_LOCAL_ZEROFILL
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
@ S_LAZY_SYMBOL_POINTERS
S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
@ S_CSTRING_LITERALS
S_CSTRING_LITERALS - Section with literal C strings.
@ S_THREAD_LOCAL_REGULAR
S_THREAD_LOCAL_REGULAR - Thread local data section.
@ S_ZEROFILL
S_ZEROFILL - Zero fill on demand section.
@ S_NON_LAZY_SYMBOL_POINTERS
S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
@ S_4BYTE_LITERALS
S_4BYTE_LITERALS - Section with 4 byte literals.
@ S_8BYTE_LITERALS
S_8BYTE_LITERALS - Section with 8 byte literals.
@ S_THREAD_LOCAL_VARIABLES
S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure data.
@ S_ATTR_DEBUG
S_ATTR_DEBUG - A debug section.
@ S_ATTR_NO_DEAD_STRIP
S_ATTR_NO_DEAD_STRIP - No dead stripping.
@ S_ATTR_NO_TOC
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents.
@ S_ATTR_LIVE_SUPPORT
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
@ S_ATTR_PURE_INSTRUCTIONS
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
@ 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...
@ SSUBTYP_DWARNGE
DWARF aranges section.
@ SSUBTYP_DWFRAME
DWARF frame section.
@ SSUBTYP_DWABREV
DWARF abbrev section.
@ SSUBTYP_DWINFO
DWARF info section.
@ SSUBTYP_DWRNGES
DWARF ranges section.
@ SSUBTYP_DWLOC
DWARF loc section.
@ SSUBTYP_DWMAC
DWARF macinfo section.
@ SSUBTYP_DWPBNMS
DWARF pubnames section.
@ SSUBTYP_DWPBTYP
DWARF pubtypes section.
@ SSUBTYP_DWLINE
DWARF line section.
@ SSUBTYP_DWSTR
DWARF str section.
@ XMC_TC0
TOC Anchor for TOC Addressability.
@ XMC_TL
Initialized thread-local variable.
@ XMC_RO
Read Only Constant.
@ XTY_SD
Csect definition for initialized storage.
This is an optimization pass for GlobalISel generic memory operations.
std::string utostr(uint64_t X, bool isNeg=false)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)