19 static constexpr
struct {
64 static constexpr
struct {
68 #define ENTRY(ASMNAME, ENUM) \ 69 { MachO::ENUM, StringLiteral(ASMNAME), StringLiteral(#ENUM) }, 87 :
MCSection(SV_MachO, K, Begin), TypeAndAttributes(TAA),
88 Reserved2(reserved2) {
90 "Segment or section string too long");
91 for (
unsigned i = 0; i != 16; ++i) {
92 if (i < Segment.
size())
93 SegmentName[i] = Segment[i];
97 if (i < Section.
size())
106 const MCExpr *Subsection)
const {
118 "Invalid SectionType specified!");
131 if (SectionAttrs == 0) {
135 OS <<
",none," << Reserved2;
141 char Separator =
',';
160 assert(SectionAttrs == 0 &&
"Unknown section attributes!");
164 OS <<
',' << Reserved2;
188 unsigned &StubSize) {
192 Spec.
split(SplitSpec,
',');
194 auto GetEmptyOrTrim = [&SplitSpec](
size_t Idx) ->
StringRef {
195 return SplitSpec.
size() > Idx ? SplitSpec[Idx].trim() :
StringRef();
197 Segment = GetEmptyOrTrim(0);
198 Section = GetEmptyOrTrim(1);
201 StringRef StubSizeStr = GetEmptyOrTrim(4);
204 if (Segment.
empty() || Segment.
size() > 16)
205 return "mach-o section specifier requires a segment whose length is " 206 "between 1 and 16 characters";
210 return "mach-o section specifier requires a segment and section " 211 "separated by a comma";
213 if (Section.
size() > 16)
214 return "mach-o section specifier requires a section whose length is " 215 "between 1 and 16 characters";
220 if (SectionType.
empty())
227 return SectionType == Descriptor.AssemblerName;
232 return "mach-o section specifier uses an unknown section type";
242 return "mach-o section specifier of type 'symbol_stubs' requires a size " 249 Attrs.
split(SectionAttrs,
'+', -1,
false);
251 for (
StringRef &SectionAttr : SectionAttrs) {
255 return SectionAttr.trim() == Descriptor.AssemblerName;
258 return "mach-o section specifier has invalid attribute";
260 TAA |= AttrDescriptorI->AttrFlag;
264 if (StubSizeStr.
empty()) {
267 return "mach-o section specifier of type 'symbol_stubs' requires a size " 274 return "mach-o section specifier cannot have a stub size specified because " 275 "it does not have type 'symbol_stubs'";
279 return "mach-o section specifier has a malformed stub size";
Instances of this class represent a uniqued identifier for a section in the current translation unit...
const_iterator end(StringRef path)
Get end iterator over path.
S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in the Reserved2 field.
bool hasAttribute(unsigned Value) const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
This class represents lattice values for constants.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by dyld.
S_ATTR_NO_DEAD_STRIP - No dead stripping.
unsigned getTypeAndAttributes() const
Base class for the full range of assembler expressions which are needed for parsing.
StringRef getSectionName() const
#define ENTRY(ASMNAME, ENUM)
StringLiteral AssemblerName
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
S_ATTR_EXT_RELOC - Section has external relocation entries.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
StringRef getSegmentName() const
This class is intended to be used as a base class for asm properties and features specific to the tar...
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
static std::string ParseSectionSpecifier(StringRef Spec, StringRef &Segment, StringRef &Section, unsigned &TAA, bool &TAAParsed, unsigned &StubSize)
Parse the section specifier indicated by "Spec".
S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4 gigabytes).
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
SectionKind - This is a simple POD value that classifies the properties of a section.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
bool UseCodeAlign() const override
Return true if a .align directive should use "optimized nops" to fill instead of 0s.
MachO::SectionType getType() const
Triple - Helper class for working with autoconf configuration names.
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
S_ATTR_LOC_RELOC - Section has local relocation entries.
static constexpr struct @362 SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1]
SectionTypeDescriptors - These are strings that describe the various section types.
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents...
S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
S_ATTR_DEBUG - A debug section.
bool isVirtualSection() const override
Check whether this section is "virtual", that is has no actual object file contents.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section in files with the MY_DYLDLINK f...
S_ZEROFILL - Zero fill on demand section.
SectionType
These are the section type and attributes fields.
static constexpr struct @363 SectionAttrDescriptors[]
SectionAttrDescriptors - This is an array of descriptors for section attributes.
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override