LLVM 19.0.0git
ObjectFormats.cpp
Go to the documentation of this file.
1//===---------- ObjectFormats.cpp - Object format details for ORC ---------===//
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//
9// ORC-specific object format details.
10//
11//===----------------------------------------------------------------------===//
12
14
15namespace llvm {
16namespace orc {
17
20StringRef MachOEHFrameSectionName = "__TEXT,__eh_frame";
23StringRef MachOModInitFuncSectionName = "__DATA,__mod_init_func";
24StringRef MachOObjCCatListSectionName = "__DATA,__objc_catlist";
25StringRef MachOObjCCatList2SectionName = "__DATA,__objc_catlist2";
26StringRef MachOObjCClassListSectionName = "__DATA,__objc_classlist";
27StringRef MachOObjCClassNameSectionName = "__TEXT,__objc_classname";
28StringRef MachOObjCClassRefsSectionName = "__DATA,__objc_classrefs";
29StringRef MachOObjCConstSectionName = "__DATA,__objc_const";
30StringRef MachOObjCDataSectionName = "__DATA,__objc_data";
31StringRef MachOObjCImageInfoSectionName = "__DATA,__objc_imageinfo";
32StringRef MachOObjCMethNameSectionName = "__TEXT,__objc_methname";
33StringRef MachOObjCMethTypeSectionName = "__TEXT,__objc_methtype";
34StringRef MachOObjCNLCatListSectionName = "__DATA,__objc_nlcatlist";
35StringRef MachOObjCSelRefsSectionName = "__DATA,__objc_selrefs";
36StringRef MachOSwift5ProtoSectionName = "__TEXT,__swift5_proto";
37StringRef MachOSwift5ProtosSectionName = "__TEXT,__swift5_protos";
38StringRef MachOSwift5TypesSectionName = "__TEXT,__swift5_types";
39StringRef MachOSwift5TypeRefSectionName = "__TEXT,__swift5_typeref";
41StringRef MachOSwift5EntrySectionName = "__TEXT,__swift5_entry";
42StringRef MachOThreadBSSSectionName = "__DATA,__thread_bss";
43StringRef MachOThreadDataSectionName = "__DATA,__thread_data";
44StringRef MachOThreadVarsSectionName = "__DATA,__thread_vars";
45
57};
58
60
67
72};
73
76
78 for (auto &InitSection : MachOInitSectionNames) {
79 // Loop below assumes all MachO init sectios have a length-6
80 // segment name.
81 assert(InitSection[6] == ',' && "Init section seg name has length != 6");
82 if (InitSection.starts_with(SegName) && InitSection.substr(7) == SecName)
83 return true;
84 }
85 return false;
86}
87
89 for (auto &InitSection : MachOInitSectionNames)
90 if (InitSection == QualifiedName)
91 return true;
92 return false;
93}
94
96 for (StringRef InitSection : ELFInitSectionNames) {
97 StringRef Name = SecName;
98 if (Name.consume_front(InitSection) && (Name.empty() || Name[0] == '.'))
99 return true;
100 }
101 return false;
102}
103
105 return SecName.starts_with(".CRT");
106}
107
108} // namespace orc
109} // namespace llvm
std::string Name
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:257
StringRef ELFThreadBSSSectionName
StringRef MachOSwift5EntrySectionName
StringRef MachOThreadBSSSectionName
StringRef MachOThreadVarsSectionName
StringRef ELFCtorArrayFuncSectionName
StringRef ELFFiniFuncSectionName
StringRef ELFInitSectionNames[3]
StringRef MachOCompactUnwindInfoSectionName
StringRef ELFEHFrameSectionName
StringRef MachOSwift5ProtosSectionName
StringRef MachOEHFrameSectionName
StringRef MachOModInitFuncSectionName
StringRef MachOInitSectionNames[19]
StringRef MachOObjCConstSectionName
StringRef MachODataDataSectionName
StringRef MachOSwift5ProtoSectionName
bool isMachOInitializerSection(StringRef SegName, StringRef SecName)
StringRef MachOObjCCatListSectionName
StringRef MachOObjCClassRefsSectionName
StringRef ELFFiniArrayFuncSectionName
StringRef MachOObjCDataSectionName
StringRef MachOObjCClassNameSectionName
StringRef MachOObjCMethNameSectionName
StringRef MachOObjCClassListSectionName
StringRef MachOObjCSelRefsSectionName
StringRef MachOSwift5FieldMetadataSectionName
StringRef MachOCStringSectionName
StringRef MachOObjCMethTypeSectionName
StringRef MachOSwift5TypesSectionName
StringRef MachOObjCNLCatListSectionName
StringRef ELFThreadDataSectionName
StringRef ELFInitArrayFuncSectionName
StringRef MachOObjCImageInfoSectionName
StringRef MachOThreadDataSectionName
StringRef MachODataCommonSectionName
bool isCOFFInitializerSection(StringRef Name)
StringRef MachOSwift5TypeRefSectionName
bool isELFInitializerSection(StringRef SecName)
StringRef ELFInitFuncSectionName
StringRef MachOObjCCatList2SectionName
StringRef ELFDtorArrayFuncSectionName
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18