{ "interposing", "S_INTERPOSING" }, // 0x0D
{ "16byte_literals", "S_16BYTE_LITERALS" }, // 0x0E
{ 0, /*FIXME??*/ "S_DTRACE_DOF" }, // 0x0F
- { 0, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" } // 0x10
+ { 0, /*FIXME??*/ "S_LAZY_DYLIB_SYMBOL_POINTERS" }, // 0x10
+ { "thread_local_regular", "S_THREAD_LOCAL_REGULAR" }, // 0x11
+ { "thread_local_zerofill", "S_THREAD_LOCAL_ZEROFILL" }, // 0x12
+ { "thread_local_variables", "S_THREAD_LOCAL_VARIABLES" }, // 0x13
+ { "thread_local_variable_pointers",
+ "S_THREAD_LOCAL_VARIABLE_POINTERS" }, // 0x14
+ { "thread_local_init_function_pointers",
+ "S_THREAD_LOCAL_INIT_FUNCTION_POINTERS"}, // 0x15
};
/// SectionAttrDescriptors - This is an array of descriptors for section
/// attributes. Unlike the SectionTypeDescriptors, this is not directly indexed
-/// by attribute, instead it is searched. The last entry has a zero AttrFlag
-/// value.
+/// by attribute, instead it is searched. The last entry has an AttrFlagEnd
+/// AttrFlag value.
static const struct {
unsigned AttrFlag;
const char *AssemblerName, *EnumName;
ENTRY(0 /*FIXME*/, S_ATTR_EXT_RELOC)
ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
#undef ENTRY
- { 0, "none", 0 }
+ { 0, "none", 0 }, // used if section has no attributes but has a stub size
+#define AttrFlagEnd 0xffffffff // non legal value, multiple attribute bits set
+ { AttrFlagEnd, 0, 0 }
};
-
-MCSectionMachO *MCSectionMachO::
-Create(const StringRef &Segment, const StringRef &Section,
- unsigned TypeAndAttributes, unsigned Reserved2,
- SectionKind K, MCContext &Ctx) {
- // S_SYMBOL_STUBS must be set for Reserved2 to be non-zero.
- return new (Ctx) MCSectionMachO(Segment, Section, TypeAndAttributes,
- Reserved2, K);
+MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
+ unsigned TAA, unsigned reserved2, SectionKind K)
+ : MCSection(SV_MachO, K), TypeAndAttributes(TAA), Reserved2(reserved2) {
+ assert(Segment.size() <= 16 && Section.size() <= 16 &&
+ "Segment or section string too long");
+ for (unsigned i = 0; i != 16; ++i) {
+ if (i < Segment.size())
+ SegmentName[i] = Segment[i];
+ else
+ SegmentName[i] = 0;
+
+ if (i < Section.size())
+ SectionName[i] = Section[i];
+ else
+ SectionName[i] = 0;
+ }
}
-void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &TAI,
+void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const {
OS << "\t.section\t" << getSegmentName() << ',' << getSectionName();
// Look up the attribute.
for (unsigned i = 0; ; ++i) {
- if (SectionAttrDescriptors[i].AttrFlag == 0)
+ if (SectionAttrDescriptors[i].AttrFlag == AttrFlagEnd)
return "mach-o section specifier has invalid attribute";
if (SectionAttrDescriptors[i].AssemblerName &&
StringRef StubSizeStr = Comma.second;
StripSpaces(StubSizeStr);
- // Convert the a null terminated buffer for strtoul.
- char TmpBuffer[32];
- if (StubSizeStr.size() >= 32)
- return"mach-o section specifier has a stub size specifier that is too long";
-
- memcpy(TmpBuffer, StubSizeStr.data(), StubSizeStr.size());
- TmpBuffer[StubSizeStr.size()] = 0;
-
- char *EndPtr;
- StubSize = strtoul(TmpBuffer, &EndPtr, 0);
-
- if (EndPtr[0] != 0)
+ // Convert the stub size from a string to an integer.
+ if (StubSizeStr.getAsInteger(0, StubSize))
return "mach-o section specifier has a malformed stub size";
return "";