26static constexpr struct {
73static constexpr struct {
77#define ENTRY(ASMNAME, ENUM) \
78 { MachO::ENUM, StringLiteral(ASMNAME), StringLiteral(#ENUM) },
98 TypeAndAttributes(TAA), Reserved2(reserved2) {
100 "Segment or section string too long");
101 for (
unsigned i = 0; i != 16; ++i) {
102 if (i < Segment.
size())
103 SegmentName[i] = Segment[i];
113 OS <<
"\t.section\t" << Sec.getSegmentName() <<
',' << Sec.getName();
116 unsigned TAA = Sec.getTypeAndAttributes();
124 "Invalid SectionType specified!");
137 if (SectionAttrs == 0) {
140 if (Sec.Reserved2 != 0)
141 OS <<
",none," << Sec.Reserved2;
147 char Separator =
',';
156 SectionAttrs &= ~SectionAttrDescriptors[i].AttrFlag;
166 assert(SectionAttrs == 0 &&
"Unknown section attributes!");
169 if (Sec.Reserved2 != 0)
170 OS <<
',' << Sec.Reserved2;
184 unsigned &StubSize) {
188 Spec.split(SplitSpec,
',');
190 auto GetEmptyOrTrim = [&SplitSpec](
size_t Idx) ->
StringRef {
193 Segment = GetEmptyOrTrim(0);
194 Section = GetEmptyOrTrim(1);
195 StringRef SectionType = GetEmptyOrTrim(2);
197 StringRef StubSizeStr = GetEmptyOrTrim(4);
202 "mach-o section specifier requires a segment "
203 "and section separated by a comma");
206 if (Section.size() > 16)
208 "mach-o section specifier requires a section "
209 "whose length is between 1 and 16 characters");
214 if (SectionType.empty())
218 auto TypeDescriptor =
221 return SectionType == Descriptor.AssemblerName;
227 "mach-o section specifier uses an unknown "
239 "mach-o section specifier of type "
240 "'symbol_stubs' requires a size specifier");
246 Attrs.split(SectionAttrs,
'+', -1,
false);
248 for (
StringRef &SectionAttr : SectionAttrs) {
249 auto AttrDescriptorI =
252 return SectionAttr.trim() == Descriptor.AssemblerName;
256 "mach-o section specifier has invalid "
259 TAA |= AttrDescriptorI->AttrFlag;
263 if (StubSizeStr.
empty()) {
267 "mach-o section specifier of type "
268 "'symbol_stubs' requires a size specifier");
275 "mach-o section specifier cannot have a stub "
276 "size specified because it does not have type "
282 "mach-o section specifier has a malformed "
291 Atoms.resize(L->Tail->getLayoutOrder() + 1);
295 return I < Atoms.size() ? Atoms[
I] :
nullptr;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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 @516 SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1]
SectionTypeDescriptors - These are strings that describe the various section types.
static constexpr struct @517 SectionAttrDescriptors[]
SectionAttrDescriptors - This is an array of descriptors for section attributes.
#define ENTRY(ASMNAME, ENUM)
StringLiteral AssemblerName
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
void printSwitchToSection(const MCSection &, uint32_t, const Triple &, raw_ostream &) const final
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.
This represents a section on a Mach-O system (used by Mac OS X).
static Error ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize)
Parse the section specifier indicated by "Spec".
void setAtom(size_t I, const MCSymbol *Sym)
const MCSymbol * getAtom(size_t I) const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
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.
bool isVirtualSection(uint8_t type)
@ 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...
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.
LLVM_ABI 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.