25static constexpr struct {
72static constexpr struct {
76#define ENTRY(ASMNAME, ENUM) \
77 { MachO::ENUM, StringLiteral(ASMNAME), StringLiteral(#ENUM) },
97 TypeAndAttributes(TAA), Reserved2(reserved2) {
99 "Segment or section string too long");
100 for (
unsigned i = 0; i != 16; ++i) {
101 if (i < Segment.
size())
102 SegmentName[i] = Segment[i];
122 "Invalid SectionType specified!");
135 if (SectionAttrs == 0) {
139 OS <<
",none," << Reserved2;
145 char Separator =
',';
154 SectionAttrs &= ~SectionAttrDescriptors[i].AttrFlag;
164 assert(SectionAttrs == 0 &&
"Unknown section attributes!");
168 OS <<
',' << Reserved2;
186 unsigned &StubSize) {
190 Spec.split(SplitSpec,
',');
192 auto GetEmptyOrTrim = [&SplitSpec](
size_t Idx) ->
StringRef {
195 Segment = GetEmptyOrTrim(0);
196 Section = GetEmptyOrTrim(1);
197 StringRef SectionType = GetEmptyOrTrim(2);
199 StringRef StubSizeStr = GetEmptyOrTrim(4);
204 "mach-o section specifier requires a segment "
205 "and section separated by a comma");
208 if (Section.size() > 16)
210 "mach-o section specifier requires a section "
211 "whose length is between 1 and 16 characters");
216 if (SectionType.empty())
220 auto TypeDescriptor =
223 return SectionType == Descriptor.AssemblerName;
229 "mach-o section specifier uses an unknown "
241 "mach-o section specifier of type "
242 "'symbol_stubs' requires a size specifier");
248 Attrs.split(SectionAttrs,
'+', -1,
false);
250 for (
StringRef &SectionAttr : SectionAttrs) {
251 auto AttrDescriptorI =
254 return SectionAttr.trim() == Descriptor.AssemblerName;
258 "mach-o section specifier has invalid "
261 TAA |= AttrDescriptorI->AttrFlag;
265 if (StubSizeStr.
empty()) {
269 "mach-o section specifier of type "
270 "'symbol_stubs' requires a size specifier");
277 "mach-o section specifier cannot have a stub "
278 "size specified because it does not have type "
284 "mach-o section specifier has a malformed "
293 Atoms.resize(L->Tail->getLayoutOrder() + 1);
297 return I < Atoms.size() ? Atoms[
I] :
nullptr;
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static constexpr struct @488 SectionAttrDescriptors[]
SectionAttrDescriptors - This is an array of descriptors for section attributes.
static constexpr struct @487 SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1]
SectionTypeDescriptors - These are strings that describe the various section types.
#define ENTRY(ASMNAME, ENUM)
StringLiteral AssemblerName
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Base class for the full range of assembler expressions which are needed for parsing.
static Error ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize)
Parse the section specifier indicated by "Spec".
MachO::SectionType getType() const
void setAtom(size_t I, const MCSymbol *Sym)
StringRef getSegmentName() const
const MCSymbol * getAtom(size_t I) const
bool useCodeAlign() const override
Return true if a .align directive should use "optimized nops" to fill instead of 0s.
unsigned getTypeAndAttributes() const
bool hasAttribute(unsigned Value) const
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const override
Instances of this class represent a uniqued identifier for a section in the current translation unit.
StringRef getName() const
FragList * curFragList() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
SectionKind - This is a simple POD value that classifies the properties of a section.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
Triple - Helper class for working with autoconf configuration names.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ S_ATTR_SOME_INSTRUCTIONS
S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
@ S_ATTR_EXT_RELOC
S_ATTR_EXT_RELOC - Section has external relocation entries.
@ S_ATTR_DEBUG
S_ATTR_DEBUG - A debug section.
@ S_ATTR_NO_DEAD_STRIP
S_ATTR_NO_DEAD_STRIP - No dead stripping.
@ S_ATTR_LOC_RELOC
S_ATTR_LOC_RELOC - Section has local relocation entries.
@ 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_SELF_MODIFYING_CODE
S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by dyld.
@ 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...
bool isVirtualSection(uint8_t type)
SectionType
These are the section type and attributes fields.
@ LAST_KNOWN_SECTION_TYPE
@ S_SYMBOL_STUBS
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
This is an optimization pass for GlobalISel generic memory operations.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.