class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
- /// TLSDataSection - Section directive for Thread Local data.
+ /// TLSDataSection - Section for thread local data.
///
const MCSection *TLSDataSection; // Defaults to ".tdata".
- /// TLSBSSSection - Section directive for Thread Local uninitialized data.
+ /// TLSBSSSection - Section for thread local uninitialized data.
///
const MCSection *TLSBSSSection; // Defaults to ".tbss".
- /// TLSTLVSection - Section directive for Thread Local structure infomation.
+ /// TLSTLVSection - Section for thread local structure infomation.
/// Contains the source code name of the variable, visibility and a pointer
/// to the initial value (.tdata or .tbss).
const MCSection *TLSTLVSection; // Defaults to ".tlv".
+ /// TLSThreadInitSection - Section for thread local data initialization
+ /// functions.
+ const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
+
const MCSection *CStringSection;
const MCSection *UStringSection;
const MCSection *TextCoalSection;
S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14U,
/// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
/// variable initialization pointers to functions.
- S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15,
+ S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15U,
LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
= getContext().getMachOSection("__DATA", "__thread_vars",
MCSectionMachO::S_THREAD_LOCAL_VARIABLES,
SectionKind::getDataRel());
+
+ TLSThreadInitSection
+ = getContext().getMachOSection("__DATA", "__thread_init",
+ MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
+ SectionKind::getDataRel());
+
CStringSection // .cstring
= getContext().getMachOSection("__TEXT", "__cstring",
MCSectionMachO::S_CSTRING_LITERALS,
return ParseDirectiveSectionSwitch("__OBJC", "__selector_strs",
MCSectionMachO::S_CSTRING_LITERALS);
+ if (IDVal == ".tdata")
+ return ParseDirectiveSectionSwitch("__DATA", "__thread_data",
+ MCSectionMachO::S_THREAD_LOCAL_REGULAR);
+ if (IDVal == ".tlv")
+ return ParseDirectiveSectionSwitch("__DATA", "__thread_vars",
+ MCSectionMachO::S_THREAD_LOCAL_VARIABLES);
+ if (IDVal == ".thread_init_func")
+ return ParseDirectiveSectionSwitch("__DATA", "__thread_init",
+ MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
+
// Assembler features
if (IDVal == ".set")
return ParseDirectiveSet();
-# RUN: llvm-mc -triple i386-unknown-darwin %s | FileCheck %s
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
# CHECK: .tbss _a$tlv$init, 4
# CHECK: .tbss _b$tlv$init, 4, 3
--- /dev/null
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
+
+# CHECK: __DATA,__thread_data,thread_local_regular
+# CHECK: _a$tlv$init:
+# CHECK: .quad 4
+
+ .tdata
+_a$tlv$init:
+ .quad 4
--- /dev/null
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
+
+# CHECK: __DATA,__thread_init,thread_local_init_function_pointers
+# CHECK: .quad 0
+
+.thread_init_func
+ .quad 0
--- /dev/null
+# RUN: llvm-mc -triple x86_64-unknown-darwin %s | FileCheck %s
+
+# CHECK: __DATA,__thread_vars,thread_local_variables
+# CHECK: .globl _a
+# CHECK: _a:
+# CHECK: .quad 0
+
+ .tlv
+.globl _a
+_a:
+ .quad 0
+ .quad 0
+ .quad 0