Commit ad05509930

Andrew Kelley <andrew@ziglang.org>
2020-12-18 06:40:53
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.
1 parent 9b86dde
Changed files (1)
lib
std
os
linux
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();