LLVM 17.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";
22StringRef MachOModInitFuncSectionName = "__DATA,__mod_init_func";
23StringRef MachOObjCCatListSectionName = "__DATA,__objc_catlist";
24StringRef MachOObjCCatList2SectionName = "__DATA,__objc_catlist2";
25StringRef MachOObjCClassListSectionName = "__DATA,__objc_classlist";
26StringRef MachOObjCClassNameSectionName = "__TEXT,__objc_classname";
27StringRef MachOObjCClassRefsSectionName = "__DATA,__objc_classrefs";
28StringRef MachOObjCConstSectionName = "__DATA,__objc_const";
29StringRef MachOObjCDataSectionName = "__DATA,__objc_data";
30StringRef MachOObjCImageInfoSectionName = "__DATA,__objc_imageinfo";
31StringRef MachOObjCMethNameSectionName = "__TEXT,__objc_methname";
32StringRef MachOObjCMethTypeSectionName = "__TEXT,__objc_methtype";
33StringRef MachOObjCNLCatListSectionName = "__DATA,__objc_nlcatlist";
34StringRef MachOObjCSelRefsSectionName = "__DATA,__objc_selrefs";
35StringRef MachOSwift5ProtoSectionName = "__TEXT,__swift5_proto";
36StringRef MachOSwift5ProtosSectionName = "__TEXT,__swift5_protos";
37StringRef MachOSwift5TypesSectionName = "__TEXT,__swift5_types";
38StringRef MachOSwift5TypeRefSectionName = "__TEXT,__swift5_typeref";
40StringRef MachOSwift5EntrySectionName = "__TEXT,__swift5_entry";
41StringRef MachOThreadBSSSectionName = "__DATA,__thread_bss";
42StringRef MachOThreadDataSectionName = "__DATA,__thread_data";
43StringRef MachOThreadVarsSectionName = "__DATA,__thread_vars";
44
56};
57
60
63
65 for (auto &InitSection : MachOInitSectionNames) {
66 // Loop below assumes all MachO init sectios have a length-6
67 // segment name.
68 assert(InitSection[6] == ',' && "Init section seg name has length != 6");
69 if (InitSection.starts_with(SegName) && InitSection.substr(7) == SecName)
70 return true;
71 }
72 return false;
73}
74
76 for (auto &InitSection : MachOInitSectionNames)
77 if (InitSection == QualifiedName)
78 return true;
79 return false;
80}
81
84 (SecName.empty() || SecName[0] == '.'))
85 return true;
86 return false;
87}
88
90 return SecName.startswith(".CRT");
91}
92
93} // namespace orc
94} // namespace llvm
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
bool startswith(StringRef Prefix) const
Definition: StringRef.h:261
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
Definition: StringRef.h:633
StringRef ELFThreadBSSSectionName
StringRef MachOSwift5EntrySectionName
StringRef MachOThreadBSSSectionName
StringRef MachOThreadVarsSectionName
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 MachOObjCDataSectionName
StringRef MachOObjCClassNameSectionName
StringRef MachOObjCMethNameSectionName
StringRef MachOObjCClassListSectionName
StringRef MachOObjCSelRefsSectionName
StringRef MachOSwift5FieldMetadataSectionName
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 MachOObjCCatList2SectionName
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18