| ... | @@ -327,7 +327,7 @@ pub fn prepareTLS(area: []u8) usize { | ... | @@ -327,7 +327,7 @@ pub fn prepareTLS(area: []u8) usize { |
| 327 | if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; | 327 | if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; |
| 328 | } | 328 | } |
| 329 | | 329 | |
| 330 | var main_thread_tls_buffer: [256]u8 align(16) = undefined; | 330 | var main_thread_tls_buffer: [256]u8 = undefined; |
| 331 | | 331 | |
| 332 | pub fn initStaticTLS() void { | 332 | pub fn initStaticTLS() void { |
| 333 | initTLS(); | 333 | initTLS(); |
| ... | @@ -351,7 +351,9 @@ pub fn initStaticTLS() void { | ... | @@ -351,7 +351,9 @@ pub fn initStaticTLS() void { |
| 351 | }; | 351 | }; |
| 352 | | 352 | |
| 353 | // Make sure the slice is correctly aligned | 353 | // Make sure the slice is correctly aligned |
| 354 | const start = @ptrToInt(alloc_tls_area.ptr) & (tls_image.alloc_align - 1); | 354 | const begin_addr = @ptrToInt(alloc_tls_area.ptr); |
| | 355 | const begin_aligned_addr = mem.alignForward(begin_addr, tls_image.alloc_align); |
| | 356 | const start = begin_aligned_addr - begin_addr; |
| 355 | const tls_area = alloc_tls_area[start .. start + tls_image.alloc_size]; | 357 | const tls_area = alloc_tls_area[start .. start + tls_image.alloc_size]; |
| 356 | | 358 | |
| 357 | const tp_value = prepareTLS(tls_area); | 359 | const tp_value = prepareTLS(tls_area); |