diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-05-07 13:04:22 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2019-05-07 13:09:20 +0200 |
| commit | 2f041239cb0c14c8c8e416ed799a3bacb2470fde (patch) | |
| tree | e0a8b577458a634e1eed803bf299006704287b17 /std | |
| parent | cfcf02489d32c2d0b71ce00b66033b790f7e1135 (diff) | |
| download | zig-2f041239cb0c14c8c8e416ed799a3bacb2470fde.tar.gz zig-2f041239cb0c14c8c8e416ed799a3bacb2470fde.zip | |
Always initialize the TLS
Diffstat (limited to 'std')
| -rw-r--r-- | std/special/bootstrap.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/std/special/bootstrap.zig b/std/special/bootstrap.zig index 23e81d2ab1..e6505c836b 100644 --- a/std/special/bootstrap.zig +++ b/std/special/bootstrap.zig @@ -69,16 +69,16 @@ fn posixCallMainAndExit() noreturn { const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count]; if (builtin.os == builtin.Os.linux) { + // Find the beginning of the auxiliary vector const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1); std.os.linux_elf_aux_maybe = auxv; - + // Initialize the TLS area std.os.linux.tls.initTLS(); - if (!builtin.single_threaded) { - if (std.os.linux.tls.tls_image) |tls_img| { - const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size); - const tp = std.os.linux.tls.copyTLS(tls_addr); - std.os.linux.tls.setThreadPointer(tp); - } + + if (std.os.linux.tls.tls_image) |tls_img| { + const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size); + const tp = std.os.linux.tls.copyTLS(tls_addr); + std.os.linux.tls.setThreadPointer(tp); } } |
