| author | |
| committer | |
| log | 6a687bda76a34775bde35ee386e59f53961341f7 |
| tree | b6ed1c723a5cdc2655e68ceea5c7dd4e609d0c71 |
| parent | 93a49076f725e6e64f05b6be8422312c7dcda6d0 |
3 files changed, 12 insertions(+), 4 deletions(-)
lib/std/os/test.zig-1| ... | ... | @@ -116,7 +116,6 @@ test "AtomicFile" { |
| 116 | 116 | |
| 117 | 117 | test "thread local storage" { |
| 118 | 118 | if (builtin.single_threaded) return error.SkipZigTest; |
| 119 | if (builtin.os == .windows) return error.SkipZigTest; | |
| 120 | 119 | const thread1 = try Thread.spawn({}, testTls); |
| 121 | 120 | const thread2 = try Thread.spawn({}, testTls); |
| 122 | 121 | testTls({}); |
lib/std/special/start_windows_tls.zig+12| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | |
| 2 | 3 | |
| 3 | 4 | export var _tls_index: u32 = std.os.windows.TLS_OUT_OF_INDEXES; |
| 4 | 5 | export var _tls_start: u8 linksection(".tls") = 0; |
| ... | ... | @@ -6,6 +7,17 @@ export var _tls_end: u8 linksection(".tls$ZZZ") = 0; |
| 6 | 7 | export var __xl_a: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") = null; |
| 7 | 8 | export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null; |
| 8 | 9 | |
| 10 | comptime { | |
| 11 | if (builtin.arch == .i386) { | |
| 12 | // The __tls_array is the offset of the ThreadLocalStoragePointer field | |
| 13 | // in the TEB block whose base address held in the %fs segment. | |
| 14 | asm ( | |
| 15 | \\ .global __tls_array | |
| 16 | \\ __tls_array = 0x2C | |
| 17 | ); | |
| 18 | } | |
| 19 | } | |
| 20 | ||
| 9 | 21 | // TODO this is how I would like it to be expressed |
| 10 | 22 | // TODO also note, ReactOS has a +1 on StartAddressOfRawData and AddressOfCallBacks. Investigate |
| 11 | 23 | // why they do that. |
test/stage1/behavior/misc.zig-3| ... | ... | @@ -687,9 +687,6 @@ fn getNull() ?*i32 { |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | test "thread local variable" { |
| 690 | if (builtin.os == .windows and builtin.arch == .i386) | |
| 691 | return error.SkipZigTest; | |
| 692 | ||
| 693 | 690 | const S = struct { |
| 694 | 691 | threadlocal var t: i32 = 1234; |
| 695 | 692 | }; |