authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-07 13:04:22+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-07 13:09:20+02:00
log2f041239cb0c14c8c8e416ed799a3bacb2470fde
treee0a8b577458a634e1eed803bf299006704287b17
parentcfcf02489d32c2d0b71ce00b66033b790f7e1135

Always initialize the TLS


1 files changed, 7 insertions(+), 7 deletions(-)

std/special/bootstrap.zig+7-7
...@@ -69,16 +69,16 @@ fn posixCallMainAndExit() noreturn {...@@ -69,16 +69,16 @@ fn posixCallMainAndExit() noreturn {
69 const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count];69 const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count];
7070
71 if (builtin.os == builtin.Os.linux) {71 if (builtin.os == builtin.Os.linux) {
72 // Find the beginning of the auxiliary vector
72 const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1);73 const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1);
73 std.os.linux_elf_aux_maybe = auxv;74 std.os.linux_elf_aux_maybe = auxv;
7475 // Initialize the TLS area
75 std.os.linux.tls.initTLS();76 std.os.linux.tls.initTLS();
76 if (!builtin.single_threaded) {77
77 if (std.os.linux.tls.tls_image) |tls_img| {78 if (std.os.linux.tls.tls_image) |tls_img| {
78 const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size);79 const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size);
79 const tp = std.os.linux.tls.copyTLS(tls_addr);80 const tp = std.os.linux.tls.copyTLS(tls_addr);
80 std.os.linux.tls.setThreadPointer(tp);81 std.os.linux.tls.setThreadPointer(tp);
81 }
82 }82 }
83 }83 }
8484