From ad055099309d0faeb2725764ec441b1ee847ecbf Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 17 Dec 2020 22:40:53 -0700 Subject: [PATCH] std: align(16) main_thread_tls_buffer Before this change, thread local variables were landmines if LLVM decided to optimize any writes to them using vector instructions. --- lib/std/os/linux/tls.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index f6c339bc2c..d78a14c311 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -327,7 +327,7 @@ pub fn prepareTLS(area: []u8) usize { if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; } -var main_thread_tls_buffer: [256]u8 = undefined; +var main_thread_tls_buffer: [256]u8 align(16) = undefined; pub fn initStaticTLS() void { initTLS();