From d788b0cd8b0b12ec4f3dddf4ecdb59556b73d4c2 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 25 Mar 2020 12:08:50 +0100 Subject: std: Minor changes to TLS handling * Always allocate an info block per-thread so that libc can store important stuff there. * Respect ABI-mandated alignment in more places. * Nicer code, use slices/pointers instead of raw addresses whenever possible. --- lib/std/start.zig | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'lib/std/start.zig') diff --git a/lib/std/start.zig b/lib/std/start.zig index 1a4997edbd..fbb8140666 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -152,13 +152,7 @@ fn posixCallMainAndExit() noreturn { const auxv = @ptrCast([*]std.elf.Auxv, @alignCast(@alignOf(usize), envp.ptr + envp_count + 1)); std.os.linux.elf_aux_maybe = auxv; // Initialize the TLS area - const gnu_stack_phdr = std.os.linux.tls.initTLS() orelse @panic("ELF missing stack size"); - - 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); - } + std.os.linux.tls.initStaticTLS(); // TODO This is disabled because what should we do when linking libc and this code // does not execute? And also it's causing a test failure in stack traces in release modes. -- cgit v1.2.3