22 {
"regular",
"S_REGULAR" },
24 {
"cstring_literals",
"S_CSTRING_LITERALS" },
25 {
"4byte_literals",
"S_4BYTE_LITERALS" },
26 {
"8byte_literals",
"S_8BYTE_LITERALS" },
27 {
"literal_pointers",
"S_LITERAL_POINTERS" },
28 {
"non_lazy_symbol_pointers",
"S_NON_LAZY_SYMBOL_POINTERS" },
29 {
"lazy_symbol_pointers",
"S_LAZY_SYMBOL_POINTERS" },
30 {
"symbol_stubs",
"S_SYMBOL_STUBS" },
31 {
"mod_init_funcs",
"S_MOD_INIT_FUNC_POINTERS" },
32 {
"mod_term_funcs",
"S_MOD_TERM_FUNC_POINTERS" },
33 {
"coalesced",
"S_COALESCED" },
35 {
"interposing",
"S_INTERPOSING" },
36 {
"16byte_literals",
"S_16BYTE_LITERALS" },
38 {
StringRef(),
"S_LAZY_DYLIB_SYMBOL_POINTERS" },
39 {
"thread_local_regular",
"S_THREAD_LOCAL_REGULAR" },
40 {
"thread_local_zerofill",
"S_THREAD_LOCAL_ZEROFILL" },
41 {
"thread_local_variables",
"S_THREAD_LOCAL_VARIABLES" },
42 {
"thread_local_variable_pointers",
43 "S_THREAD_LOCAL_VARIABLE_POINTERS" },
44 {
"thread_local_init_function_pointers",
45 "S_THREAD_LOCAL_INIT_FUNCTION_POINTERS"},
56 #define ENTRY(ASMNAME, ENUM) \
57 { MachO::ENUM, ASMNAME, #ENUM },
75 :
MCSection(SV_MachO, K, Begin), TypeAndAttributes(TAA),
76 Reserved2(reserved2) {
78 "Segment or section string too long");
79 for (
unsigned i = 0;
i != 16; ++
i) {
80 if (
i < Segment.
size())
81 SegmentName[
i] = Segment[
i];
85 if (
i < Section.
size())
92 void MCSectionMachO::PrintSwitchToSection(
const MCAsmInfo &MAI,
94 const MCExpr *Subsection)
const {
106 "Invalid SectionType specified!");
119 if (SectionAttrs == 0) {
123 OS <<
",none," << Reserved2;
148 assert(SectionAttrs == 0 &&
"Unknown section attributes!");
152 OS <<
',' << Reserved2;
176 unsigned &StubSize) {
180 Spec.
split(SplitSpec,
',');
182 auto GetEmptyOrTrim = [&SplitSpec](
size_t Idx) ->
StringRef {
183 return SplitSpec.
size() > Idx ? SplitSpec[Idx].trim() :
StringRef();
185 Segment = GetEmptyOrTrim(0);
186 Section = GetEmptyOrTrim(1);
189 StringRef StubSizeStr = GetEmptyOrTrim(4);
192 if (Segment.
empty() || Segment.
size() > 16)
193 return "mach-o section specifier requires a segment whose length is "
194 "between 1 and 16 characters";
198 return "mach-o section specifier requires a segment and section "
199 "separated by a comma";
201 if (Section.
size() > 16)
202 return "mach-o section specifier requires a section whose length is "
203 "between 1 and 16 characters";
208 if (SectionType.
empty())
215 return SectionType == Descriptor.AssemblerName;
220 return "mach-o section specifier uses an unknown section type";
230 return "mach-o section specifier of type 'symbol_stubs' requires a size "
237 Attrs.
split(SectionAttrs,
'+', -1,
false);
239 for (
StringRef &SectionAttr : SectionAttrs) {
243 return SectionAttr.trim() == Descriptor.AssemblerName;
246 return "mach-o section specifier has invalid attribute";
248 TAA |= AttrDescriptorI->AttrFlag;
252 if (StubSizeStr.
empty()) {
255 return "mach-o section specifier of type 'symbol_stubs' requires a size "
262 return "mach-o section specifier cannot have a stub size specified because "
263 "it does not have type 'symbol_stubs'";
267 return "mach-o section specifier has a malformed stub size";
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.
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.
S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section in files with the MY_DYLDLINK f...
S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by dyld.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
S_ATTR_DEBUG - A debug section.
const_iterator begin(StringRef path)
Get begin iterator over path.
static const struct @273 SectionAttrDescriptors[]
SectionAttrDescriptors - This is an array of descriptors for section attributes.
Base class for the full range of assembler expressions which are needed for parsing.
S_ATTR_LOC_RELOC - Section has local relocation entries.
#define ENTRY(ASMNAME, ENUM)
S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be in a ranlib table of contents...
StringRef getSectionName() const
S_ATTR_NO_DEAD_STRIP - No dead stripping.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
This class is intended to be used as a base class for asm properties and features specific to the tar...
S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine instructions.
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_ATTR_EXT_RELOC - Section has external relocation entries.
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
bool hasAttribute(unsigned Value) const
SectionKind - This is a simple POD value that classifies the properties of a section.
bool UseCodeAlign() const override
Return true if a .align directive should use "optimized nops" to fill instead of 0s.
static const char * Separator
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
MachO::SectionType getType() const
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
StringRef getSegmentName() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
static const struct @272 SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1]
SectionTypeDescriptors - These are strings that describe the various section types.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
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())
unsigned getTypeAndAttributes() const
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_ZEROFILL - Zero fill on demand section.
auto find_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
SectionType
These are the section type and attributes fields.