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 {
6969 const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count];
7070
7171 if (builtin.os == builtin.Os.linux) {
72 // Find the beginning of the auxiliary vector
7273 const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1);
7374 std.os.linux_elf_aux_maybe = auxv;
74
75 // Initialize the TLS area
7576 std.os.linux.tls.initTLS();
76 if (!builtin.single_threaded) {
77 if (std.os.linux.tls.tls_image) |tls_img| {
78 const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size);
79 const tp = std.os.linux.tls.copyTLS(tls_addr);
80 std.os.linux.tls.setThreadPointer(tp);
81 }
77
78 if (std.os.linux.tls.tls_image) |tls_img| {
79 const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size);
80 const tp = std.os.linux.tls.copyTLS(tls_addr);
81 std.os.linux.tls.setThreadPointer(tp);
8282 }
8383 }
8484