aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-03-25 12:08:50 +0100
committerAndrew Kelley <andrew@ziglang.org>2020-03-28 11:20:38 -0400
commitd788b0cd8b0b12ec4f3dddf4ecdb59556b73d4c2 (patch)
treebc0dbd74dbdeb7f0fc8bdfaac3d2cf4a1b92006a /lib/std/start.zig
parent12e1c6e21c1d21238450903ad7f8fa4ce52ee758 (diff)
downloadzig-d788b0cd8b0b12ec4f3dddf4ecdb59556b73d4c2.tar.gz
zig-d788b0cd8b0b12ec4f3dddf4ecdb59556b73d4c2.zip
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.
Diffstat (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig8
1 files changed, 1 insertions, 7 deletions
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.