File tree Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Expand file tree Collapse file tree 4 files changed +103
-0
lines changed Original file line number Diff line number Diff line change 1+ ; We manually create these here if we're not linking against
2+ ; the CRT which would usually provide these.
3+
4+ target triple = "i686-pc-windows-msvc"
5+
6+ %IMAGE_TLS_DIRECTORY32 = type {
7+ i32 , ; StartAddressOfRawData
8+ i32 , ; EndAddressOfRawData
9+ i32 , ; AddressOfIndex
10+ i32 , ; AddressOfCallBacks
11+ i32 , ; SizeOfZeroFill
12+ i32 ; Characteristics
13+ }
14+
15+ @_tls_start = global i8 zeroinitializer , section ".tls"
16+ @_tls_end = global i8 zeroinitializer , section ".tls$ZZZ"
17+ @_tls_index = global i32 0
18+
19+ @_tls_used = global %IMAGE_TLS_DIRECTORY32 {
20+ i32 ptrtoint (i8* @_tls_start to i32 ),
21+ i32 ptrtoint (i8* @_tls_end to i32 ),
22+ i32 ptrtoint (i32* @_tls_index to i32 ),
23+ i32 0 ,
24+ i32 0 ,
25+ i32 0
26+ }, section ".rdata$T"
27+
28+ ; MSVC target uses a direct offset (0x58) for x86-64 but expects
29+ ; __tls_array to hold the offset (0x2C) on x86.
30+ module asm ".global __tls_array"
31+ module asm "__tls_array = 44"
Original file line number Diff line number Diff line change 1+ ; We manually create these here if we're not linking against
2+ ; the CRT which would usually provide these.
3+
4+ target triple = "x86_64-pc-windows-msvc"
5+
6+ %IMAGE_TLS_DIRECTORY64 = type {
7+ i64 , ; StartAddressOfRawData
8+ i64 , ; EndAddressOfRawData
9+ i64 , ; AddressOfIndex
10+ i64 , ; AddressOfCallBacks
11+ i32 , ; SizeOfZeroFill
12+ i32 ; Characteristics
13+ }
14+
15+ @_tls_start = global i8 zeroinitializer , section ".tls"
16+ @_tls_end = global i8 zeroinitializer , section ".tls$ZZZ"
17+ @_tls_index = global i64 0
18+
19+ @_tls_used = global %IMAGE_TLS_DIRECTORY64 {
20+ i64 ptrtoint (i8* @_tls_start to i64 ),
21+ i64 ptrtoint (i8* @_tls_end to i64 ),
22+ i64 ptrtoint (i64* @_tls_index to i64 ),
23+ i64 0 ,
24+ i32 0 ,
25+ i32 0
26+ }, section ".rdata$T"
Original file line number Diff line number Diff line change 1+ ; This test is to make sure that the necessary alignment for thread locals
2+ ; gets reflected in the TLS Directory of the generated executable on x86.
3+ ;
4+ ; aligned_thread_local specifies 'align 32' and so the generated
5+ ; exe should reflect that with a value of IMAGE_SCN_ALIGN_32BYTES
6+ ; in the Characteristics field of the IMAGE_TLS_DIRECTORY
7+
8+ ; RUN: llc -filetype=obj %S/Inputs/tlssup-32.ll -o %t.tlssup.obj
9+ ; RUN: llc -filetype=obj %s -o %t.obj
10+ ; RUN: lld-link %t.tlssup.obj %t.obj -entry:main -nodefaultlib -out:%t.exe
11+ ; RUN: llvm-readobj --coff-tls-directory %t.exe | FileCheck %s
12+
13+ ; CHECK: TLSDirectory {
14+ ; CHECK: Characteristics [ (0x0)
15+
16+ target triple = "i686-pc-windows-msvc"
17+
18+ @aligned_thread_local = thread_local global i32 42 , align 32
19+
20+ define i32 @main () {
21+ %t = load i32 , i32* @aligned_thread_local
22+ ret i32 %t
23+ }
Original file line number Diff line number Diff line change 1+ ; This test is to make sure that the necessary alignment for thread locals
2+ ; gets reflected in the TLS Directory of the generated executable on x86-64.
3+ ;
4+ ; aligned_thread_local specifies 'align 64' and so the generated
5+ ; exe should reflect that with a value of IMAGE_SCN_ALIGN_64BYTES
6+ ; in the Characteristics field of the IMAGE_TLS_DIRECTORY
7+
8+ ; RUN: llc -filetype=obj %S/Inputs/tlssup-64.ll -o %t.tlssup.obj
9+ ; RUN: llc -filetype=obj %s -o %t.obj
10+ ; RUN: lld-link %t.tlssup.obj %t.obj -entry:main -nodefaultlib -out:%t.exe
11+ ; RUN: llvm-readobj --coff-tls-directory %t.exe | FileCheck %s
12+
13+ ; CHECK: TLSDirectory {
14+ ; CHECK: Characteristics [ (0x0)
15+
16+ target triple = "x86_64-pc-windows-msvc"
17+
18+ @aligned_thread_local = thread_local global i32 42 , align 64
19+
20+ define i32 @main () {
21+ %t = load i32 , i32* @aligned_thread_local
22+ ret i32 %t
23+ }
You can’t perform that action at this time.
0 commit comments