25static constexpr struct {
72static constexpr struct {
76#define ENTRY(ASMNAME, ENUM) \
77 { MachO::ENUM, StringLiteral(ASMNAME), StringLiteral(#ENUM) },
96 Reserved2(reserved2) {
98 "Segment or section string too long");
99 for (
unsigned i = 0; i != 16; ++i) {
100 if (i < Segment.
size())
101 SegmentName[i] = Segment[i];
109 const MCExpr *Subsection)
const {
121 "Invalid SectionType specified!");
134 if (SectionAttrs == 0) {
138 OS <<
",none," << Reserved2;
144 char Separator =
',';
153 SectionAttrs &= ~SectionAttrDescriptors[i].AttrFlag;
163 assert(SectionAttrs == 0 &&
"Unknown section attributes!");
167 OS <<
',' << Reserved2;
191 unsigned &StubSize) {
195 Spec.split(SplitSpec,
',');
197 auto GetEmptyOrTrim = [&SplitSpec](
size_t Idx) ->
StringRef {
200 Segment = GetEmptyOrTrim(0);
201 Section = GetEmptyOrTrim(1);
202 StringRef SectionType = GetEmptyOrTrim(2);
204 StringRef StubSizeStr = GetEmptyOrTrim(4);
209 "mach-o section specifier requires a segment "
210 "and section separated by a comma");
213 if (Section.size() > 16)
215 "mach-o section specifier requires a section "
216 "whose length is between 1 and 16 characters");
221 if (SectionType.empty())
225 auto TypeDescriptor =
228 return SectionType == Descriptor.AssemblerName;
234 "mach-o section specifier uses an unknown "
246 "mach-o section specifier of type "
247 "'symbol_stubs' requires a size specifier");
253 Attrs.split(SectionAttrs,
'+', -1,
false);
255 for (
StringRef &SectionAttr : SectionAttrs) {
256 auto AttrDescriptorI =
259 return SectionAttr.trim() == Descriptor.AssemblerName;
263 "mach-o section specifier has invalid "
266 TAA |= AttrDescriptorI->AttrFlag;
270 if (StubSizeStr.
empty()) {
274 "mach-o section specifier of type "
275 "'symbol_stubs' requires a size specifier");
282 "mach-o section specifier cannot have a stub "
283 "size specified because it does not have type "
289 "mach-o section specifier has a malformed "
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 @468 SectionAttrDescriptors[]
SectionAttrDescriptors - This is an array of descriptors for section attributes.
static constexpr struct @467 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
StringRef getSegmentName() const
bool isVirtualSection() const override
Check whether this section is "virtual", that is has no actual object file contents.
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override
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
Instances of this class represent a uniqued identifier for a section in the current translation unit.
StringRef getName() 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.
SectionType
These are the section type and attributes fields.
@ S_GB_ZEROFILL
S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4 gigabytes).
@ S_THREAD_LOCAL_ZEROFILL
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
@ S_ZEROFILL
S_ZEROFILL - Zero fill on demand section.
@ LAST_KNOWN_SECTION_TYPE
@ S_SYMBOL_STUBS
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
@ 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...
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.