[llvm] r195849 - Use the same tls section name as msvc.
Rafael Espindola
rafael.espindola at gmail.com
Wed Nov 27 07:52:11 PST 2013
Author: rafael
Date: Wed Nov 27 09:52:11 2013
New Revision: 195849
URL: http://llvm.org/viewvc/llvm-project?rev=195849&view=rev
Log:
Use the same tls section name as msvc.
We currently error in clang with:
"error: thread-local storage is unsupported for the current target", but we
can start to get the llvm level ready.
When compiling
template<typename T>
struct foo {
static __declspec(thread) int bar;
};
template<typename T>
__declspec(therad) int foo<T>::bar;
template struct foo<int>;
msvc produces
SECTION HEADER #3
.tls$ name
0 physical address
0 virtual address
4 size of raw data
12F file pointer to raw data (0000012F to 00000132)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0301040 flags
Initialized Data
COMDAT; sym= "public: static int foo<int>::bar" (?bar@?$foo at H@@2HA)
4 byte align
Read Write
gcc produces a ".data$__emutls_v.<symbol>" for the testcase with
__declspec(thread) replaced with thread_local.
Modified:
llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/trunk/test/MC/COFF/weak-symbol.ll
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=195849&r1=195848&r2=195849&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Wed Nov 27 09:52:11 2013
@@ -744,7 +744,7 @@ static const char *getCOFFSectionNameFor
if (Kind.isBSS ())
return ".bss";
if (Kind.isThreadLocal())
- return ".tls";
+ return ".tls$";
if (Kind.isWriteable())
return ".data";
return ".rdata";
Modified: llvm/trunk/test/MC/COFF/weak-symbol.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/weak-symbol.ll?rev=195849&r1=195848&r2=195849&view=diff
==============================================================================
--- llvm/trunk/test/MC/COFF/weak-symbol.ll (original)
+++ llvm/trunk/test/MC/COFF/weak-symbol.ll Wed Nov 27 09:52:11 2013
@@ -36,3 +36,13 @@ define weak void @f() section ".sect" {
; X64: .globl a
; X64: .zero 12
@a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data"
+
+; X86: .section .tls$,"w",discard,_b
+; X86: .globl _b
+; X86: .long 0
+;
+; X64: .section .tls$,"w",discard,b
+; X64: .globl b
+; X64: .long 0
+
+ at b = weak_odr thread_local global i32 0, align 4
More information about the llvm-commits
mailing list